Compare commits

..

34 Commits

Author SHA1 Message Date
358d400d23 Set user-agent to opwngrid.xyz
Signed-off-by: Jeroen Oudshoorn <oudshoorn.jeroen@gmail.com>
2025-01-01 15:06:51 +01:00
09aace1cf7 Set user-agent to opwngrid.xyz
Signed-off-by: Jeroen Oudshoorn <oudshoorn.jeroen@gmail.com>
2025-01-01 15:05:53 +01:00
fc0c72f7df Set a custom user-agent to hopefully help with uploading.
Signed-off-by: Jeroen Oudshoorn <oudshoorn.jeroen@gmail.com>
2025-01-01 14:54:26 +01:00
b13243466b Removed calculation for Fahrenheit, just set celsius to False.
Signed-off-by: Jeroen Oudshoorn <oudshoorn.jeroen@gmail.com>
2024-12-29 17:02:55 +01:00
bb34980179 Typo
Signed-off-by: Jeroen Oudshoorn <oudshoorn.jeroen@gmail.com>
2024-12-29 12:25:24 +01:00
ff0c1aa2f6 Defining everything for connection modify
Signed-off-by: Jeroen Oudshoorn <oudshoorn.jeroen@gmail.com>
2024-12-29 12:23:05 +01:00
7f2b3c7106 Changed config to self.options
Signed-off-by: Jeroen Oudshoorn <oudshoorn.jeroen@gmail.com>
2024-12-29 11:40:00 +01:00
3e5d802e8d Cleaner connection method for bt-tether
Signed-off-by: Jeroen Oudshoorn <oudshoorn.jeroen@gmail.com>
2024-12-29 11:36:31 +01:00
3e5e2bfb30 Disable session-stats by default
Signed-off-by: Jeroen Oudshoorn <oudshoorn.jeroen@gmail.com>
2024-12-29 11:10:15 +01:00
aa4c352bbd Remove ': ' from display
Signed-off-by: Jeroen Oudshoorn <oudshoorn.jeroen@gmail.com>
2024-12-28 20:20:23 +01:00
578731e978 Remove AT from display.
Signed-off-by: Jeroen Oudshoorn <oudshoorn.jeroen@gmail.com>
2024-12-28 20:19:26 +01:00
6d9131b4f6 Merge pull request #280 from wpa-2/patch-1
Update defaults.toml
2024-12-28 20:08:38 +01:00
4c826c90cb Update defaults.toml
<3 

Signed-off-by: wpa-2 <9049886+wpa-2@users.noreply.github.com>
2024-12-28 15:40:52 +00:00
1b11383011 Update --wizard to match new bt-tether settings.
Signed-off-by: Jeroen Oudshoorn <oudshoorn.jeroen@gmail.com>
2024-12-28 16:33:47 +01:00
6e93616ed7 Define phone-name in comment
Signed-off-by: Jeroen Oudshoorn <oudshoorn.jeroen@gmail.com>
2024-12-28 15:59:22 +01:00
824cd7efef Add error log when something other than android/ios is entered as phone type.
Signed-off-by: Jeroen Oudshoorn <oudshoorn.jeroen@gmail.com>
2024-12-28 15:51:19 +01:00
246e280201 Remove on_ready code, not actually being run.
Signed-off-by: Jeroen Oudshoorn <oudshoorn.jeroen@gmail.com>
2024-12-28 15:46:03 +01:00
4e6b513fc7 Set metric to 100
Signed-off-by: Jeroen Oudshoorn <oudshoorn.jeroen@gmail.com>
2024-12-28 15:33:46 +01:00
5dbdf1e8de Fix bt-tether to actually use IP set in config.toml
Signed-off-by: Jeroen Oudshoorn <oudshoorn.jeroen@gmail.com>
2024-12-28 15:32:22 +01:00
b28a0eb606 Update bug report for next release
Signed-off-by: Jeroen Oudshoorn <oudshoorn.jeroen@gmail.com>
2024-12-28 15:31:41 +01:00
97f7e71ad7 Next release will be 2.9.4
Signed-off-by: Jeroen Oudshoorn <oudshoorn.jeroen@gmail.com>
2024-12-28 15:31:21 +01:00
89b9eb0e46 Merge pull request #276 from j0se/feature/dynamic-var-usbiface
Update linux_connection_share.sh
2024-12-25 14:27:21 +01:00
d1f0b7bb08 feat: dynamic usbiface 2024-12-25 12:53:48 +01:00
7e26085016 Update ISSUE_TEMPLATE.yml 2024-12-22 23:39:21 +01:00
772d844526 Update bug_report.yml 2024-12-22 23:38:48 +01:00
0377b396c9 Merge pull request #267 from renewedbullet/patch-2
Update pisugarx.py
2024-12-22 02:17:51 +01:00
3fc319b650 auto-update fix
Signed-off-by: Jeroen Oudshoorn <oudshoorn.jeroen@gmail.com>
2024-12-22 02:01:08 +01:00
f34471e044 pisugarx 0 decimals for capacity
Signed-off-by: Jeroen Oudshoorn <oudshoorn.jeroen@gmail.com>
2024-12-22 01:54:20 +01:00
LH
de7e9b1c6d Update pisugarx.py
limits % to  no deci dunno how i missed this lol

Signed-off-by: LH <140523069+renewedbullet@users.noreply.github.com>
2024-12-21 19:47:35 -05:00
868314e244 Version 2.9.3-2 has some fixes coming.
Signed-off-by: Jeroen Oudshoorn <oudshoorn.jeroen@gmail.com>
2024-12-22 01:08:08 +01:00
7a8cc36a38 Set interface-name in the bt-tether config.
Signed-off-by: Jeroen Oudshoorn <oudshoorn.jeroen@gmail.com>
2024-12-22 01:07:46 +01:00
a3dce7fcbd Merge remote-tracking branch 'origin/noai' into noai 2024-12-22 00:59:27 +01:00
0472faa2bf Show only 2 decimals for capacity in %.
Signed-off-by: Jeroen Oudshoorn <oudshoorn.jeroen@gmail.com>
2024-12-22 00:59:19 +01:00
ae2eb77c7b Update backup.sh 2024-12-21 15:57:10 +01:00
15 changed files with 107 additions and 96 deletions

View File

@ -33,8 +33,9 @@ body:
label: Version label: Version
description: What version of our software are you running? description: What version of our software are you running?
options: options:
- 2.9.2 (64bit) - 2.9.3
- 2.9.2 (32bit) - 2.9.3-2
- 2.9.4
default: 0 default: 0
validations: validations:
required: true required: true

View File

@ -33,8 +33,9 @@ body:
label: Version label: Version
description: What version of our software are you running? description: What version of our software are you running?
options: options:
- 2.9.2 (64bit) - 2.9.3
- 2.9.2 (32bit) - 2.9.3-2
- 2.9.4
default: 0 default: 0
validations: validations:
required: true required: true

View File

@ -1 +1 @@
__version__ = '2.9.3' __version__ = '2.9.4'

View File

@ -215,20 +215,24 @@ def pwnagotchi_cli():
"[Y/N] ") "[Y/N] ")
if pwn_bluetooth.lower() in ('y', 'yes'): if pwn_bluetooth.lower() in ('y', 'yes'):
f.write("main.plugins.bt-tether.enabled = true\n\n") f.write("main.plugins.bt-tether.enabled = true\n\n")
pwn_bluetooth_device = input("What device do you use? Android or iOS?\n\n" pwn_bluetooth_phone_name = input("What name uses your phone, check settings?\n\n")
if pwn_bluetooth_phone_name != "":
f.write(f"main.plugins.bt-tether.phone-name = \"{pwn_bluetooth_phone_name}\"\n")
pwn_bluetooth_device = input("What device do you use? android or ios?\n\n"
"Device: ") "Device: ")
if pwn_bluetooth_device.lower() == "android": if pwn_bluetooth_device != "":
f.write("main.plugins.bt-tether.devices.android-phone.enabled = true\n") if pwn_bluetooth_device != "android" and pwn_bluetooth_device != "ios":
pwn_bluetooth_mac = input("What is the bluetooth MAC of your device?\n\n" print("You have chosen an invalid device. Please start over.")
"MAC: ") exit()
if pwn_bluetooth_mac != "": f.write(f"main.plugins.bt-tether.phone = \"{pwn_bluetooth_device.lower()}\"\n")
f.write(f"main.plugins.bt-tether.devices.android-phone.mac = \"{pwn_bluetooth_mac}\"\n") if pwn_bluetooth_device == "android":
elif pwn_bluetooth_device.lower() == "ios": f.write("main.plugins.bt-tether.ip = \"192.168.44.44\"\n")
f.write("main.plugins.bt-tether.devices.ios-phone.enabled = true\n") elif pwn_bluetooth_device == "ios":
pwn_bluetooth_mac = input("What is the bluetooth MAC of your device?\n\n" f.write("main.plugins.bt-tether.ip = \"172.20.10.6\"\n")
"MAC: ") pwn_bluetooth_mac = input("What is the bluetooth MAC of your device?\n\n"
if pwn_bluetooth_mac != "": "MAC: ")
f.write(f"main.plugins.bt-tether.devices.ios-phone.mac = \"{pwn_bluetooth_mac}\"\n") if pwn_bluetooth_mac != "":
f.write(f"main.plugins.bt-tether.mac = \"{pwn_bluetooth_mac}\"\n")
# set up display settings # set up display settings
pwn_display_enabled = input("Do you want to enable a display?\n\n" pwn_display_enabled = input("Do you want to enable a display?\n\n"
"[Y/N]: ") "[Y/N]: ")
@ -250,7 +254,9 @@ def pwnagotchi_cli():
if pwn_bluetooth.lower() in ('y', 'yes'): if pwn_bluetooth.lower() in ('y', 'yes'):
if pwn_bluetooth_device.lower == "android": if pwn_bluetooth_device.lower == "android":
print("To visit the webui when connected with your phone, visit: http://192.168.44.44:8080\n" print("To visit the webui when connected with your phone, visit: http://192.168.44.44:8080\n"
"Be sure to run `sudo bluetoothctl` to set-up the bluetooth connection for the first time. And read the wiki step 4.\n"
"Your configuration is done, and I will restart in 5 seconds.") "Your configuration is done, and I will restart in 5 seconds.")
elif pwn_bluetooth_device.lower == "ios": elif pwn_bluetooth_device.lower == "ios":
print("To visit the webui when connected with your phone, visit: http://172.20.10.6:8080\n" print("To visit the webui when connected with your phone, visit: http://172.20.10.6:8080\n"
"Your configuration is done, and I will restart in 5 seconds.") "Your configuration is done, and I will restart in 5 seconds.")

View File

@ -11,7 +11,8 @@ main.custom_plugin_repos = [
"https://github.com/jayofelony/pwnagotchi-torch-plugins/archive/master.zip", "https://github.com/jayofelony/pwnagotchi-torch-plugins/archive/master.zip",
"https://github.com/Sniffleupagus/pwnagotchi_plugins/archive/master.zip", "https://github.com/Sniffleupagus/pwnagotchi_plugins/archive/master.zip",
"https://github.com/NeonLightning/pwny/archive/master.zip", "https://github.com/NeonLightning/pwny/archive/master.zip",
"https://github.com/marbasec/UPSLite_Plugin_1_3/archive/master.zip" "https://github.com/marbasec/UPSLite_Plugin_1_3/archive/master.zip",
"https://github.com/wpa-2/Pwnagotchi-Plugins/archive/master.zip"
] ]
main.custom_plugins = "/usr/local/share/pwnagotchi/custom-plugins/" main.custom_plugins = "/usr/local/share/pwnagotchi/custom-plugins/"
@ -23,6 +24,7 @@ main.plugins.auto-update.install = false
main.plugins.auto-update.interval = 1 main.plugins.auto-update.interval = 1
main.plugins.bt-tether.enabled = false main.plugins.bt-tether.enabled = false
main.plugins.bt-tether.phone-name = "" # name as shown on the phone i.e. "Pwnagotchi's Phone"
main.plugins.bt-tether.mac = "" main.plugins.bt-tether.mac = ""
main.plugins.bt-tether.phone = "" # android or ios main.plugins.bt-tether.phone = "" # android or ios
main.plugins.bt-tether.ip = "" # 192.168.44.2 android / 172.20.10.2 ios main.plugins.bt-tether.ip = "" # 192.168.44.2 android / 172.20.10.2 ios
@ -61,7 +63,7 @@ main.plugins.pisugarx.enabled = false
main.plugins.pisugarx.rotation = false main.plugins.pisugarx.rotation = false
main.plugins.pisugarx.default_display = "percentage" main.plugins.pisugarx.default_display = "percentage"
main.plugins.session-stats.enabled = true main.plugins.session-stats.enabled = false
main.plugins.session-stats.save_directory = "/var/tmp/pwnagotchi/sessions/" main.plugins.session-stats.save_directory = "/var/tmp/pwnagotchi/sessions/"
main.plugins.ups_hat_c.enabled = false main.plugins.ups_hat_c.enabled = false

View File

@ -13,7 +13,8 @@ def is_connected():
try: try:
# check DNS # check DNS
host = 'https://api.opwngrid.xyz/api/v1/uptime' host = 'https://api.opwngrid.xyz/api/v1/uptime'
r = requests.get(host, headers=None, timeout=(30.0, 60.0)) headers = {'user-agent': f'pwnagotchi/{pwnagotchi.__version__}'}
r = requests.get(host, headers=headers, timeout=(30.0, 60.0))
if r.json().get('isUp'): if r.json().get('isUp'):
return True return True
except: except:

View File

@ -390,17 +390,6 @@ class auto_tune(plugins.Plugin):
self._agent.run("wifi.recon clear") self._agent.run("wifi.recon clear")
self._agent.run("wifi.clear") self._agent.run("wifi.clear")
# called before the plugin is unloaded
def on_unload(self, ui):
ui.set('mode', 'AUTO')
def on_ui_update(self, ui):
try:
mode = 'AT'
ui.set('mode', mode)
except Exception as e:
logging.exception(e)
# called when the agent refreshed its access points list # called when the agent refreshed its access points list
def on_wifi_update(self, agent, access_points): def on_wifi_update(self, agent, access_points):
# check aps and update active channels # check aps and update active channels

View File

@ -58,7 +58,7 @@ def check(version, repo, native=True):
def make_path_for(name): def make_path_for(name):
path = os.path.join("/opt/", name) path = os.path.join("/home/pi/", name)
if os.path.exists(path): if os.path.exists(path):
logging.debug("[update] deleting %s" % path) logging.debug("[update] deleting %s" % path)
shutil.rmtree(path, ignore_errors=True, onerror=None) shutil.rmtree(path, ignore_errors=True, onerror=None)
@ -138,10 +138,20 @@ def install(display, update):
if not os.path.exists(source_path): if not os.path.exists(source_path):
source_path = "%s-%s" % (source_path, update['available']) source_path = "%s-%s" % (source_path, update['available'])
# setup.py is going to install data files for us try:
# first we create a new virtual environment and activate it # Activate the virtual environment and install the package
os.system("cd /home/pi && source .pwn/bin/activate") subprocess.run(
os.system("cd %s && pip3 install ." % source_path) ["bash", "-c", f"source /home/pi/.pwn/bin/activate && pip install {source_path}"],
check=True
)
# Clean up the source directory
shutil.rmtree(source_path, ignore_errors=True)
except subprocess.CalledProcessError as e:
logging.error(f"Installation failed: {e}")
except Exception as e:
logging.error(f"Unexpected error: {e}")
return True return True

View File

@ -7,7 +7,7 @@ from pwnagotchi.ui.view import BLACK
class BTTether(plugins.Plugin): class BTTether(plugins.Plugin):
__author__ = 'Jayofelony' __author__ = 'Jayofelony'
__version__ = '1.0' __version__ = '1.2'
__license__ = 'GPL3' __license__ = 'GPL3'
__description__ = 'A new BT-Tether plugin' __description__ = 'A new BT-Tether plugin'
@ -19,44 +19,37 @@ class BTTether(plugins.Plugin):
def on_loaded(self): def on_loaded(self):
logging.info("[BT-Tether] plugin loaded.") logging.info("[BT-Tether] plugin loaded.")
def on_ready(self, agent): def on_config_changed(self, config):
ip = self.options['ip'] ip = self.options['ip']
mac = self.options['mac']
phone_name = self.options['phone-name'] + ' Network'
if self.options['phone'].lower() == 'android': if self.options['phone'].lower() == 'android':
address = f'{ip}/24,192.168.44.1' address = f'{ip}'
route = '192.168.44.0/24,192.168.44.1' gateway = '192.168.44.1'
elif self.options['phone'].lower() == 'ios': elif self.options['phone'].lower() == 'ios':
address = f'{ip}/24,172.20.10.1' address = f'{ip}'
route = '172.20.10.0/24,172.20.10.1' gateway = '172.20.10.1'
file = f''' else:
[connection] logging.error("[BT-Tether] Phone type not supported.")
id=bluetooth return
type=bluetooth
autoconnect=yes
[bluetooth]
bdaddr={self.options['mac']}
type=panu
[ipv4]
address1={address}
route1={route}
dns=8.8.8.8;1.1.1.1;
method=manual
[ipv6]
addr-gen-mode=default
method=disabled
[proxy]
'''
try: try:
file = '\n'.join(line.strip() for line in file.strip().splitlines() if line.strip()) subprocess.run([
with open('/etc/NetworkManager/system-connections/bluetooth.nmconnection', 'w+') as bt_file: 'nmcli', 'connection', 'modify', f'{phone_name}',
bt_file.write(file) 'connection.type', 'bluetooth',
subprocess.run(['chmod', '600', '/etc/NetworkManager/system-connections/bluetooth.nmconnection'], check=True) 'bluetooth.type', 'panu',
try: 'bluetooth.bdaddr', f'{mac}',
mac = self.options['mac'] 'ipv4.method', 'manual',
subprocess.run(['nmcli', 'device', 'connect', f'{mac}'], check=True) 'ipv4.addresses', f'{address}',
except Exception as e: 'ipv4.gateway', f'{gateway}',
logging.error(f"[BT-Tether] Failed to connect to device: {e}") 'ipv4.route-metric', '100'
], check=True)
subprocess.run(['nmcli', 'connection', 'reload'], check=True)
subprocess.run(['nmcli', 'connection', 'up', f'{phone_name}'], check=True)
except Exception as e: except Exception as e:
logging.error(f"[BT-Tether] Failed to save Bluetooth connection file: {e}") logging.error(f"[BT-Tether] Failed to connect to device: {e}")
self.ready = True
def on_ready(self, agent):
self.ready = True self.ready = True
def on_ui_setup(self, ui): def on_ui_setup(self, ui):
@ -66,23 +59,26 @@ class BTTether(plugins.Plugin):
label_font=fonts.Bold, text_font=fonts.Medium)) label_font=fonts.Bold, text_font=fonts.Medium))
def on_ui_update(self, ui): def on_ui_update(self, ui):
phone_name = self.options['phone-name'] + ' Network'
if (subprocess.run(['bluetoothctl', 'info'], capture_output=True, text=True)).stdout.find('Connected: yes') != -1: if (subprocess.run(['bluetoothctl', 'info'], capture_output=True, text=True)).stdout.find('Connected: yes') != -1:
self.status = 'C' self.status = 'C'
else: else:
self.status = '-' self.status = '-'
try: try:
mac = self.options['mac'] subprocess.run(['nmcli', 'connection', 'up', f'{phone_name}'], check=True)
subprocess.run(['nmcli', 'device', 'connect', f'{mac}'], check=True)
except Exception as e: except Exception as e:
logging.error(f"[BT-Tether] Failed to connect to device: {e}") logging.error(f"[BT-Tether] Failed to connect to device: {e}")
ui.set('bluetooth', self.status) ui.set('bluetooth', self.status)
def on_unload(self, ui): def on_unload(self, ui):
phone_name = self.options['phone-name'] + ' Network'
with ui._lock: with ui._lock:
ui.remove_element('bluetooth') ui.remove_element('bluetooth')
try: try:
mac = self.options['mac'] if (subprocess.run(['bluetoothctl', 'info'], capture_output=True, text=True)).stdout.find('Connected: yes') != -1:
subprocess.run(['nmcli', 'device', 'disconnect', f'{mac}'], check=True) subprocess.run(['nmcli', 'connection', 'down', f'{phone_name}'], check=True)
logging.info(f"[BT-Tether] Disconnected from device with MAC: {mac}") logging.info(f"[BT-Tether] Disconnected from device with name: {phone_name}")
else:
logging.info(f"[BT-Tether] Device with name {phone_name} is not connected, not disconnecting")
except Exception as e: except Exception as e:
logging.error(f"[BT-Tether] Failed to disconnect from device: {e}") logging.error(f"[BT-Tether] Failed to disconnect from device: {e}")

View File

@ -49,6 +49,8 @@ class MemTemp(plugins.Plugin):
LINE_SPACING = 10 LINE_SPACING = 10
LABEL_SPACING = 0 LABEL_SPACING = 0
FIELD_WIDTH = 4 FIELD_WIDTH = 4
def __init__(self):
self.options = dict()
def on_loaded(self): def on_loaded(self):
self._last_cpu_load = self._cpu_stat() self._last_cpu_load = self._cpu_stat()
@ -62,7 +64,7 @@ class MemTemp(plugins.Plugin):
def _cpu_stat(self): def _cpu_stat(self):
""" """
Returns the splitted first line of the /proc/stat file Returns the split first line of the /proc/stat file
""" """
with open('/proc/stat', 'rt') as fp: with open('/proc/stat', 'rt') as fp:
return list(map(int,fp.readline().split()[1:])) return list(map(int,fp.readline().split()[1:]))
@ -84,15 +86,15 @@ class MemTemp(plugins.Plugin):
def cpu_temp(self): def cpu_temp(self):
if self.options['scale'] == "fahrenheit": if self.options['scale'] == "fahrenheit":
temp = (pwnagotchi.temperature() * 9 / 5) + 32 temp = (pwnagotchi.temperature(celsius=False))
symbol = "f" symbol = "F"
elif self.options['scale'] == "kelvin": elif self.options['scale'] == "kelvin":
temp = pwnagotchi.temperature() + 273.15 temp = pwnagotchi.temperature() + 273.15
symbol = "k" symbol = "K"
else: else:
# default to celsius # default to celsius
temp = pwnagotchi.temperature() temp = pwnagotchi.temperature()
symbol = "c" symbol = "C"
return f"{temp}{symbol}" return f"{temp}{symbol}"
def cpu_freq(self): def cpu_freq(self):

View File

@ -250,10 +250,10 @@ class PiSugar(plugins.Plugin):
if battery_plugged: if battery_plugged:
# If plugged in, display "CHG" # If plugged in, display "CHG"
ui._state._state['bat'].label = "CHG: " ui._state._state['bat'].label = "CHG"
else: else:
# Otherwise, keep it as "BAT" # Otherwise, keep it as "BAT"
ui._state._state['bat'].label = "BAT: " ui._state._state['bat'].label = "BAT"
# Handle rotation or default display logic # Handle rotation or default display logic
if self.rotation_enabled: if self.rotation_enabled:
@ -264,7 +264,7 @@ class PiSugar(plugins.Plugin):
if self.drot == 0: # show battery voltage if self.drot == 0: # show battery voltage
ui.set('bat', f"{voltage:.2f}V") ui.set('bat', f"{voltage:.2f}V")
elif self.drot == 1: # show battery capacity elif self.drot == 1: # show battery capacity
ui.set('bat', f"{capacity}%") ui.set('bat', f"{capacity:.0f}%")
else: # show battery temperature else: # show battery temperature
ui.set('bat', f"{temp}°C") ui.set('bat', f"{temp}°C")
else: else:
@ -272,7 +272,7 @@ class PiSugar(plugins.Plugin):
if self.default_display == 'voltage': if self.default_display == 'voltage':
ui.set('bat', f"{voltage:.2f}V") ui.set('bat', f"{voltage:.2f}V")
elif self.default_display in ['percentage', 'percent']: elif self.default_display in ['percentage', 'percent']:
ui.set('bat', f"{capacity}%") ui.set('bat', f"{capacity:.0f}%")
elif self.default_display == 'temp': elif self.default_display == 'temp':
ui.set('bat', f"{temp}°C") ui.set('bat', f"{temp}°C")
@ -283,4 +283,4 @@ class PiSugar(plugins.Plugin):
logging.info( logging.info(
f"[PiSugarX] Empty battery (<= {safe_shutdown_level}%): shutting down" f"[PiSugarX] Empty battery (<= {safe_shutdown_level}%): shutting down"
) )
ui.update(force=True, new_data={"status": "Battery exhausted, bye ..."}) ui.update(force=True, new_data={"status": "Battery exhausted, bye ..."})

View File

@ -86,10 +86,11 @@ def _send_to_wigle(lines, api_key, donate=True, timeout=30):
dummy.seek(0) dummy.seek(0)
headers = {'Authorization': f"Basic {api_key}", headers = {"Authorization": f"Basic {api_key}",
'Accept': 'application/json'} "Accept": "application/json",
data = {'donate': 'on' if donate else 'false'} "HTTP_USER_AGENT": "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:15.0) Gecko/20100101 Firefox/15.0.1"}
payload = {'file': (pwnagotchi.name() + ".csv", dummy, 'multipart/form-data', {'Expires': '0'})} data = {"donate": "on" if donate else "false"}
payload = {"file": (pwnagotchi.name() + ".csv", dummy, "multipart/form-data", {"Expires": "0"})}
try: try:
res = requests.post('https://api.wigle.net/api/v2/file/upload', res = requests.post('https://api.wigle.net/api/v2/file/upload',
data=data, data=data,

View File

@ -35,12 +35,15 @@ class WpaSec(plugins.Plugin):
Uploads the file to https://wpa-sec.stanev.org, or another endpoint. Uploads the file to https://wpa-sec.stanev.org, or another endpoint.
""" """
with open(path, 'rb') as file_to_upload: with open(path, 'rb') as file_to_upload:
cookie = {'key': self.options['api_key']} cookie = {"key": self.options['api_key']}
payload = {'file': file_to_upload} payload = {"file": file_to_upload,
"multipart/form-data": {"Expires": "0"}}
headers = {"HTTP_USER_AGENT": "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:15.0) Gecko/20100101 Firefox/15.0.1"}
try: try:
result = requests.post(self.options['api_url'], result = requests.post(self.options['api_url'],
cookies=cookie, cookies=cookie,
files=payload, files=payload,
headers=headers,
timeout=timeout) timeout=timeout)
if result.status_code == 200: if result.status_code == 200:
if ' already submitted' in result.text: if ' already submitted' in result.text:
@ -97,7 +100,7 @@ class WpaSec(plugins.Plugin):
def on_internet_available(self, agent): def on_internet_available(self, agent):
""" """
Called in manual mode when there's internet connectivity Called when there's internet connectivity
""" """
if not self.ready or self.lock.locked(): if not self.ready or self.lock.locked():
return return

View File

@ -32,8 +32,7 @@ OUTPUT=${OUTPUT:-${UNIT_HOSTNAME}-backup-$(date +%s).tgz}
# username to use for ssh # username to use for ssh
UNIT_USERNAME=${UNIT_USERNAME:-pi} UNIT_USERNAME=${UNIT_USERNAME:-pi}
# what to backup # what to backup
FILES_TO_BACKUP=" FILES_TO_BACKUP="/boot/firmware/cmdline.txt \
/boot/firmware/cmdline.txt \
/boot/firmware/config.txt \ /boot/firmware/config.txt \
/root/settings.yaml \ /root/settings.yaml \
/root/client_secrets.json \ /root/client_secrets.json \

View File

@ -2,7 +2,7 @@
set -e set -e
# name of the ethernet gadget interface on the host # name of the ethernet gadget interface on the host
USB_IFACE=${1:-enx002282ffff20} USB_IFACE=${1:-$(ifconfig | grep enx | awk -F\: '{print $1}')}
USB_IFACE_IP=10.0.0.1 USB_IFACE_IP=10.0.0.1
USB_IFACE_NET=10.0.0.0/24 USB_IFACE_NET=10.0.0.0/24
# host interface to use for upstream connection # host interface to use for upstream connection