mirror of
https://github.com/jayofelony/pwnagotchi.git
synced 2025-07-01 18:37:27 -04:00
Compare commits
27 Commits
Author | SHA1 | Date | |
---|---|---|---|
b2175cbcc4 | |||
28c61ae02c | |||
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 |
5
.github/ISSUE_TEMPLATE.yml
vendored
5
.github/ISSUE_TEMPLATE.yml
vendored
@ -33,8 +33,9 @@ body:
|
||||
label: Version
|
||||
description: What version of our software are you running?
|
||||
options:
|
||||
- 2.9.2 (64bit)
|
||||
- 2.9.2 (32bit)
|
||||
- 2.9.3
|
||||
- 2.9.3-2
|
||||
- 2.9.4
|
||||
default: 0
|
||||
validations:
|
||||
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
|
||||
description: What version of our software are you running?
|
||||
options:
|
||||
- 2.9.2 (64bit)
|
||||
- 2.9.2 (32bit)
|
||||
- 2.9.3
|
||||
- 2.9.3-2
|
||||
- 2.9.4
|
||||
default: 0
|
||||
validations:
|
||||
required: true
|
||||
|
@ -1 +1 @@
|
||||
__version__ = '2.9.3-2'
|
||||
__version__ = '2.9.4-1'
|
||||
|
@ -215,20 +215,24 @@ def pwnagotchi_cli():
|
||||
"[Y/N] ")
|
||||
if pwn_bluetooth.lower() in ('y', 'yes'):
|
||||
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: ")
|
||||
if pwn_bluetooth_device.lower() == "android":
|
||||
f.write("main.plugins.bt-tether.devices.android-phone.enabled = true\n")
|
||||
if pwn_bluetooth_device != "":
|
||||
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"
|
||||
"MAC: ")
|
||||
if pwn_bluetooth_mac != "":
|
||||
f.write(f"main.plugins.bt-tether.devices.android-phone.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")
|
||||
f.write(f"main.plugins.bt-tether.mac = \"{pwn_bluetooth_mac}\"\n")
|
||||
# set up display settings
|
||||
pwn_display_enabled = input("Do you want to enable a display?\n\n"
|
||||
"[Y/N]: ")
|
||||
@ -250,7 +254,9 @@ def pwnagotchi_cli():
|
||||
if pwn_bluetooth.lower() in ('y', 'yes'):
|
||||
if pwn_bluetooth_device.lower == "android":
|
||||
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.")
|
||||
|
||||
elif pwn_bluetooth_device.lower == "ios":
|
||||
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.")
|
||||
|
@ -11,7 +11,8 @@ main.custom_plugin_repos = [
|
||||
"https://github.com/jayofelony/pwnagotchi-torch-plugins/archive/master.zip",
|
||||
"https://github.com/Sniffleupagus/pwnagotchi_plugins/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/"
|
||||
@ -23,6 +24,7 @@ main.plugins.auto-update.install = false
|
||||
main.plugins.auto-update.interval = 1
|
||||
|
||||
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.phone = "" # android or 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.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.ups_hat_c.enabled = false
|
||||
|
@ -13,7 +13,8 @@ def is_connected():
|
||||
try:
|
||||
# check DNS
|
||||
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'):
|
||||
return True
|
||||
except:
|
||||
|
@ -390,17 +390,6 @@ class auto_tune(plugins.Plugin):
|
||||
self._agent.run("wifi.recon 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
|
||||
def on_wifi_update(self, agent, access_points):
|
||||
# check aps and update active channels
|
||||
|
@ -7,7 +7,7 @@ from pwnagotchi.ui.view import BLACK
|
||||
|
||||
class BTTether(plugins.Plugin):
|
||||
__author__ = 'Jayofelony'
|
||||
__version__ = '1.0'
|
||||
__version__ = '1.2'
|
||||
__license__ = 'GPL3'
|
||||
__description__ = 'A new BT-Tether plugin'
|
||||
|
||||
@ -19,45 +19,37 @@ class BTTether(plugins.Plugin):
|
||||
def on_loaded(self):
|
||||
logging.info("[BT-Tether] plugin loaded.")
|
||||
|
||||
def on_ready(self, agent):
|
||||
def on_config_changed(self, config):
|
||||
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
|
||||
interface-name=bnep0
|
||||
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']
|
||||
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:
|
||||
logging.error(f"[BT-Tether] Failed to connect to device: {e}")
|
||||
except Exception as e:
|
||||
logging.error(f"[BT-Tether] Failed to save Bluetooth connection file: {e}")
|
||||
self.ready = True
|
||||
|
||||
def on_ready(self, agent):
|
||||
self.ready = True
|
||||
|
||||
def on_ui_setup(self, ui):
|
||||
@ -67,23 +59,26 @@ class BTTether(plugins.Plugin):
|
||||
label_font=fonts.Bold, text_font=fonts.Medium))
|
||||
|
||||
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:
|
||||
self.status = 'C'
|
||||
else:
|
||||
self.status = '-'
|
||||
try:
|
||||
mac = self.options['mac']
|
||||
subprocess.run(['nmcli', 'device', 'connect', f'{mac}'], check=True)
|
||||
subprocess.run(['nmcli', 'connection', 'up', f'{phone_name}'], check=True)
|
||||
except Exception as e:
|
||||
logging.error(f"[BT-Tether] Failed to connect to device: {e}")
|
||||
ui.set('bluetooth', self.status)
|
||||
|
||||
def on_unload(self, ui):
|
||||
phone_name = self.options['phone-name'] + ' Network'
|
||||
with ui._lock:
|
||||
ui.remove_element('bluetooth')
|
||||
try:
|
||||
mac = self.options['mac']
|
||||
subprocess.run(['nmcli', 'device', 'disconnect', f'{mac}'], check=True)
|
||||
logging.info(f"[BT-Tether] Disconnected from device with MAC: {mac}")
|
||||
if (subprocess.run(['bluetoothctl', 'info'], capture_output=True, text=True)).stdout.find('Connected: yes') != -1:
|
||||
subprocess.run(['nmcli', 'connection', 'down', f'{phone_name}'], check=True)
|
||||
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:
|
||||
logging.error(f"[BT-Tether] Failed to disconnect from device: {e}")
|
@ -49,6 +49,8 @@ class MemTemp(plugins.Plugin):
|
||||
LINE_SPACING = 10
|
||||
LABEL_SPACING = 0
|
||||
FIELD_WIDTH = 4
|
||||
def __init__(self):
|
||||
self.options = dict()
|
||||
|
||||
def on_loaded(self):
|
||||
self._last_cpu_load = self._cpu_stat()
|
||||
@ -62,7 +64,7 @@ class MemTemp(plugins.Plugin):
|
||||
|
||||
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:
|
||||
return list(map(int,fp.readline().split()[1:]))
|
||||
@ -84,15 +86,15 @@ class MemTemp(plugins.Plugin):
|
||||
|
||||
def cpu_temp(self):
|
||||
if self.options['scale'] == "fahrenheit":
|
||||
temp = (pwnagotchi.temperature() * 9 / 5) + 32
|
||||
symbol = "f"
|
||||
temp = (pwnagotchi.temperature(celsius=False))
|
||||
symbol = "F"
|
||||
elif self.options['scale'] == "kelvin":
|
||||
temp = pwnagotchi.temperature() + 273.15
|
||||
symbol = "k"
|
||||
symbol = "K"
|
||||
else:
|
||||
# default to celsius
|
||||
temp = pwnagotchi.temperature()
|
||||
symbol = "c"
|
||||
symbol = "C"
|
||||
return f"{temp}{symbol}"
|
||||
|
||||
def cpu_freq(self):
|
||||
|
@ -250,10 +250,10 @@ class PiSugar(plugins.Plugin):
|
||||
|
||||
if battery_plugged:
|
||||
# If plugged in, display "CHG"
|
||||
ui._state._state['bat'].label = "CHG: "
|
||||
ui._state._state['bat'].label = "CHG"
|
||||
else:
|
||||
# Otherwise, keep it as "BAT"
|
||||
ui._state._state['bat'].label = "BAT: "
|
||||
ui._state._state['bat'].label = "BAT"
|
||||
|
||||
# Handle rotation or default display logic
|
||||
if self.rotation_enabled:
|
||||
|
@ -86,10 +86,11 @@ def _send_to_wigle(lines, api_key, donate=True, timeout=30):
|
||||
|
||||
dummy.seek(0)
|
||||
|
||||
headers = {'Authorization': f"Basic {api_key}",
|
||||
'Accept': 'application/json'}
|
||||
data = {'donate': 'on' if donate else 'false'}
|
||||
payload = {'file': (pwnagotchi.name() + ".csv", dummy, 'multipart/form-data', {'Expires': '0'})}
|
||||
headers = {"Authorization": f"Basic {api_key}",
|
||||
"Accept": "application/json",
|
||||
"HTTP_USER_AGENT": "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:15.0) Gecko/20100101 Firefox/15.0.1"}
|
||||
data = {"donate": "on" if donate else "false"}
|
||||
payload = {"file": (pwnagotchi.name() + ".csv", dummy, "multipart/form-data", {"Expires": "0"})}
|
||||
try:
|
||||
res = requests.post('https://api.wigle.net/api/v2/file/upload',
|
||||
data=data,
|
||||
|
@ -35,12 +35,14 @@ class WpaSec(plugins.Plugin):
|
||||
Uploads the file to https://wpa-sec.stanev.org, or another endpoint.
|
||||
"""
|
||||
with open(path, 'rb') as file_to_upload:
|
||||
cookie = {'key': self.options['api_key']}
|
||||
payload = {'file': file_to_upload}
|
||||
cookie = {"key": self.options['api_key']}
|
||||
payload = {"file": file_to_upload}
|
||||
headers = {"HTTP_USER_AGENT": "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:15.0) Gecko/20100101 Firefox/15.0.1"}
|
||||
try:
|
||||
result = requests.post(self.options['api_url'],
|
||||
cookies=cookie,
|
||||
files=payload,
|
||||
headers=headers,
|
||||
timeout=timeout)
|
||||
if result.status_code == 200:
|
||||
if ' already submitted' in result.text:
|
||||
@ -97,7 +99,7 @@ class WpaSec(plugins.Plugin):
|
||||
|
||||
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():
|
||||
return
|
||||
|
@ -2,7 +2,7 @@
|
||||
set -e
|
||||
|
||||
# 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_NET=10.0.0.0/24
|
||||
# host interface to use for upstream connection
|
||||
|
Reference in New Issue
Block a user