Version 2.1.1

Signed-off-by: Jeroen Oudshoorn <oudshoorn.jeroen@gmail.com>
This commit is contained in:
Jeroen Oudshoorn
2023-08-30 11:14:59 +02:00
parent cfc2153aa8
commit 63fd7d9833
5 changed files with 64 additions and 70 deletions

View File

@ -4,23 +4,34 @@
<inspection_tool class="PyPackageRequirementsInspection" enabled="true" level="WARNING" enabled_by_default="true">
<option name="ignoredPackages">
<value>
<list size="8">
<item index="0" class="java.lang.String" itemvalue="spidev" />
<item index="1" class="java.lang.String" itemvalue="tensorflow" />
<item index="2" class="java.lang.String" itemvalue="inky" />
<item index="3" class="java.lang.String" itemvalue="dbus-python" />
<item index="4" class="java.lang.String" itemvalue="pycryptodome" />
<item index="5" class="java.lang.String" itemvalue="numpy" />
<item index="6" class="java.lang.String" itemvalue="RPi.GPIO" />
<item index="7" class="java.lang.String" itemvalue="markupsafe" />
<list size="24">
<item index="0" class="java.lang.String" itemvalue="tweepy" />
<item index="1" class="java.lang.String" itemvalue="PyYAML" />
<item index="2" class="java.lang.String" itemvalue="python-dateutil" />
<item index="3" class="java.lang.String" itemvalue="file-read-backwards" />
<item index="4" class="java.lang.String" itemvalue="requests" />
<item index="5" class="java.lang.String" itemvalue="gast" />
<item index="6" class="java.lang.String" itemvalue="torchvision" />
<item index="7" class="java.lang.String" itemvalue="shimmy" />
<item index="8" class="java.lang.String" itemvalue="flask-cors" />
<item index="9" class="java.lang.String" itemvalue="scapy" />
<item index="10" class="java.lang.String" itemvalue="RPi.GPIO" />
<item index="11" class="java.lang.String" itemvalue="websockets" />
<item index="12" class="java.lang.String" itemvalue="inky" />
<item index="13" class="java.lang.String" itemvalue="smbus2" />
<item index="14" class="java.lang.String" itemvalue="stable-baselines3" />
<item index="15" class="java.lang.String" itemvalue="torch" />
<item index="16" class="java.lang.String" itemvalue="toml" />
<item index="17" class="java.lang.String" itemvalue="spidev" />
<item index="18" class="java.lang.String" itemvalue="flask-wtf" />
<item index="19" class="java.lang.String" itemvalue="gym" />
<item index="20" class="java.lang.String" itemvalue="dbus-python" />
<item index="21" class="java.lang.String" itemvalue="pycryptodome" />
<item index="22" class="java.lang.String" itemvalue="flask" />
<item index="23" class="java.lang.String" itemvalue="Pillow" />
</list>
</value>
</option>
</inspection_tool>
<inspection_tool class="SpellCheckingInspection" enabled="false" level="TYPO" enabled_by_default="false">
<option name="processCode" value="true" />
<option name="processLiterals" value="true" />
<option name="processComments" value="true" />
</inspection_tool>
</profile>
</component>

View File

@ -38,10 +38,10 @@ $(PWN_RELEASE).img: | $(PACKER)
# If the packer or ansible files are updated, rebuild the image.
$(PWN_RELEASE).img: $(SDIST) builder/pwnagotchi.json builder/pwnagotchi.yml $(shell find builder/data -type f)
# $(PACKER) plugins install github.com/mkaczanowski/builder-arm
cd builder/packer-builder-arm/ && sudo $(UNSHARE) $(PACKER) build -var "pwn_hostname=$(PWN_HOSTNAME)" -var "pwn_version=$(PWN_VERSION)" ../pwnagotchi.json
$(PACKER) plugins install github.com/solo-io/arm-image
cd builder && sudo $(UNSHARE) $(PACKER) build -var "pwn_hostname=$(PWN_HOSTNAME)" -var "pwn_version=$(PWN_VERSION)" pwnagotchi.json
sudo chown -R $$USER:$$USER ../builder/output-pwnagotchi
mv ../builder/output-pwnagotchi/image $@
mv builder/output-pwnagotchi/image $@
# If any of these files are updated, rebuild the checksums.
$(PWN_RELEASE).sha256: $(PWN_RELEASE).img

View File

@ -2,108 +2,90 @@
"builders": [
{
"name": "pwnagotchi",
"type": "arm",
"file_urls": "https://downloads.raspberrypi.org/raspios_lite_arm64/images/raspios_lite_arm64-2023-05-03/2023-05-03-raspios-bullseye-arm64-lite.img.xz",
"file_checksum_url": "https://downloads.raspberrypi.org/raspios_lite_arm64/images/raspios_lite_arm64-2023-05-03/2023-05-03-raspios-bullseye-arm64-lite.img.xz.sha256",
"file_checksum_type": "sha256",
"file_target_extension": "xz",
"file_unarchive_cmd": ["xz", "--decompress", "$ARCHIVE_PATH"],
"image_path": "pwnagotchi.img.tar.gz",
"image_size": "10G",
"image_type": "dos",
"qemu_binary_destination_path": "/usr/bin/qemu-aarch64-static",
"qemu_binary_source_path": "/usr/bin/qemu-aarch64-static",
"image_build_method": "resize",
"image_partitions": [
{
"name": "boot",
"type": "c",
"start_sector": "2048",
"filesystem": "fat",
"size": "256M",
"mountpoint": "/boot/firmware"
},
{
"name": "root",
"type": "83",
"start_sector": "526336",
"filesystem": "ext4",
"size": "0",
"mountpoint": "/"
}
],
"image_chroot_env": ["PATH=/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin"]
"type": "arm-image",
"iso_urls": "https://downloads.raspberrypi.org/raspios_lite_arm64/images/raspios_lite_arm64-2023-05-03/2023-05-03-raspios-bullseye-arm64-lite.img.xz",
"iso_checksum": "file:https://downloads.raspberrypi.org/raspios_lite_arm64/images/raspios_lite_arm64-2023-05-03/2023-05-03-raspios-bullseye-arm64-lite.img.xz.sha256",
"target_image_size": 9368709120,
"qemu_binary": "qemu-aarch64-static"
}
],
"provisioners": [
{
"type": "shell",
"inline": [
"uname -a",
"dpkg-architecture",
"mkdir -p /usr/local/src/pwnagotchi"
]
},
{
"type": "file",
"source": "../../builder/data/usr/bin/pwnlib",
"source": "../builder/data/usr/bin/pwnlib",
"destination": "/usr/bin/pwnlib"
},
{
"type": "file",
"source": "../../builder/data/usr/bin/bettercap-launcher",
"source": "../builder/data/usr/bin/bettercap-launcher",
"destination": "/usr/bin/bettercap-launcher"
},
{
"type": "file",
"source": "../../builder/data/usr/bin/pwnagotchi-launcher",
"source": "../builder/data/usr/bin/pwnagotchi-launcher",
"destination": "/usr/bin/pwnagotchi-launcher"
},
{
"type": "file",
"source": "../../builder/data/usr/bin/monstop",
"source": "../builder/data/usr/bin/monstop",
"destination": "/usr/bin/monstop"
},
{
"type": "file",
"source": "../../builder/data/usr/bin/monstart",
"source": "../builder/data/usr/bin/monstart",
"destination": "/usr/bin/monstart"
},
{
"type": "file",
"source": "../../builder/data/usr/bin/hdmion",
"source": "../builder/data/usr/bin/hdmion",
"destination": "/usr/bin/hdmion"
},
{
"type": "file",
"source": "../../builder/data/usr/bin/hdmioff",
"source": "../builder/data/usr/bin/hdmioff",
"destination": "/usr/bin/hdmioff"
},
{
"type": "file",
"source": "../../builder/data/etc/network/interfaces.d/lo-cfg",
"source": "../builder/data/etc/network/interfaces.d/lo-cfg",
"destination": "/etc/network/interfaces.d/lo-cfg"
},
{
"type": "file",
"source": "../../builder/data/etc/network/interfaces.d/wlan0-cfg",
"source": "../builder/data/etc/network/interfaces.d/wlan0-cfg",
"destination": "/etc/network/interfaces.d/wlan0-cfg"
},
{
"type": "file",
"source": "../../builder/data/etc/network/interfaces.d/usb0-cfg",
"source": "../builder/data/etc/network/interfaces.d/usb0-cfg",
"destination": "/etc/network/interfaces.d/usb0-cfg"
},
{
"type": "file",
"source": "../../builder/data/etc/network/interfaces.d/eth0-cfg",
"source": "../builder/data/etc/network/interfaces.d/eth0-cfg",
"destination": "/etc/network/interfaces.d/eth0-cfg"
},
{
"type": "file",
"source": "../../builder/data/etc/systemd/system/pwngrid-peer.service",
"source": "../builder/data/etc/systemd/system/pwngrid-peer.service",
"destination": "/etc/systemd/system/pwngrid-peer.service"
},
{
"type": "file",
"source": "../../builder/data/etc/systemd/system/pwnagotchi.service",
"source": "../builder/data/etc/systemd/system/pwnagotchi.service",
"destination": "/etc/systemd/system/pwnagotchi.service"
},
{
"type": "file",
"source": "../../builder/data/etc/systemd/system/bettercap.service",
"source": "../builder/data/etc/systemd/system/bettercap.service",
"destination": "/etc/systemd/system/bettercap.service"
},
{
@ -122,7 +104,7 @@
},
{
"type": "ansible-local",
"playbook_file": "../../builder/pwnagotchi.yml",
"playbook_file": "../builder/pwnagotchi.yml",
"extra_arguments": [
"--extra-vars \"ansible_python_interpreter=/usr/bin/python3\""
],

View File

@ -48,6 +48,7 @@
- libpcap0.8-dev
remove:
- raspberrypi-net-mods
- dhcpcd5
- triggerhappy
- wpa_supplicant
- nfs-common

View File

@ -1,16 +1,18 @@
import os
import glob
import _thread
import threading
import importlib, importlib.util
import logging
from concurrent.futures import ThreadPoolExecutor
default_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), "default")
loaded = {}
database = {}
locks = {}
THREAD_POOL_SIZE = 10
executor = ThreadPoolExecutor(max_workers=THREAD_POOL_SIZE)
class Plugin:
@classmethod
@ -46,13 +48,13 @@ def toggle_plugin(name, enable=True):
if name not in pwnagotchi.config['main']['plugins']:
pwnagotchi.config['main']['plugins'][name] = dict()
pwnagotchi.config['main']['plugins'][name]['enabled'] = enable
save_config(pwnagotchi.config, '/etc/pwnagotchi/config.toml')
if not enable and name in loaded:
if getattr(loaded[name], 'on_unload', None):
loaded[name].on_unload(view.ROOT)
del loaded[name]
if pwnagotchi.config:
save_config(pwnagotchi.config, '/etc/pwnagotchi/config.toml')
return True
if enable and name in database and name not in loaded:
@ -64,8 +66,6 @@ def toggle_plugin(name, enable=True):
one(name, 'config_changed', pwnagotchi.config)
one(name, 'ui_setup', view.ROOT)
one(name, 'ready', view.ROOT._agent)
if pwnagotchi.config:
save_config(pwnagotchi.config, '/etc/pwnagotchi/config.toml')
return True
return False
@ -97,7 +97,7 @@ def one(plugin_name, event_name, *args, **kwargs):
try:
lock_name = "%s::%s" % (plugin_name, cb_name)
locked_cb_args = (lock_name, callback, *args, *kwargs)
_thread.start_new_thread(locked_cb, locked_cb_args)
executor.submit(locked_cb, *locked_cb_args)
except Exception as e:
logging.error("error while running %s.%s : %s" % (plugin_name, cb_name, e))
logging.error(e, exc_info=True)