mirror of
https://github.com/jayofelony/pwnagotchi.git
synced 2025-07-01 18:37:27 -04:00
Compare commits
34 Commits
Author | SHA1 | Date | |
---|---|---|---|
358d400d23 | |||
09aace1cf7 | |||
fc0c72f7df | |||
b13243466b | |||
bb34980179 | |||
ff0c1aa2f6 | |||
7f2b3c7106 | |||
3e5d802e8d | |||
3e5e2bfb30 | |||
aa4c352bbd | |||
578731e978 | |||
6d9131b4f6 | |||
4c826c90cb | |||
1b11383011 | |||
6e93616ed7 | |||
824cd7efef | |||
246e280201 | |||
4e6b513fc7 | |||
5dbdf1e8de | |||
b28a0eb606 | |||
97f7e71ad7 | |||
89b9eb0e46 | |||
d1f0b7bb08 | |||
7e26085016 | |||
772d844526 | |||
0377b396c9 | |||
3fc319b650 | |||
f34471e044 | |||
de7e9b1c6d | |||
868314e244 | |||
7a8cc36a38 | |||
a3dce7fcbd | |||
0472faa2bf | |||
ae2eb77c7b |
5
.github/ISSUE_TEMPLATE.yml
vendored
5
.github/ISSUE_TEMPLATE.yml
vendored
@ -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
|
||||||
|
5
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
5
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
@ -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
|
||||||
|
@ -1 +1 @@
|
|||||||
__version__ = '2.9.3'
|
__version__ = '2.9.4'
|
||||||
|
@ -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":
|
||||||
|
print("You have chosen an invalid device. Please start over.")
|
||||||
|
exit()
|
||||||
|
f.write(f"main.plugins.bt-tether.phone = \"{pwn_bluetooth_device.lower()}\"\n")
|
||||||
|
if pwn_bluetooth_device == "android":
|
||||||
|
f.write("main.plugins.bt-tether.ip = \"192.168.44.44\"\n")
|
||||||
|
elif pwn_bluetooth_device == "ios":
|
||||||
|
f.write("main.plugins.bt-tether.ip = \"172.20.10.6\"\n")
|
||||||
pwn_bluetooth_mac = input("What is the bluetooth MAC of your device?\n\n"
|
pwn_bluetooth_mac = input("What is the bluetooth MAC of your device?\n\n"
|
||||||
"MAC: ")
|
"MAC: ")
|
||||||
if pwn_bluetooth_mac != "":
|
if pwn_bluetooth_mac != "":
|
||||||
f.write(f"main.plugins.bt-tether.devices.android-phone.mac = \"{pwn_bluetooth_mac}\"\n")
|
f.write(f"main.plugins.bt-tether.mac = \"{pwn_bluetooth_mac}\"\n")
|
||||||
elif pwn_bluetooth_device.lower() == "ios":
|
|
||||||
f.write("main.plugins.bt-tether.devices.ios-phone.enabled = true\n")
|
|
||||||
pwn_bluetooth_mac = input("What is the bluetooth MAC of your device?\n\n"
|
|
||||||
"MAC: ")
|
|
||||||
if pwn_bluetooth_mac != "":
|
|
||||||
f.write(f"main.plugins.bt-tether.devices.ios-phone.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.")
|
||||||
|
@ -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
|
||||||
|
@ -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:
|
||||||
|
@ -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
|
||||||
|
@ -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
|
||||||
|
|
||||||
|
|
||||||
|
@ -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']
|
||||||
if self.options['phone'].lower() == 'android':
|
|
||||||
address = f'{ip}/24,192.168.44.1'
|
|
||||||
route = '192.168.44.0/24,192.168.44.1'
|
|
||||||
elif self.options['phone'].lower() == 'ios':
|
|
||||||
address = f'{ip}/24,172.20.10.1'
|
|
||||||
route = '172.20.10.0/24,172.20.10.1'
|
|
||||||
file = f'''
|
|
||||||
[connection]
|
|
||||||
id=bluetooth
|
|
||||||
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:
|
|
||||||
file = '\n'.join(line.strip() for line in file.strip().splitlines() if line.strip())
|
|
||||||
with open('/etc/NetworkManager/system-connections/bluetooth.nmconnection', 'w+') as bt_file:
|
|
||||||
bt_file.write(file)
|
|
||||||
subprocess.run(['chmod', '600', '/etc/NetworkManager/system-connections/bluetooth.nmconnection'], check=True)
|
|
||||||
try:
|
|
||||||
mac = self.options['mac']
|
mac = self.options['mac']
|
||||||
subprocess.run(['nmcli', 'device', 'connect', f'{mac}'], check=True)
|
phone_name = self.options['phone-name'] + ' Network'
|
||||||
|
if self.options['phone'].lower() == 'android':
|
||||||
|
address = f'{ip}'
|
||||||
|
gateway = '192.168.44.1'
|
||||||
|
elif self.options['phone'].lower() == 'ios':
|
||||||
|
address = f'{ip}'
|
||||||
|
gateway = '172.20.10.1'
|
||||||
|
else:
|
||||||
|
logging.error("[BT-Tether] Phone type not supported.")
|
||||||
|
return
|
||||||
|
try:
|
||||||
|
subprocess.run([
|
||||||
|
'nmcli', 'connection', 'modify', f'{phone_name}',
|
||||||
|
'connection.type', 'bluetooth',
|
||||||
|
'bluetooth.type', 'panu',
|
||||||
|
'bluetooth.bdaddr', f'{mac}',
|
||||||
|
'ipv4.method', 'manual',
|
||||||
|
'ipv4.addresses', f'{address}',
|
||||||
|
'ipv4.gateway', f'{gateway}',
|
||||||
|
'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 connect to device: {e}")
|
logging.error(f"[BT-Tether] Failed to connect to device: {e}")
|
||||||
except Exception as e:
|
self.ready = True
|
||||||
logging.error(f"[BT-Tether] Failed to save Bluetooth connection file: {e}")
|
|
||||||
|
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}")
|
@ -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):
|
||||||
|
@ -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")
|
||||||
|
|
||||||
|
@ -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,
|
||||||
|
@ -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
|
||||||
|
@ -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 \
|
||||||
|
@ -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
|
||||||
|
Reference in New Issue
Block a user