Compare commits

...

50 Commits

Author SHA1 Message Date
111787544f Merge remote-tracking branch 'origin/master' 2024-03-05 16:31:06 +01:00
efa5d8b197 Update build
Signed-off-by: jayofelony <oudshoorn.jeroen@gmail.com>
2024-03-05 16:31:00 +01:00
9e5fb49d7c Merge pull request #78 from rai68/master
Update view.py - bug fix, my self left a broken debug line in
2024-03-05 06:14:15 +01:00
Rai
cbbd7d5a6d Merge branch 'jayofelony:master' into master 2024-03-05 14:36:29 +10:00
Rai
90c5818123 Update view.py
Signed-off-by: Rai <58925163+rai68@users.noreply.github.com>
2024-03-05 13:23:30 +10:00
eb76ef4c54 Update build
Signed-off-by: jayofelony <oudshoorn.jeroen@gmail.com>
2024-03-04 21:21:48 +01:00
59e42daeb5 Update bash
Signed-off-by: jayofelony <oudshoorn.jeroen@gmail.com>
2024-03-04 21:13:33 +01:00
5b7014c68e Change MOTD 2024-03-04 21:01:23 +01:00
42cc3136ee Update wizard script 2024-03-04 20:54:25 +01:00
2a243870f7 Update wizard script 2024-03-04 20:49:38 +01:00
8f043ff5ef Update wizard script 2024-03-04 20:47:52 +01:00
255bbdbc08 Update wizard script 2024-03-04 20:40:16 +01:00
6f57b66cf4 Add display invert to --install 2024-03-04 20:35:09 +01:00
a4c25e9996 Add display invert to --install 2024-03-04 20:28:31 +01:00
9495d55296 Add display invert to --install 2024-03-04 20:25:22 +01:00
69e7503d67 Add display invert to --install 2024-03-04 20:21:41 +01:00
25cb1f2175 Add display invert to --install 2024-03-04 20:11:20 +01:00
54b7ce5d0d Add display invert to --install 2024-03-04 20:08:45 +01:00
1f9afd541d Add display invert to --install 2024-03-04 19:59:48 +01:00
87eae76a58 Add display invert to --install 2024-03-04 16:07:17 +01:00
6691257036 change small font size 2024-03-04 16:00:31 +01:00
2149c5dbdf remove color = black 2024-03-04 15:55:50 +01:00
77af772b4b remove color = black 2024-03-04 15:53:18 +01:00
14e4fc6d47 Add a interactive configuration installer 2024-03-04 15:48:52 +01:00
5be8580a59 Add a interactive configuration installer 2024-03-04 15:46:23 +01:00
f7a599ab8f Add a interactive configuration installer 2024-03-04 15:42:36 +01:00
5f907b236a Add a interactive configuration installer 2024-03-04 15:39:24 +01:00
bc92613700 Add a interactive configuration installer 2024-03-04 15:36:17 +01:00
501ec9ca2b Add a interactive configuration installer 2024-03-04 15:34:39 +01:00
e5e0180f3c Add a interactive configuration installer 2024-03-04 15:32:08 +01:00
ea60808700 Add a interactive configuration installer 2024-03-04 15:26:48 +01:00
a34db250b5 Add a interactive configuration installer 2024-03-04 15:24:45 +01:00
d29aca15a9 Add ui.invert = false to defaults 2024-03-04 15:24:17 +01:00
8531b89771 Add ui.invert = false to defaults 2024-03-04 13:02:33 +01:00
59d510d0e1 Merge pull request #77
Adds invertable BLACK/WHITE to config
2024-03-04 12:56:52 +01:00
913b1a6e1d Update 2.7 inch display 2024-03-04 12:55:12 +01:00
Rai
de2cdaa3c9 Update view.py
Signed-off-by: Rai <58925163+rai68@users.noreply.github.com>
2024-03-04 20:41:19 +10:00
Rai
f2cf34a8b9 Update view.py
Signed-off-by: Rai <58925163+rai68@users.noreply.github.com>
2024-03-04 20:39:55 +10:00
Rai
bbb46128fe Update view.py
Signed-off-by: Rai <58925163+rai68@users.noreply.github.com>
2024-03-04 20:39:20 +10:00
46713b6e73 Update view.py 2024-03-04 19:59:34 +10:00
aa2b09fb21 Update build 2024-03-01 10:19:32 +01:00
9125e43b20 Add display type variants, no new displays 2024-03-01 10:08:03 +01:00
7e4d926b14 Fix setup.py 2024-03-01 10:07:33 +01:00
6417ef5a78 Upgrade pip, setuptools, wheel 2024-03-01 10:07:25 +01:00
46c03063fe Version 2.8.6 2024-02-29 23:05:30 +01:00
d5384d5a81 Moved all reset logging to debug, except for plugin loaded.
Removed the counter from display
2024-02-29 23:01:05 +01:00
e800c66e57 Let auto-update check for armhf/aarch64 (pwngrid/bettercap) 2024-02-29 22:49:21 +01:00
e3a404cb39 Fix waveshare1in54.py 2024-02-29 10:23:15 +01:00
6cb6aaeb81 Merge remote-tracking branch 'origin/master' 2024-02-29 10:22:52 +01:00
5761dac073 Fix pwnagotchi plugins list error if no update has been ran first 2024-02-29 10:22:41 +01:00
19 changed files with 386 additions and 411 deletions

View File

@ -7,6 +7,7 @@ import sys
import toml
import requests
import os
import re
import pwnagotchi
from pwnagotchi import utils
@ -133,6 +134,8 @@ if __name__ == '__main__':
help="Print the configuration.")
# Jayofelony added these
parser.add_argument('--wizard', dest="wizard", action="store_true", default=False,
help="Interactive installation of your personal configuration.")
parser.add_argument('--check-update', dest="check_update", action="store_true", default=False,
help="Check for updates on Pwnagotchi. And tells current version.")
parser.add_argument('--donate', dest="donate", action="store_true", default=False,
@ -157,6 +160,102 @@ if __name__ == '__main__':
print(pwnagotchi.__version__)
sys.exit(0)
if args.wizard:
def is_valid_hostname(hostname):
if len(hostname) > 255:
return False
if hostname[-1] == ".":
hostname = hostname[:-1] # strip exactly one dot from the right, if present
allowed = re.compile("(?!-)[A-Z\d-]{1,63}(?<!-)$", re.IGNORECASE)
return all(allowed.match(x) for x in hostname.split("."))
pwn_restore = input("Do you want to restore the previous configuration? [Y/N]\n")
if pwn_restore in ('y', 'yes'):
os.system("cp -f /etc/pwnagotchi/config.toml.bak /etc/pwnagotchi/config.toml")
print("Your previous configuration is restored, and I will restart in 5 seconds.")
time.sleep(5)
os.system("service pwnagotchi restart")
else:
pwn_check = input("This will create a new configuration file and overwrite your current backup, are you sure? [Y/N]\n")
if pwn_check.lower() in ('y', 'yes'):
os.system("mv -f /etc/pwnagotchi/config.toml /etc/pwnagotchi/config.toml.bak")
with open("/etc/pwnagotchi/config.toml", "a+") as f:
f.write("# Do not edit this file if you do not know what you are doing!!!\n\n")
# Set pwnagotchi name
print("Welcome to the interactive installation of your personal Pwnagotchi configuration!\n"
"My name is Jayofelony, how may I call you?\n")
pwn_name = input("Pwnagotchi name (no spaces): ")
if pwn_name == "":
pwn_name = "Pwnagotchi"
print("I shall go by Pwnagotchi from now on!")
pwn_name = f"main.name = \"{pwn_name}\"\n"
f.write(pwn_name)
else:
if is_valid_hostname(pwn_name):
print(f"I shall go by {pwn_name} from now on!")
pwn_name = f"main.name = \"{pwn_name}\"\n"
f.write(pwn_name)
else:
print("You have chosen an invalid name. Please start over.")
exit()
pwn_whitelist = input("How many networks do you want to whitelist? "
"We will also ask a MAC for each network?\n"
"Each SSID and BSSID count as 1 network. \n\n"
"Be sure to use digits as your answer.\n\n"
"Amount of networks: ")
if int(pwn_whitelist) > 0:
f.write("main.whitelist = [\n")
for x in range(int(pwn_whitelist)):
ssid = input("SSID (Name): ")
bssid = input("BSSID (MAC): ")
f.write(f"\t\"{ssid}\",\n")
f.write(f"\t\"{bssid}\",\n")
f.write("]\n")
# set bluetooth tether
pwn_bluetooth = input("Do you want to enable BT-Tether? [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? ")
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? ")
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? ")
if pwn_bluetooth_mac != "":
f.write(f"main.plugins.bt-tether.devices.ios-phone.mac = \"{pwn_bluetooth_mac}\"\n")
# set up display settings
pwn_display_enabled = input("Do you use a display? [Y/N] ")
if pwn_display_enabled.lower() in ('y', 'yes'):
f.write("ui.display.enabled = true\n")
pwn_display_type = input("What display do you use?\n\n"
"Be sure to check for the correct display type @ \n"
"https://github.com/jayofelony/pwnagotchi/blob/master/pwnagotchi/utils.py#L240-L431\n")
if pwn_display_type != "":
f.write(f"ui.display.type = \"{pwn_display_type}\"\n")
pwn_display_invert = input("Do you want to invert the display colors? [Y/N]\n\n"
"N = Black background\n"
"Y = White background\n")
if pwn_display_invert.lower() in ('y', 'yes'):
f.write("ui.invert = true\n")
f.close()
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"
"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.")
else:
print("Your configuration is done, and I will restart in 5 seconds.")
time.sleep(5)
os.system("service pwnagotchi restart")
else:
print("Ok, doing nothing.")
sys.exit(0)
if args.donate:
print("Donations can made @ \n "
"https://www.patreon.com/pwnagotchi_torch \n "
@ -172,7 +271,7 @@ if __name__ == '__main__':
local = version_to_tuple(pwnagotchi.__version__)
remote = version_to_tuple(latest_ver)
if remote > local:
user_input = input("There is a new version available! Update from v%s to v%s?\n[y(es)/n(o)]"
user_input = input("There is a new version available! Update from v%s to v%s?\n[Y/N] "
% (pwnagotchi.__version__, latest_ver))
# input validation
if user_input.lower() in ('y', 'yes'):

View File

@ -383,6 +383,11 @@
block: |
export GOPATH=$HOME/go
export PATH=/usr/local/go/bin:$PATH:$GOPATH/bin
alias custom='cd /usr/local/share/pwnagotchi/custom-plugins/'
alias config='sudo nano /etc/pwnagotchi/config.toml'
alias pwnlog='tail -f -n300 /etc/pwnagotchi/log/pwn*.log | sed --unbuffered "s/,[[:digit:]]\\{3\\}\\]//g" | cut -d " " -f 2-'
alias pwnver='python3 -c "import pwnagotchi as p; print(p.__version__)"'
alias pwnkill='sudo killall -USR1 pwnagotchi'
when: golang.changed
- name: download pwngrid
@ -451,7 +456,7 @@
# Add your configuration overrides on this file any configuration changes done to default.toml will be lost!
# Example:
# ui.display.enabled = true
# ui.display.type = "waveshare_2"
# ui.display.type = "waveshare_4"
when: not user_config.stat.exists
- name: Delete motd 10-uname
@ -494,24 +499,6 @@
regexp: '(.*)$'
line: '\1 modules-load=dwc2,g_ether'
- name: Add pwnlog alias
lineinfile:
dest: /home/pi/.bashrc
line: "\nalias pwnlog='tail -f -n300 /etc/pwnagotchi/log/pwn*.log | sed --unbuffered \"s/,[[:digit:]]\\{3\\}\\]//g\" | cut -d \" \" -f 2-'"
insertafter: EOF
- name: Add pwnver alias
lineinfile:
dest: /home/pi/.bashrc
line: "\nalias pwnver='python3 -c \"import pwnagotchi as p; print(p.__version__)\"'"
insertafter: EOF
- name: Add pwnkill alias to restart pwnagotchi with a signal
lineinfile:
dest: /home/pi/.bashrc
line: "\nalias pwnkill='sudo killall -USR1 pwnagotchi'"
insertafter: EOF
- name: add firmware packages to hold
dpkg_selections:
name: "{{ item }}"

View File

@ -2,7 +2,7 @@ _show_complete()
{
local cur opts node_names all_options opt_line
all_options="
pwnagotchi -h --help -C --config -U --user-config --manual --skip-session --clear --debug --version --print-config --check-update --donate {plugins,google}
pwnagotchi -h --help -C --config -U --user-config --manual --skip-session --clear --debug --version --print-config --wizard --check-update --donate {plugins,google}
pwnagotchi plugins -h --help {list,install,enable,disable,uninstall,update,upgrade}
pwnagotchi plugins list -i --installed -h --help
pwnagotchi plugins install -h --help

View File

@ -20,6 +20,7 @@ echo " I'm managed by systemd. Here are some basic commands."
echo
echo " If you want to know what I'm doing, you can check my logs with the command"
echo " - pwnlog"
echo " - sudo pwnagotchi --wizard, to help set up a config.toml"
echo " - sudo pwnagotchi --version, to check the current version"
echo " - sudo pwnagotchi --donate, to see how you can donate to this project"
echo " - sudo pwnagotchi --check-update, to see if there is a new version available"

View File

@ -180,6 +180,12 @@
update_cache: yes
install_recommends: false
- name: update pip3, setuptools, wheel
shell: "python3 -m pip install --upgrade pip setuptools wheel --break-system-packages"
args:
executable: /bin/bash
chdir: /usr/local/src
# Now we set up /boot/firmware
- name: Create pi user
copy:
@ -491,6 +497,11 @@
block: |
export GOPATH=$HOME/go
export PATH=/usr/local/go/bin:$PATH:$GOPATH/bin
alias custom='cd /usr/local/share/pwnagotchi/custom-plugins/'
alias config='sudo nano /etc/pwnagotchi/config.toml'
alias pwnlog='tail -f -n300 /etc/pwnagotchi/log/pwn*.log | sed --unbuffered "s/,[[:digit:]]\\{3\\}\\]//g" | cut -d " " -f 2-'
alias pwnver='python3 -c "import pwnagotchi as p; print(p.__version__)"'
alias pwnkill='sudo killall -USR1 pwnagotchi'
when: golang.changed
- name: download pwngrid
@ -579,7 +590,7 @@
# Add your configuration overrides on this file any configuration changes done to default.toml will be lost!
# Example:
# ui.display.enabled = true
# ui.display.type = "waveshare_2"
# ui.display.type = "waveshare_4"
when: not user_config.stat.exists
- name: Delete motd
@ -592,24 +603,6 @@
state: absent
path: /etc/update-motd.d/10-uname
- name: Add pwnlog alias
lineinfile:
dest: /home/pi/.bashrc
line: "\nalias pwnlog='tail -f -n300 /etc/pwnagotchi/log/pwn*.log | sed --unbuffered \"s/,[[:digit:]]\\{3\\}\\]//g\" | cut -d \" \" -f 2-'"
insertafter: EOF
- name: Add pwnver alias
lineinfile:
dest: /home/pi/.bashrc
line: "\nalias pwnver='python3 -c \"import pwnagotchi as p; print(p.__version__)\"'"
insertafter: EOF
- name: Add pwnkill alias to restart pwnagotchi with a signal
lineinfile:
dest: /home/pi/.bashrc
line: "\nalias pwnkill='sudo killall -USR1 pwnagotchi'"
insertafter: EOF
- name: add firmware packages to hold
dpkg_selections:
name: "{{ item }}"

View File

@ -1 +1 @@
__version__ = '2.8.5'
__version__ = '2.8.6'

View File

@ -32,7 +32,7 @@ main.plugins.bt-tether.devices.android-phone.netmask = 24
main.plugins.bt-tether.devices.android-phone.interval = 1
main.plugins.bt-tether.devices.android-phone.scantime = 10
main.plugins.bt-tether.devices.android-phone.max_tries = 10
main.plugins.bt-tether.devices.android-phone.share_internet = false
main.plugins.bt-tether.devices.android-phone.share_internet = true
main.plugins.bt-tether.devices.android-phone.priority = 1
main.plugins.bt-tether.devices.ios-phone.enabled = false
@ -43,7 +43,7 @@ main.plugins.bt-tether.devices.ios-phone.netmask = 24
main.plugins.bt-tether.devices.ios-phone.interval = 5
main.plugins.bt-tether.devices.ios-phone.scantime = 20
main.plugins.bt-tether.devices.ios-phone.max_tries = 0
main.plugins.bt-tether.devices.ios-phone.share_internet = false
main.plugins.bt-tether.devices.ios-phone.share_internet = true
main.plugins.bt-tether.devices.ios-phone.priority = 999
main.plugins.fix_services.enabled = true
@ -154,6 +154,8 @@ personality.throttle_d = 0.9
personality.clear_on_exit = true # clear display when shutting down cleanly
ui.invert = false # false = black background, true = white background
ui.fps = 0.0
ui.font.name = "DejaVuSansMono" # for japanese: fonts-japanese-gothic
ui.font.size_offset = 0 # will be added to the font size

View File

@ -199,6 +199,9 @@ def list_plugins(args, config, pattern='*'):
available_not_installed = set(available.keys()) - set(installed.keys())
max_len_list = available_and_installed if args.installed else available_not_installed
if not max_len_list:
print('Maybe try: sudo pwnagotchi plugins update')
return 1
max_len = max(map(len, max_len_list))
header = line.format(name='Plugin', width=max_len, version='Version', enabled='Active', status='Status')
line_length = max(max_len, len('Plugin')) + len(header) - len('Plugin') - 12 # lol
@ -239,7 +242,7 @@ def list_plugins(args, config, pattern='*'):
print('-' * line_length)
if not found:
logging.info('Maybe try: pwnagotchi plugins update')
print('Maybe try: sudo pwnagotchi plugins update')
return 1
return 0

View File

@ -29,6 +29,7 @@ def check(version, repo, native=True):
latest = resp.json()
info['available'] = latest_ver = latest['tag_name'].replace('v', '')
is_armhf = info['arch'].startswith('arm')
is_aarch = info['arch'].startswith('aarch')
local = version_to_tuple(info['current'])
remote = version_to_tuple(latest_ver)
@ -44,6 +45,14 @@ def check(version, repo, native=True):
(info['arch'] in download_url or (is_armhf and 'armhf' in download_url))):
info['url'] = download_url
break
elif is_aarch:
# check if this release is compatible with arm64/aarch64
for asset in latest['assets']:
download_url = asset['browser_download_url']
if (download_url.endswith('.zip') and
(info['arch'] in download_url or (is_aarch and 'aarch' in download_url))):
info['url'] = download_url
break
return info

View File

@ -35,14 +35,11 @@ class FixServices(plugins.Plugin):
self.isReloadingMon = False
self.connection = None
self.LASTTRY = 0
self._status = "--"
self._count = 0
def on_loaded(self):
"""
Gets called when the plugin gets loaded
"""
self._status = "ld"
logging.info("[Fix_Services] plugin loaded.")
def on_ready(self, agent):
@ -50,31 +47,27 @@ class FixServices(plugins.Plugin):
stdout=subprocess.PIPE).stdout))[-10:])
try:
cmd_output = subprocess.check_output("ip link show wlan0mon", shell=True)
logging.info("[Fix_Services ip link show wlan0mon]: %s" % repr(cmd_output))
logging.debug("[Fix_Services ip link show wlan0mon]: %s" % repr(cmd_output))
if ",UP," in str(cmd_output):
logging.info("wlan0mon is up.")
self._status = "up"
logging.debug("wlan0mon is up.")
if len(self.pattern.findall(last_lines)) >= 3:
self._status = "XX"
if hasattr(agent, 'view'):
display = agent.view()
display.set('status', 'Blind-Bug detected. Restarting.')
display.update(force=True)
logging.info('[Fix_Services] Blind-Bug detected. Restarting.')
logging.debug('[Fix_Services] Blind-Bug detected. Restarting.')
try:
self._tryTurningItOffAndOnAgain(agent)
except Exception as err:
logging.warning("[Fix_Services turnOffAndOn] %s" % repr(err))
else:
logging.info("[Fix_Services] Logs look good!")
self._status = ""
logging.debug("[Fix_Services] Logs look good!")
except Exception as err:
logging.error("[Fix_Services ip link show wlan0mon]: %s" % repr(err))
try:
self._status = "xx"
self._tryTurningItOffAndOnAgain(agent)
except Exception as err:
logging.error("[Fix_Services OffNOn]: %s" % repr(err))
@ -84,12 +77,12 @@ class FixServices(plugins.Plugin):
# apparently this only gets messages from bettercap going to syslog, not from syslog
def on_bcap_sys_log(self, agent, event):
if re.search('wifi error while hopping to channel', event['data']['Message']):
logging.info("[Fix_Services]SYSLOG MATCH: %s" % event['data']['Message'])
logging.info("[Fix_Services]**** restarting wifi.recon")
logging.debug("[Fix_Services]SYSLOG MATCH: %s" % event['data']['Message'])
logging.debug("[Fix_Services]**** restarting wifi.recon")
try:
result = agent.run("wifi.recon off; wifi.recon on")
if result["success"]:
logging.info("[Fix_Services] wifi.recon flip: success!")
logging.debug("[Fix_Services] wifi.recon flip: success!")
if hasattr(agent, 'view'):
display = agent.view()
if display:
@ -121,12 +114,12 @@ class FixServices(plugins.Plugin):
# Look for pattern 1
if len(self.pattern.findall(last_lines)) >= 3:
logging.info("[Fix_Services]**** Should trigger a reload of the wlan0mon device:\n%s" % last_lines)
logging.debug("[Fix_Services]**** Should trigger a reload of the wlan0mon device:\n%s" % last_lines)
if hasattr(agent, 'view'):
display = agent.view()
display.set('status', 'Blind-Bug detected. Restarting.')
display.update(force=True)
logging.info('[Fix_Services] Blind-Bug detected. Restarting.')
logging.debug('[Fix_Services] Blind-Bug detected. Restarting.')
try:
self._tryTurningItOffAndOnAgain(agent)
except Exception as err:
@ -134,20 +127,19 @@ class FixServices(plugins.Plugin):
# Look for pattern 2
elif len(self.pattern2.findall(other_last_lines)) >= 5:
logging.info("[Fix_Services]**** Should trigger a reload of the wlan0mon device:\n%s" % last_lines)
logging.debug("[Fix_Services]**** Should trigger a reload of the wlan0mon device:\n%s" % last_lines)
if hasattr(agent, 'view'):
display = agent.view()
display.set('status', 'Wifi channel stuck. Restarting recon.')
display.update(force=True)
logging.info('[Fix_Services] Wifi channel stuck. Restarting recon.')
logging.debug('[Fix_Services] Wifi channel stuck. Restarting recon.')
try:
result = agent.run("wifi.recon off; wifi.recon on")
if result["success"]:
logging.info("[Fix_Services] wifi.recon flip: success!")
logging.debug("[Fix_Services] wifi.recon flip: success!")
if display:
display.update(force=True, new_data={"status": "Wifi recon flipped!",
"brcmfmac_status": self._status,
"face": faces.COOL})
else:
print("Wifi recon flipped\nthat was easy!")
@ -159,7 +151,7 @@ class FixServices(plugins.Plugin):
# Look for pattern 3
elif len(self.pattern3.findall(other_last_lines)) >= 1:
logging.info("[Fix_Services] Firmware has halted or crashed. Restarting wlan0mon.")
logging.debug("[Fix_Services] Firmware has halted or crashed. Restarting wlan0mon.")
if hasattr(agent, 'view'):
display = agent.view()
display.set('status', 'Firmware has halted or crashed. Restarting wlan0mon.')
@ -167,13 +159,13 @@ class FixServices(plugins.Plugin):
try:
# Run the monstart command to restart wlan0mon
cmd_output = subprocess.check_output("monstart", shell=True)
logging.info("[Fix_Services monstart]: %s" % repr(cmd_output))
logging.debug("[Fix_Services monstart]: %s" % repr(cmd_output))
except Exception as err:
logging.error("[Fix_Services monstart]: %s" % repr(err))
# Look for pattern 4
elif len(self.pattern4.findall(other_other_last_lines)) >= 3:
logging.info("[Fix_Services] wlan0 is down!")
logging.debug("[Fix_Services] wlan0 is down!")
if hasattr(agent, 'view'):
display = agent.view()
display.set('status', 'Restarting wlan0 now!')
@ -181,7 +173,7 @@ class FixServices(plugins.Plugin):
try:
# Run the monstart command to restart wlan0mon
cmd_output = subprocess.check_output("monstart", shell=True)
logging.info("[Fix_Services monstart]: %s" % repr(cmd_output))
logging.debug("[Fix_Services monstart]: %s" % repr(cmd_output))
except Exception as err:
logging.error("[Fix_Services monstart]: %s" % repr(err))
@ -197,7 +189,7 @@ class FixServices(plugins.Plugin):
elif level == "debug":
logging.debug(message)
else:
logging.info(message)
logging.debug(message)
if ui:
ui.update(force=force, new_data=displayData)
@ -212,17 +204,16 @@ class FixServices(plugins.Plugin):
# avoid overlapping restarts, but allow it if it's been a while
# (in case the last attempt failed before resetting "isReloadingMon")
if self.isReloadingMon and (time.time() - self.LASTTRY) < 180:
logging.info("[Fix_Services] Duplicate attempt ignored")
logging.debug("[Fix_Services] Duplicate attempt ignored")
else:
self.isReloadingMon = True
self.LASTTRY = time.time()
self._status = "BL"
if hasattr(connection, 'view'):
display = connection.view()
if display:
display.update(force=True, new_data={"status": "I'm blind! Try turning it off and on again",
"brcmfmac_status": self._status, "face": faces.BORED})
"face": faces.BORED})
else:
display = None
@ -238,9 +229,9 @@ class FixServices(plugins.Plugin):
# is it up?
try:
cmd_output = subprocess.check_output("ip link show wlan0mon", shell=True)
logging.info("[Fix_Services ip link show wlan0mon]: %s" % repr(cmd_output))
logging.debug("[Fix_Services ip link show wlan0mon]: %s" % repr(cmd_output))
if ",UP," in str(cmd_output):
logging.info("wlan0mon is up. Skip reset?")
logging.debug("wlan0mon is up. Skip reset?")
# not reliable, so don't skip just yet
# print("wlan0mon is up. Skipping reset.")
# self.isReloadingMon = False
@ -261,11 +252,10 @@ class FixServices(plugins.Plugin):
except Exception as err:
logging.error("[Fix_Services wifi.recon off] error %s" % (repr(err)))
logging.info("[Fix_Services] recon paused. Now trying wlan0mon reload")
logging.debug("[Fix_Services] recon paused. Now trying wlan0mon reload")
try:
cmd_output = subprocess.check_output("monstop", shell=True)
self._status = "dn"
self.logPrintView("info", "[Fix_Services] wlan0mon down and deleted: %s" % cmd_output,
display, {"status": "wlan0mon d-d-d-down!", "face": faces.BORED})
except Exception as nope:
@ -285,7 +275,6 @@ class FixServices(plugins.Plugin):
cmd_output = subprocess.check_output("sudo modprobe -r brcmfmac", shell=True)
self.logPrintView("info", "[Fix_Services] unloaded brcmfmac", display,
{"status": "Turning it off #%s" % tries, "face": faces.SMART})
self._status = "ul"
# reload the module
try:
@ -293,28 +282,24 @@ class FixServices(plugins.Plugin):
cmd_output = subprocess.check_output("sudo modprobe brcmfmac", shell=True)
self.logPrintView("info", "[Fix_Services] reloaded brcmfmac")
self._status = "rl"
# success! now make the mon0
try:
cmd_output = subprocess.check_output("monstart", shell=True)
self.logPrintView("info", "[Fix_Services interface add wlan0mon worked #%s: %s"
% (tries, cmd_output))
self._status = "up"
try:
# try accessing mon0 in bettercap
result = connection.run("set wifi.interface wlan0mon")
if "success" in result:
logging.info("[Fix_Services set wifi.interface wlan0mon worked!")
self._status = ""
self._count = self._count + 1
logging.debug("[Fix_Services set wifi.interface wlan0mon worked!")
# stop looping and get back to recon
break
else:
logging.info(
logging.debug(
"[Fix_Services set wifi.interfaceface wlan0mon] failed? %s" % repr(result))
except Exception as err:
logging.info(
logging.debug(
"[Fix_Services set wifi.interface wlan0mon] except: %s" % repr(err))
except Exception as cerr: #
if not display:
@ -333,41 +318,38 @@ class FixServices(plugins.Plugin):
tries = tries + 1
if tries < 3:
logging.info("[Fix_Services] wlan0mon didn't make it. trying again")
logging.debug("[Fix_Services] wlan0mon didn't make it. trying again")
if not display:
print(" wlan0mon didn't make it. trying again")
else:
logging.info("[Fix_Services] wlan0mon loading failed, no choice but to reboot ..")
logging.debug("[Fix_Services] wlan0mon loading failed, no choice but to reboot ..")
pwnagotchi.reboot()
# exited the loop, so hopefully it loaded
if tries < 3:
if display:
display.update(force=True, new_data={"status": "And back on again...",
"brcmfmac_status": self._status,
"face": faces.INTENSE})
else:
print("And back on again...")
logging.info("[Fix_Services] wlan0mon back up")
logging.debug("[Fix_Services] wlan0mon back up")
else:
self.LASTTRY = time.time()
time.sleep(8 + tries * 2) # give it a bit before restarting recon in bettercap
self.isReloadingMon = False
logging.info("[Fix_Services] re-enable recon")
logging.debug("[Fix_Services] re-enable recon")
try:
result = connection.run("wifi.clear; wifi.recon on")
if "success" in result: # and result["success"] is True:
self._status = ""
if display:
display.update(force=True, new_data={"status": "I can see again! (probably)",
"brcmfmac_status": self._status,
"face": faces.HAPPY})
else:
print("I can see again")
logging.info("[Fix_Services] wifi.recon on")
logging.debug("[Fix_Services] wifi.recon on")
self.LASTTRY = time.time() + 120 # 2-minute pause until next time.
else:
logging.error("[Fix_Services] wifi.recon did not start up")
@ -388,25 +370,14 @@ class FixServices(plugins.Plugin):
else:
pos = (ui.width() / 2 + 35, ui.height() - 11)
logging.info("Got here")
ui.add_element('brcmfmac_status', Text(color=BLACK, value='--', position=pos, font=fonts.Small))
logging.debug("Got here")
# called when the ui is updated
def on_ui_update(self, ui):
# update those elements
if self._status:
ui.set('brcmfmac_status', "wlan0mon %s" % self._status)
else:
ui.set('brcmfmac_status', "rst#%s" % self._count)
return
def on_unload(self, ui):
with ui._lock:
try:
ui.remove_element('brcmfmac_status')
logging.info("[Fix_Services] unloaded")
except Exception as err:
logging.info("[Fix_Services] unload err %s " % repr(err))
pass
return
# run from command line to brute force a reload

View File

@ -34,9 +34,7 @@ class Waveshare154(DisplayImpl):
logging.info("initializing waveshare v1in54 display")
from pwnagotchi.ui.hw.libs.waveshare.v1in54.epd1in54 import EPD
self._display = EPD()
self._display.init(0)
self._display.Clear()
self._display.init(1)
self._display.init(self._display.lut_partial_update)
self._display.Clear()
def render(self, canvas):

View File

@ -9,8 +9,7 @@ class WaveshareV1(DisplayImpl):
super(WaveshareV1, self).__init__(config, 'waveshare_1')
def layout(self):
if self.config['color'] == 'black':
fonts.setup(10, 9, 10, 35, 25, 9)
fonts.setup(10, 8, 10, 35, 25, 9)
self._layout['width'] = 250
self._layout['height'] = 122
self._layout['face'] = (0, 40)
@ -29,61 +28,19 @@ class WaveshareV1(DisplayImpl):
'font': fonts.status_font(fonts.Medium),
'max': 20
}
else:
fonts.setup(10, 8, 10, 25, 25, 9)
self._layout['width'] = 212
self._layout['height'] = 104
self._layout['face'] = (0, 26)
self._layout['name'] = (5, 15)
self._layout['channel'] = (0, 0)
self._layout['aps'] = (28, 0)
self._layout['uptime'] = (147, 0)
self._layout['line1'] = [0, 12, 212, 12]
self._layout['line2'] = [0, 92, 212, 92]
self._layout['friend_face'] = (0, 76)
self._layout['friend_name'] = (40, 78)
self._layout['shakes'] = (0, 93)
self._layout['mode'] = (187, 93)
self._layout['status'] = {
'pos': (91, 15),
'font': fonts.status_font(fonts.Medium),
'max': 20
}
return self._layout
def initialize(self):
if self.config['color'] == 'black':
logging.info("initializing waveshare v2in13_V1 display in monochromatic mode")
from pwnagotchi.ui.hw.libs.waveshare.v2in13_V1.epd2in13 import EPD
self._display = EPD()
self._display.init(self._display.lut_full_update)
self._display.Clear(0xFF)
self._display.init(self._display.lut_partial_update)
elif self.config['color'] == 'fastAndFurious':
logging.info("initializing waveshare v2in13_V1 3-color display in FAST MODE")
logging.info("THIS MAY BE POTENTIALLY DANGEROUS. NO WARRANTY IS PROVIDED")
logging.info("USE THIS DISPLAY IN THIS MODE AT YOUR OWN RISK")
from pwnagotchi.ui.hw.libs.waveshare.v2in13_V1.epd2in13bcFAST import EPD
self._display = EPD()
self._display.init()
self._display.Clear()
else:
logging.info("initializing waveshare v2in13_V1 display 3-color mode")
from pwnagotchi.ui.hw.libs.waveshare.v2in13_V1.epd2in13bc import EPD
self._display = EPD()
self._display.init()
self._display.Clear()
def render(self, canvas):
if self.config['color'] == 'black':
buf = self._display.getbuffer(canvas)
self._display.display(buf)
elif self.config['color'] == 'fastAndFurious':
buf_black = self._display.getbuffer(canvas)
self._display.DisplayPartial(buf_black)
else:
buf_black = self._display.getbuffer(canvas)
self._display.displayBlack(buf_black)
def clear(self):
self._display.Clear(0xff)

View File

@ -9,8 +9,7 @@ class WaveshareV2(DisplayImpl):
super(WaveshareV2, self).__init__(config, 'waveshare_2')
def layout(self):
if self.config['color'] == 'black':
fonts.setup(10, 9, 10, 35, 25, 9)
fonts.setup(10, 8, 10, 35, 25, 9)
self._layout['width'] = 250
self._layout['height'] = 122
self._layout['face'] = (0, 40)
@ -29,27 +28,6 @@ class WaveshareV2(DisplayImpl):
'font': fonts.status_font(fonts.Medium),
'max': 20
}
else:
fonts.setup(10, 8, 10, 25, 25, 9)
self._layout['width'] = 212
self._layout['height'] = 104
self._layout['face'] = (0, 26)
self._layout['name'] = (5, 15)
self._layout['channel'] = (0, 0)
self._layout['aps'] = (28, 0)
self._layout['status'] = (91, 15)
self._layout['uptime'] = (147, 0)
self._layout['line1'] = [0, 12, 212, 12]
self._layout['line2'] = [0, 92, 212, 92]
self._layout['friend_face'] = (0, 76)
self._layout['friend_name'] = (40, 78)
self._layout['shakes'] = (0, 93)
self._layout['mode'] = (187, 93)
self._layout['status'] = {
'pos': (125, 20),
'font': fonts.status_font(fonts.Medium),
'max': 14
}
return self._layout
def initialize(self):

View File

@ -10,7 +10,6 @@ class Waveshare2in13bV3(DisplayImpl):
super(Waveshare2in13bV3, self).__init__(config, 'waveshare2in13b_v3')
def layout(self):
if self.config['color'] == 'black':
fonts.setup(10, 9, 10, 35, 25, 9)
self._layout['width'] = 250
self._layout['height'] = 122
@ -30,27 +29,6 @@ class Waveshare2in13bV3(DisplayImpl):
'font': fonts.status_font(fonts.Medium),
'max': 20
}
else:
fonts.setup(10, 8, 10, 25, 25, 9)
self._layout['width'] = 212
self._layout['height'] = 104
self._layout['face'] = (0, 26)
self._layout['name'] = (5, 15)
self._layout['channel'] = (0, 0)
self._layout['aps'] = (28, 0)
self._layout['status'] = (91, 15)
self._layout['uptime'] = (147, 0)
self._layout['line1'] = [0, 12, 212, 12]
self._layout['line2'] = [0, 92, 212, 92]
self._layout['friend_face'] = (0, 76)
self._layout['friend_name'] = (40, 78)
self._layout['shakes'] = (0, 93)
self._layout['mode'] = (187, 93)
self._layout['status'] = {
'pos': (125, 20),
'font': fonts.status_font(fonts.Medium),
'max': 14
}
return self._layout
def initialize(self):

View File

@ -10,7 +10,6 @@ class Waveshare213bV4(DisplayImpl):
super(Waveshare213bV4, self).__init__(config, 'waveshare2in13b_v4')
def layout(self):
if self.config['color'] == 'black':
fonts.setup(10, 9, 10, 35, 25, 9)
self._layout['width'] = 250
self._layout['height'] = 122
@ -30,27 +29,6 @@ class Waveshare213bV4(DisplayImpl):
'font': fonts.status_font(fonts.Medium),
'max': 20
}
else:
fonts.setup(10, 8, 10, 25, 25, 9)
self._layout['width'] = 212
self._layout['height'] = 104
self._layout['face'] = (0, 26)
self._layout['name'] = (5, 15)
self._layout['channel'] = (0, 0)
self._layout['aps'] = (28, 0)
self._layout['status'] = (91, 15)
self._layout['uptime'] = (147, 0)
self._layout['line1'] = [0, 12, 212, 12]
self._layout['line2'] = [0, 92, 212, 92]
self._layout['friend_face'] = (0, 76)
self._layout['friend_name'] = (40, 78)
self._layout['shakes'] = (0, 93)
self._layout['mode'] = (187, 93)
self._layout['status'] = {
'pos': (125, 20),
'font': fonts.status_font(fonts.Medium),
'max': 14
}
return self._layout
def initialize(self):

View File

@ -35,13 +35,11 @@ class Waveshare27inchV2(DisplayImpl):
from pwnagotchi.ui.hw.libs.waveshare.v2in7_v2.epd2in7_V2 import EPD
self._display = EPD()
self._display.init()
# this must have changed by waveshare
# remove the 0xFF(Clear(0xFF)) other wise it errors. can't pass oxff and self
self._display.Clear()
def render(self, canvas):
buf = self._display.getbuffer(canvas)
self._display.display_Partial(buf, 0, 0, 176, 264)
self._display.display_Fast(buf)
def clear(self):
# This line also removes the 0xFF

View File

@ -23,7 +23,21 @@ ROOT = None
class View(object):
def __init__(self, config, impl, state=None):
global ROOT
global ROOT, BLACK, WHITE
self.invert = 0
self._black = 0xFF
self._white = 0x00
if 'invert' in config['ui'] and config['ui']['invert'] == True:
logging.debug("INVERT BLACK/WHITES:" + str(config['ui']['invert']))
self.invert = 1
BLACK = 0x00
WHITE - 0xFF
self._black = 0x00
self._white = 0xFF
# setup faces from the configuration in case the user customized them
faces.load_from_config(config['ui']['faces'])
@ -98,6 +112,11 @@ class View(object):
self._state.has_element(key)
def add_element(self, key, elem):
if self.invert is 1 and elem.color:
if elem.color == 0xff:
elem.color = 0x00
elif elem.color == 0x00:
elem.color = 0xff
self._state.add_element(key, elem)
def remove_element(self, key):
@ -371,7 +390,7 @@ class View(object):
state = self._state
changes = state.changes(ignore=self._ignore_changes)
if force or len(changes):
self._canvas = Image.new('1', (self._width, self._height), WHITE)
self._canvas = Image.new('1', (self._width, self._height), self._white)
drawer = ImageDraw.Draw(self._canvas)
plugins.on('ui_update', self)

View File

@ -238,14 +238,60 @@ def load_config(args):
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
# NON E-INK DISPLAYS---------------------------------------------------------------
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':
config['ui']['display']['type'] = 'oledhat'
elif config['ui']['display']['type'] in 'lcdhat':
config['ui']['display']['type'] = 'lcdhat'
elif config['ui']['display']['type'] in ('dfrobot_1', 'df1'):
config['ui']['display']['type'] = 'dfrobot_1'
elif config['ui']['display']['type'] in ('dfrobot_2', 'df2'):
config['ui']['display']['type'] = 'dfrobot_2'
elif config['ui']['display']['type'] in ('waveshare144lcd', 'ws_144', 'ws144', 'waveshare_144', 'waveshare144'):
config['ui']['display']['type'] = 'waveshare144lcd'
elif config['ui']['display']['type'] in ('spotpear24inch'):
config['ui']['display']['type'] = 'spotpear24inch'
elif config['ui']['display']['type'] in ('displayhatmini'):
config['ui']['display']['type'] = 'displayhatmini'
elif config['ui']['display']['type'] in ('waveshare35lcd'):
config['ui']['display']['type'] = 'waveshare35lcd'
# E-INK DISPLAYS ------------------------------------------------------------------------
elif config['ui']['display']['type'] in ('waveshare1in02', 'ws1in02', 'ws102', 'waveshare_102', 'waveshare_1in02'):
config['ui']['display']['type'] = 'waveshare1in02'
elif config['ui']['display']['type'] in ('ws_154inch', 'waveshare1in54', 'ws154inch', 'waveshare_154', 'waveshare154'):
config['ui']['display']['type'] = 'waveshare1in54'
elif config['ui']['display']['type'] in ('ws_154inchb', 'waveshare1in54b', 'ws154inchb', 'waveshare_154b', 'waveshare154b'):
config['ui']['display']['type'] = 'waveshare1in54b'
elif config['ui']['display']['type'] in ('waveshare1in54c', 'ws1in54c', 'ws154c', 'waveshare_154c', 'waveshare_1in54c'):
config['ui']['display']['type'] = 'waveshare1in54c'
elif config['ui']['display']['type'] in ('ws_154inchbv2', 'waveshare1in54bv2', 'waveshare1in54b_v2', 'ws154inchbv2', 'waveshare_154bv2', 'waveshare154bv2'):
config['ui']['display']['type'] = 'waveshare1in54b_v2'
elif config['ui']['display']['type'] in ('ws_154inchv2', 'waveshare1in54v2', 'ws154inchv2', 'waveshare_154inchv2', 'waveshare154v2', "waveshare1in54_v2"):
config['ui']['display']['type'] = 'waveshare1in54_v2'
elif config['ui']['display']['type'] in ('waveshare1in64g', 'ws1in64g', 'ws164g', 'waveshare_164g', 'waveshare_1in64g'):
config['ui']['display']['type'] = 'waveshare1in64g'
elif config['ui']['display']['type'] in ('ws_1', 'ws1', 'waveshare_1', 'waveshare1'):
config['ui']['display']['type'] = 'waveshare_1'
@ -258,50 +304,14 @@ def load_config(args):
elif config['ui']['display']['type'] in ('ws_4', 'ws4', 'waveshare_4', 'waveshare4'):
config['ui']['display']['type'] = 'waveshare_4'
elif config['ui']['display']['type'] in ('ws_27inch', 'ws27inch', 'waveshare2in7', 'waveshare_27inch', 'waveshare27inch'):
config['ui']['display']['type'] = 'waveshare2in7'
elif config['ui']['display']['type'] in ('waveshare2in13b_v3', 'waveshare2in13b_v3', 'ws213bv3', 'waveshare_213bv3', 'waveshare213inb_v3'):
config['ui']['display']['type'] = 'waveshare2in13b_v3'
elif config['ui']['display']['type'] in ('ws_27inchv2', 'waveshare2in7_v2', 'ws27inchv2', 'waveshare_27inchv2', 'waveshare27inchv2'):
config['ui']['display']['type'] = 'waveshare2in7_v2'
elif config['ui']['display']['type'] in ('ws_213bv4', 'waveshare2in13b_v4', 'ws213bv4', 'waveshare_213bv4', 'waveshare213inb_v4'):
config['ui']['display']['type'] = 'waveshare2in13b_v4'
elif config['ui']['display']['type'] in ('ws_27inchbv2', 'waveshare2in7b_v2', 'ws27inchbv2', 'waveshare_27inchbv2', 'waveshare27inchbv2'):
config['ui']['display']['type'] = 'waveshare2in7b_v2'
elif config['ui']['display']['type'] in ('ws_29inch', 'waveshare2in9', 'ws29inch', 'waveshare_29inch', 'waveshare29inch'):
config['ui']['display']['type'] = 'waveshare2in9'
elif config['ui']['display']['type'] in ('ws_29inchv2', 'waveshare2in9_v2', 'ws29inchv2', 'waveshare_29inchv2', 'waveshare29inchv2'):
config['ui']['display']['type'] = 'waveshare2in9_v2'
elif config['ui']['display']['type'] in ('ws_29inchbv3', 'waveshare2in9b_v3', 'ws29inchbv3', 'waveshare_29inchbv3', 'waveshare29inchbv3'):
config['ui']['display']['type'] = 'waveshare2in9b_v3'
elif config['ui']['display']['type'] in ('ws_29inchbv4', 'waveshare2in9b_v4', 'ws29inchbv4', 'waveshare_29inchbv4', 'waveshare29inchbv4'):
config['ui']['display']['type'] = 'waveshare2in9b_v4'
elif config['ui']['display']['type'] in 'lcdhat':
config['ui']['display']['type'] = 'lcdhat'
elif config['ui']['display']['type'] in ('dfrobot_1', 'df1'):
config['ui']['display']['type'] = 'dfrobot_1'
elif config['ui']['display']['type'] in ('dfrobot_2', 'df2'):
config['ui']['display']['type'] = 'dfrobot_2'
elif config['ui']['display']['type'] in ('ws_154inch', 'waveshare1in54', 'ws154inch', 'waveshare_154inch', 'waveshare154inch'):
config['ui']['display']['type'] = 'waveshare1in54'
elif config['ui']['display']['type'] in ('ws_154inchb', 'waveshare1in54b', 'ws154inchb', 'waveshare_154inchb', 'waveshare154inchb'):
config['ui']['display']['type'] = 'waveshare1in54b'
elif config['ui']['display']['type'] in ('ws_154inchbv2', 'waveshare1in54bv2', 'ws154inchbv2', 'waveshare_154inchbv2', 'waveshare154inchbv2'):
config['ui']['display']['type'] = 'waveshare1in54b_v2'
elif config['ui']['display']['type'] in ('ws_154inchv2', 'waveshare1in54v2', 'ws154inchv2', 'waveshare_154inchv2', 'waveshare154inchv2', "waveshare1in54_v2"):
config['ui']['display']['type'] = 'waveshare1in54_v2'
elif config['ui']['display']['type'] in ('waveshare144lcd', 'ws_144inch', 'ws144inch', 'waveshare_144inch', 'waveshare144inch'):
config['ui']['display']['type'] = 'waveshare144lcd'
elif config['ui']['display']['type'] in ('ws_213bc', 'ws213bc', 'waveshare2in13bc', 'waveshare_213bc', 'waveshare213bc'):
config['ui']['display']['type'] = 'waveshare2in13bc'
elif config['ui']['display']['type'] in ('ws_213d', 'ws213d', 'waveshare2in13d', 'waveshare_213d', 'waveshare213d'):
config['ui']['display']['type'] = 'waveshare2in13d'
@ -309,121 +319,115 @@ def load_config(args):
elif config['ui']['display']['type'] in ('ws_213g', 'waveshare2in13g', 'waveshare213g', 'ws213g', 'waveshare_213g'):
config['ui']['display']['type'] = 'waveshare2in13g'
elif config['ui']['display']['type'] in ('ws_213bc', 'ws213bc', 'waveshare2in13bc', 'waveshare_213bc', 'waveshare213bc'):
config['ui']['display']['type'] = 'waveshare2in13bc'
elif config['ui']['display']['type'] in ('ws_213bv4', 'waveshare2in13b_v4', 'ws213bv4', 'waveshare_213bv4', 'waveshare213inb_v4'):
config['ui']['display']['type'] = 'waveshare2in13b_v4'
elif config['ui']['display']['type'] in 'spotpear24inch':
config['ui']['display']['type'] = 'spotpear24inch'
elif config['ui']['display']['type'] in 'displayhatmini':
config['ui']['display']['type'] = 'displayhatmini'
elif config['ui']['display']['type'] in 'waveshare35lcd':
config['ui']['display']['type'] = 'waveshare35lcd'
elif config['ui']['display']['type'] in 'waveshare1in54c':
config['ui']['display']['type'] = 'waveshare1in54c'
elif config['ui']['display']['type'] in 'waveshare1in64g':
config['ui']['display']['type'] = 'waveshare1in64g'
elif config['ui']['display']['type'] in 'waveshare1in02':
config['ui']['display']['type'] = 'waveshare1in02'
elif config['ui']['display']['type'] in 'waveshare2in9bc':
config['ui']['display']['type'] = 'waveshare2in9bc'
elif config['ui']['display']['type'] in 'waveshare2in9d':
config['ui']['display']['type'] = 'waveshare2in9d'
elif config['ui']['display']['type'] in 'waveshare2in13b_v3':
config['ui']['display']['type'] = 'waveshare2in13b_v3'
elif config['ui']['display']['type'] in 'waveshare2in36g':
elif config['ui']['display']['type'] in ('ws_2in36g', 'waveshare2in36g', 'waveshare236g', 'ws236g', 'waveshare_236g'):
config['ui']['display']['type'] = 'waveshare2in36g'
elif config['ui']['display']['type'] in 'waveshare2in66':
elif config['ui']['display']['type'] in ('ws_2in66', 'waveshare2in66', 'waveshare266', 'ws266', 'waveshare_266'):
config['ui']['display']['type'] = 'waveshare2in66'
elif config['ui']['display']['type'] in 'waveshare2in66b':
elif config['ui']['display']['type'] in ('ws_2in66b', 'waveshare2in66b', 'waveshare266b', 'ws266b', 'waveshare_266b'):
config['ui']['display']['type'] = 'waveshare2in66b'
elif config['ui']['display']['type'] in 'waveshare2in66g':
elif config['ui']['display']['type'] in ('ws_2in66g', 'waveshare2in66g', 'waveshare266g', 'ws266g', 'waveshare_266g'):
config['ui']['display']['type'] = 'waveshare2in66g'
elif config['ui']['display']['type'] in 'waveshare3in0g':
elif config['ui']['display']['type'] in ('ws_27inch', 'ws27inch', 'waveshare2in7', 'waveshare_27inch', 'waveshare27'):
config['ui']['display']['type'] = 'waveshare2in7'
elif config['ui']['display']['type'] in ('ws_2in7v2', 'waveshare2in7_v2', 'waveshare2in7v2', 'ws27inchv2', 'waveshare_27v2', 'waveshare27v2'):
config['ui']['display']['type'] = 'waveshare2in7_v2'
elif config['ui']['display']['type'] in ('ws_2in7bv2', 'waveshare2in7b_v2', 'waveshare2in7bv2', 'ws27inchbv2', 'waveshare_27bv2', 'waveshare27bv2'):
config['ui']['display']['type'] = 'waveshare2in7b_v2'
elif config['ui']['display']['type'] in ('ws_2in9', 'waveshare2in9', 'ws29inch', 'waveshare_29inch', 'waveshare29inch'):
config['ui']['display']['type'] = 'waveshare2in9'
elif config['ui']['display']['type'] in ('ws_2in9bc', 'waveshare2in9bc', 'ws2in9bc', 'ws29bc', 'waveshare_29bc', 'waveshare_2in9bc'):
config['ui']['display']['type'] = 'waveshare2in9bc'
elif config['ui']['display']['type'] in ('ws_2in9d', 'waveshare2in9d', 'ws2in9d', 'ws29d', 'waveshare_29d', 'waveshare_2in9d'):
config['ui']['display']['type'] = 'waveshare2in9d'
elif config['ui']['display']['type'] in ('ws_2in9v2', 'waveshare2in9_v2', 'waveshare2in9v2', 'ws2in9v2', 'waveshare_29v2', 'waveshare29v2'):
config['ui']['display']['type'] = 'waveshare2in9_v2'
elif config['ui']['display']['type'] in ('ws_2in9bv3', 'waveshare2in9b_v3', 'waveshare2in9bv3', 'ws2in9bv3', 'waveshare_29bv3', 'waveshare29bv3'):
config['ui']['display']['type'] = 'waveshare2in9b_v3'
elif config['ui']['display']['type'] in ('ws_2in9bv4', 'waveshare2in9b_v4', 'waveshare2in9bv4', 'ws2in9bv4', 'waveshare_29bv4', 'waveshare29bv4'):
config['ui']['display']['type'] = 'waveshare2in9b_v4'
elif config['ui']['display']['type'] in ('ws_3in0g', 'waveshare3in0g', 'ws3in0g', 'waveshare_30g', 'waveshare30g'):
config['ui']['display']['type'] = 'waveshare3in0g'
elif config['ui']['display']['type'] in 'waveshare3in7':
elif config['ui']['display']['type'] in ('ws_3in7', 'waveshare3in7', 'ws3in7', 'waveshare_37', 'waveshare37'):
config['ui']['display']['type'] = 'waveshare3in7'
elif config['ui']['display']['type'] in 'waveshare3in52':
elif config['ui']['display']['type'] in ('ws_3in52', 'waveshare3in52', 'ws3in52', 'waveshare_352', 'waveshare352'):
config['ui']['display']['type'] = 'waveshare3in52'
elif config['ui']['display']['type'] in 'waveshare4in01f':
elif config['ui']['display']['type'] in ('ws_4in01f', 'waveshare4in01f', 'ws4in01f', 'waveshare_401f', 'waveshare401f'):
config['ui']['display']['type'] = 'waveshare4in01f'
elif config['ui']['display']['type'] in 'waveshare4in2':
elif config['ui']['display']['type'] in ('ws_4in2', 'waveshare4in2', 'ws4in2', 'waveshare_42', 'waveshare42'):
config['ui']['display']['type'] = 'waveshare4in2'
elif config['ui']['display']['type'] in 'waveshare4in2_v2':
elif config['ui']['display']['type'] in ('ws_4in2v2', 'waveshare4in2v2', 'ws4in2v2', 'waveshare_42v2', 'waveshare42v2'):
config['ui']['display']['type'] = 'waveshare4in2_v2'
elif config['ui']['display']['type'] in 'waveshare4in2b_v2':
elif config['ui']['display']['type'] in ('ws_4in2bv2', 'waveshare4in2bv2', 'ws4in2bv2', 'waveshare_42bv2', 'waveshare42bv2'):
config['ui']['display']['type'] = 'waveshare4in2b_v2'
elif config['ui']['display']['type'] in 'waveshare4in2bc':
elif config['ui']['display']['type'] in ('ws_4in2bc', 'waveshare4in2bc', 'ws4in2bc', 'waveshare_42bc', 'waveshare42bc'):
config['ui']['display']['type'] = 'waveshare4in2bc'
elif config['ui']['display']['type'] in 'waveshare4in26':
elif config['ui']['display']['type'] in ('ws_4in26', 'waveshare4in26', 'ws4in26', 'waveshare_426', 'waveshare426'):
config['ui']['display']['type'] = 'waveshare4in26'
elif config['ui']['display']['type'] in 'waveshare4in37g':
elif config['ui']['display']['type'] in ('ws_4in37g', 'waveshare4in37g', 'ws4in37g', 'waveshare_37g', 'waveshare437g'):
config['ui']['display']['type'] = 'waveshare4in37g'
elif config['ui']['display']['type'] in 'waveshare5in65f':
elif config['ui']['display']['type'] in ('ws_5in65f', 'waveshare5in65f', 'ws5in65f', 'waveshare_565f', 'waveshare565f'):
config['ui']['display']['type'] = 'waveshare5in65f'
elif config['ui']['display']['type'] in 'waveshare5in83':
elif config['ui']['display']['type'] in ('ws_5in83', 'waveshare5in83', 'ws5in83', 'waveshare_583', 'waveshare583'):
config['ui']['display']['type'] = 'waveshare5in83'
elif config['ui']['display']['type'] in 'waveshare5in83_v2':
elif config['ui']['display']['type'] in ('ws_5in83v2', 'waveshare5in83v2', 'ws5in83v2', 'waveshare_583v2', 'waveshare583v2'):
config['ui']['display']['type'] = 'waveshare5in83_v2'
elif config['ui']['display']['type'] in 'waveshare5in83b_v2':
elif config['ui']['display']['type'] in ('ws_5in83bv2', 'waveshare5in83bv2', 'ws5in83bv2', 'waveshare_583bv2', 'waveshare583bv2'):
config['ui']['display']['type'] = 'waveshare5in83b_v2'
elif config['ui']['display']['type'] in 'waveshare5in83bc':
elif config['ui']['display']['type'] in ('ws_5in83bc', 'waveshare5in83bc', 'ws5in83bc', 'waveshare_583bc', 'waveshare583bc'):
config['ui']['display']['type'] = 'waveshare5in83bc'
elif config['ui']['display']['type'] in 'waveshare7in3f':
elif config['ui']['display']['type'] in ('ws_7in3f', 'waveshare7in3f', 'ws7in3f', 'waveshare_73f', 'waveshare73f'):
config['ui']['display']['type'] = 'waveshare7in3f'
elif config['ui']['display']['type'] in 'waveshare7in3g':
elif config['ui']['display']['type'] in ('ws_7in3g', 'waveshare7in3g', 'ws7in3g', 'waveshare_73g', 'waveshare73g'):
config['ui']['display']['type'] = 'waveshare7in3g'
elif config['ui']['display']['type'] in 'waveshare7in5':
elif config['ui']['display']['type'] in ('ws_7in5', 'waveshare7in5', 'ws7in5', 'waveshare_75', 'waveshare75'):
config['ui']['display']['type'] = 'waveshare7in5'
elif config['ui']['display']['type'] in 'waveshare7in5_HD':
elif config['ui']['display']['type'] in ('ws_7in5hd', 'waveshare7in5hd', 'ws7in5hd', 'waveshare_75hd', 'waveshare75hd'):
config['ui']['display']['type'] = 'waveshare7in5_HD'
elif config['ui']['display']['type'] in 'waveshare7in5_v2':
elif config['ui']['display']['type'] in ('ws_7in5v2', 'waveshare7in5v2', 'ws7in5v2', 'waveshare_75v2', 'waveshare75v2'):
config['ui']['display']['type'] = 'waveshare7in5_v2'
elif config['ui']['display']['type'] in 'waveshare7in5b_HD':
elif config['ui']['display']['type'] in ('ws_7in5bhd', 'waveshare7in5bhd', 'ws7in5bhd', 'waveshare_75bhd', 'waveshare75bhd'):
config['ui']['display']['type'] = 'waveshare7in5b_HD'
elif config['ui']['display']['type'] in 'waveshare7in5b_v2':
elif config['ui']['display']['type'] in ('ws_7in5bv2', 'waveshare7in5bv2', 'ws7in5bv2', 'waveshare_75bv2', 'waveshare75bv2'):
config['ui']['display']['type'] = 'waveshare7in5b_v2'
elif config['ui']['display']['type'] in 'waveshare7in5bc':
elif config['ui']['display']['type'] in ('ws_7in5bc', 'waveshare7in5bc', 'ws7in5bc', 'waveshare_75bc', 'waveshare75bc'):
config['ui']['display']['type'] = 'waveshare7in5bc'
elif config['ui']['display']['type'] in 'waveshare13in3k':
elif config['ui']['display']['type'] in ('ws_13in3k', 'waveshare13in3k', 'ws13in3k', 'waveshare_133k', 'waveshare133k'):
config['ui']['display']['type'] = 'waveshare13in3k'
else:

View File

@ -98,7 +98,7 @@ setup(name='pwnagotchi',
"install": CustomInstall,
},
scripts=['bin/pwnagotchi'],
package_data={'pwnagotchi': ['defaults.yml', 'pwnagotchi/defaults.yml', 'locale/*/LC_MESSAGES/*.mo']},
package_data={'pwnagotchi': ['defaults.toml', 'pwnagotchi/defaults.toml', 'locale/*/LC_MESSAGES/*.mo']},
include_package_data=True,
packages=find_packages(),
classifiers=[