diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml
index e5a34190..5e5344d0 100644
--- a/.idea/inspectionProfiles/Project_Default.xml
+++ b/.idea/inspectionProfiles/Project_Default.xml
@@ -4,23 +4,34 @@
-
-
-
-
-
\ No newline at end of file
diff --git a/Makefile b/Makefile
index c53447c1..5d0491cb 100644
--- a/Makefile
+++ b/Makefile
@@ -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
diff --git a/builder/pwnagotchi.json b/builder/pwnagotchi.json
index 78da9cc9..3ef32706 100644
--- a/builder/pwnagotchi.json
+++ b/builder/pwnagotchi.json
@@ -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\""
],
diff --git a/builder/pwnagotchi.yml b/builder/pwnagotchi.yml
index 37333611..2e597106 100644
--- a/builder/pwnagotchi.yml
+++ b/builder/pwnagotchi.yml
@@ -48,6 +48,7 @@
- libpcap0.8-dev
remove:
- raspberrypi-net-mods
+ - dhcpcd5
- triggerhappy
- wpa_supplicant
- nfs-common
diff --git a/pwnagotchi/plugins/__init__.py b/pwnagotchi/plugins/__init__.py
index 994825bb..b14e6880 100644
--- a/pwnagotchi/plugins/__init__.py
+++ b/pwnagotchi/plugins/__init__.py
@@ -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)