diff --git a/pwnagotchi/bettercap.py b/pwnagotchi/bettercap.py
index f7aedd52..e2eef3dd 100644
--- a/pwnagotchi/bettercap.py
+++ b/pwnagotchi/bettercap.py
@@ -1,7 +1,7 @@
+import json
import logging
import requests
import websockets
-import backoff
from requests.auth import HTTPBasicAuth
import asyncio # Add asyncio for async functionality
@@ -39,7 +39,6 @@ class Client(object):
r = requests.get("%s/%s" % (self.url, sess), auth=self.auth)
return decode(r)
- @backoff.on_exception(backoff.expo, requests.exceptions.ConnectionError, max_tries=10)
async def start_websocket(self, consumer):
s = "%s/events" % self.websocket
while True:
@@ -60,7 +59,6 @@ class Client(object):
logging.exception("Other error while opening websocket (%s) with parameter %s", e, s)
await asyncio.sleep(1) # Sleep for x seconds before reconnecting
- @backoff.on_exception(backoff.expo, requests.exceptions.ConnectionError, max_tries=10)
def run(self, command, verbose_errors=True):
for _ in range(0, 2):
try:
diff --git a/pwnagotchi/mesh/peer.py b/pwnagotchi/mesh/peer.py
index 38f55641..6c1afee2 100644
--- a/pwnagotchi/mesh/peer.py
+++ b/pwnagotchi/mesh/peer.py
@@ -85,5 +85,8 @@ class Peer(object):
def epoch(self):
return self.adv.get('epoch', 0)
+ def full_name(self):
+ return '%s@%s' % (self.name(), self.identity())
+
def is_closer(self, other):
return self.rssi > other.rssi
diff --git a/pwnagotchi/mesh/utils.py b/pwnagotchi/mesh/utils.py
index e97fa969..c46bae5d 100644
--- a/pwnagotchi/mesh/utils.py
+++ b/pwnagotchi/mesh/utils.py
@@ -1,5 +1,4 @@
-# import _thread
-from concurrent.futures import ThreadPoolExecutor
+import _thread
import logging
import time
@@ -42,9 +41,7 @@ class AsyncAdvertiser(object):
def start_advertising(self):
if self._config['personality']['advertise']:
- # _thread.start_new_thread(self._adv_poller, ())
- with ThreadPoolExecutor(max_workers=4) as executor:
- executor.submit(self._adv_poller)
+ _thread.start_new_thread(self._adv_poller, ())
grid.set_advertisement_data(self._advertisement)
grid.advertise(True)
diff --git a/pwnagotchi/plugins/cmd.py b/pwnagotchi/plugins/cmd.py
index c371b030..cf76c0c7 100644
--- a/pwnagotchi/plugins/cmd.py
+++ b/pwnagotchi/plugins/cmd.py
@@ -100,7 +100,7 @@ def edit(args, config):
Edit the config of the plugin
"""
plugin = args.name
- editor = os.environ.get('EDITOR', 'vim') # because vim is the best
+ editor = os.environ.get('EDITOR', 'vim') # because vim is the best
if plugin not in config['main']['plugins']:
return 1
diff --git a/pwnagotchi/ui/web/templates/profile.html b/pwnagotchi/ui/web/templates/profile.html
index 60cfb7ad..b02eb33e 100644
--- a/pwnagotchi/ui/web/templates/profile.html
+++ b/pwnagotchi/ui/web/templates/profile.html
@@ -8,7 +8,7 @@ Profile
{% block script %}
$(function(){
$('#qrcode').qrcode({
- text: 'https://opwngrid.xyz/search/{{ fingerprint }}',
+ text: 'https://pwnagotchi.ai/pwnfile/#{{ fingerprint }}',
render: 'div',
mode: 0,
size: 400,
@@ -25,7 +25,7 @@ $(function(){
diff --git a/pwnagotchi/utils.py b/pwnagotchi/utils.py
index 19084572..d03e5796 100644
--- a/pwnagotchi/utils.py
+++ b/pwnagotchi/utils.py
@@ -60,7 +60,7 @@ class DottedTomlEncoder(TomlEncoder):
else:
retstr += (pre + qsection + " = " +
str(self.dump_value(value)) + '\n')
- return retstr, self._dict()
+ return (retstr, self._dict())
def parse_version(version):
@@ -75,7 +75,6 @@ def remove_whitelisted(list_of_handshakes, list_of_whitelisted_strings, valid_on
Removes a given list of whitelisted handshakes from a path list
"""
filtered = list()
-
def normalize(name):
"""
Only allow alpha/nums
@@ -97,6 +96,7 @@ def remove_whitelisted(list_of_handshakes, list_of_whitelisted_strings, valid_on
return filtered
+
def download_file(url, destination, chunk_size=128):
import requests
resp = requests.get(url)
@@ -106,7 +106,6 @@ def download_file(url, destination, chunk_size=128):
for chunk in resp.iter_content(chunk_size):
fd.write(chunk)
-
def unzip(file, destination, strip_dirs=0):
os.makedirs(destination, exist_ok=True)
with ZipFile(file, 'r') as zip:
@@ -130,7 +129,6 @@ def merge_config(user, default):
user[k] = merge_config(user[k], v)
return user
-
def keys_to_str(data):
if isinstance(data,list):
converted_list = list()
@@ -150,13 +148,11 @@ def keys_to_str(data):
return converted_dict
-
def save_config(config, target):
with open(target, 'wt') as fp:
fp.write(toml.dumps(config, encoder=DottedTomlEncoder()))
return True
-
def load_config(args):
default_config_path = os.path.dirname(args.config)
if not os.path.exists(default_config_path):
@@ -236,14 +232,14 @@ def load_config(args):
additional_config = toml.load(toml_file)
config = merge_config(additional_config, config)
- # the very first step is to normalize the display name, so we don't need dozens of if/elif around
+ # the very first step is to normalize the display name so we don't need dozens of if/elif around
if config['ui']['display']['type'] in ('inky', 'inkyphat'):
config['ui']['display']['type'] = 'inky'
elif config['ui']['display']['type'] in ('papirus', 'papi'):
config['ui']['display']['type'] = 'papirus'
- elif config['ui']['display']['type'] in 'oledhat':
+ elif config['ui']['display']['type'] in ('oledhat',):
config['ui']['display']['type'] = 'oledhat'
elif config['ui']['display']['type'] in ('ws_1', 'ws1', 'waveshare_1', 'waveshare1'):
@@ -261,7 +257,7 @@ def load_config(args):
elif config['ui']['display']['type'] in ('ws_29inch', 'ws29inch', 'waveshare_29inch', 'waveshare29inch'):
config['ui']['display']['type'] = 'waveshare29inch'
- elif config['ui']['display']['type'] in 'lcdhat':
+ elif config['ui']['display']['type'] in ('lcdhat',):
config['ui']['display']['type'] = 'lcdhat'
elif config['ui']['display']['type'] in ('dfrobot_1', 'df1'):
@@ -285,13 +281,13 @@ def load_config(args):
elif config['ui']['display']['type'] in ('ws_213bv4', 'ws213bv4', 'waveshare_213bv4', 'waveshare213inb_v4'):
config['ui']['display']['type'] = 'waveshare213inb_v4'
- elif config['ui']['display']['type'] in 'spotpear24inch':
+ elif config['ui']['display']['type'] in ('spotpear24inch'):
config['ui']['display']['type'] = 'spotpear24inch'
- elif config['ui']['display']['type'] in 'displayhatmini':
+ elif config['ui']['display']['type'] in ('displayhatmini'):
config['ui']['display']['type'] = 'displayhatmini'
- elif config['ui']['display']['type'] in 'waveshare35lcd':
+ elif config['ui']['display']['type'] in ('waveshare35lcd'):
config['ui']['display']['type'] = 'waveshare35lcd'
else:
@@ -445,7 +441,6 @@ def extract_from_pcap(path, fields):
return results
-
class StatusFile(object):
def __init__(self, path, data_format='raw'):
self._path = path
diff --git a/requirements.txt b/requirements.txt
index cce7d0ec..decdc195 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -22,4 +22,3 @@ torch
torchvision
stable_baselines3
RPi.GPIO
-backoff