Compare commits

..

27 Commits

Author SHA1 Message Date
b2175cbcc4 Quick fix version
Signed-off-by: Jeroen Oudshoorn <oudshoorn.jeroen@gmail.com>
2025-01-02 18:34:34 +01:00
28c61ae02c Quick fix for wpa-sec
Signed-off-by: Jeroen Oudshoorn <oudshoorn.jeroen@gmail.com>
2025-01-02 18:34:13 +01:00
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
13 changed files with 87 additions and 87 deletions

View File

@ -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

View File

@ -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

View File

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

View File

@ -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")
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")
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.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.")

View File

@ -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

View File

@ -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:

View File

@ -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

View File

@ -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']
mac = self.options['mac']
phone_name = self.options['phone-name'] + ' Network'
if self.options['phone'].lower() == 'android':
address = f'{ip}/24,192.168.44.1'
route = '192.168.44.0/24,192.168.44.1'
address = f'{ip}'
gateway = '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]
'''
address = f'{ip}'
gateway = '172.20.10.1'
else:
logging.error("[BT-Tether] Phone type not supported.")
return
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)
except Exception as e:
logging.error(f"[BT-Tether] Failed to connect to device: {e}")
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 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
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}")

View File

@ -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):

View File

@ -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:

View File

@ -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,

View File

@ -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

View File

@ -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