mirror of
https://github.com/jayofelony/pwnagotchi.git
synced 2025-07-01 18:37:27 -04:00
Version 2.3.4
Signed-off-by: Jeroen Oudshoorn <oudshoorn.jeroen@gmail.com> Signed-off-by: Jeroen Oudshoorn <oudshoorn.jeroen@gmail.com>
This commit is contained in:
@ -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,6 +75,7 @@ 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
|
||||
@ -96,7 +97,6 @@ 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,6 +106,7 @@ 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:
|
||||
@ -129,6 +130,7 @@ 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()
|
||||
@ -148,11 +150,13 @@ 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):
|
||||
@ -232,14 +236,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'):
|
||||
@ -257,7 +261,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'):
|
||||
@ -281,13 +285,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:
|
||||
@ -441,6 +445,7 @@ def extract_from_pcap(path, fields):
|
||||
|
||||
return results
|
||||
|
||||
|
||||
class StatusFile(object):
|
||||
def __init__(self, path, data_format='raw'):
|
||||
self._path = path
|
||||
|
Reference in New Issue
Block a user