From 47705ba1a2d76cb249596c3036bd008396688381 Mon Sep 17 00:00:00 2001 From: jayofelony Date: Wed, 3 Apr 2024 09:39:10 +0200 Subject: [PATCH 1/4] Update config.txt at creation of image file, no more overwriting at auto-update. Signed-off-by: jayofelony --- builder/data/32bit/boot/config.txt | 67 -------------------- builder/data/64bit/boot/firmware/config.txt | 70 --------------------- builder/raspberrypi32.yml | 43 +++++++++++++ builder/raspberrypi64.yml | 28 +++++++++ 4 files changed, 71 insertions(+), 137 deletions(-) delete mode 100644 builder/data/32bit/boot/config.txt delete mode 100644 builder/data/64bit/boot/firmware/config.txt diff --git a/builder/data/32bit/boot/config.txt b/builder/data/32bit/boot/config.txt deleted file mode 100644 index 92a4d1a5..00000000 --- a/builder/data/32bit/boot/config.txt +++ /dev/null @@ -1,67 +0,0 @@ -# For more options and information see -# http://rptl.io/configtxt -# Some settings may impact device functionality. See link above for details - -# Uncomment some or all of these to enable the optional hardware interfaces -#dtparam=i2c_arm=on -#dtparam=i2s=on -#dtparam=spi=on - -# Enable audio (loads snd_bcm2835) -dtparam=audio=on - -# Additional overlays and parameters are documented -# /boot/overlays/README - -# Automatically load overlays for detected cameras -camera_auto_detect=1 - -# Automatically load overlays for detected DSI displays -display_auto_detect=1 - -# Automatically load initramfs files, if found -auto_initramfs=1 - -# Enable DRM VC4 V3D driver -dtoverlay=vc4-kms-v3d -max_framebuffers=2 - -# Don't have the firmware create an initial video= setting in cmdline.txt. -# Use the kernel's default instead. -disable_fw_kms_setup=1 - -# Run in 64-bit mode -arm_64bit=0 - -# Disable compensation for displays with overscan -disable_overscan=1 - -# Run as fast as firmware / board allows -arm_boost=1 - -[cm4] -# Enable host mode on the 2711 built-in XHCI USB controller. -# This line should be removed if the legacy DWC2 controller is required -# (e.g. for USB device mode) or if USB support is not required. -otg_mode=1 - -[all] -dtoverlay=dwc2 -dtparam=i2c1=on -dtparam=i2c_arm=on -dtparam=spi=on -gpu_mem=1 -dtoverlay=dwc2 -#dtoverlay=disable-wifi - -[pi0] -dtoverlay=spi1-3cs -#dtoverlay=disable-wifi - -[pi3] -dtoverlay=spi1-3cs -#dtoverlay=disable-wifi - -[pi4] -dtoverlay=spi1-3cs -#dtoverlay=disable-wifi diff --git a/builder/data/64bit/boot/firmware/config.txt b/builder/data/64bit/boot/firmware/config.txt deleted file mode 100644 index 948e70ec..00000000 --- a/builder/data/64bit/boot/firmware/config.txt +++ /dev/null @@ -1,70 +0,0 @@ -# For more options and information see -# http://rptl.io/configtxt -# Some settings may impact device functionality. See link above for details - -# Uncomment some or all of these to enable the optional hardware interfaces -#dtparam=i2c_arm=on -#dtparam=i2s=on -#dtparam=spi=on - -# Enable audio (loads snd_bcm2835) -dtparam=audio=on - -# Additional overlays and parameters are documented -# /boot/firmware/overlays/README - -# Automatically load overlays for detected cameras -camera_auto_detect=1 - -# Automatically load overlays for detected DSI displays -display_auto_detect=1 - -# Automatically load initramfs files, if found -auto_initramfs=1 - -# Enable DRM VC4 V3D driver -dtoverlay=vc4-kms-v3d -max_framebuffers=2 - -# Don't have the firmware create an initial video= setting in cmdline.txt. -# Use the kernel's default instead. -disable_fw_kms_setup=1 - -# Run in 64-bit mode -arm_64bit=1 - -# Disable compensation for displays with overscan -disable_overscan=1 - -# Run as fast as firmware / board allows -arm_boost=1 - -[cm4] -# Enable host mode on the 2711 built-in XHCI USB controller. -# This line should be removed if the legacy DWC2 controller is required -# (e.g. for USB device mode) or if USB support is not required. -otg_mode=1 - -[all] -dtparam=i2c1=on -dtparam=i2c_arm=on -dtparam=spi=on -gpu_mem=1 -dtoverlay=dwc2 -#dtoverlay=disable-wifi - -[pi0] -dtoverlay=spi0-0cs -#dtoverlay=disable-wifi - -[pi3] -dtoverlay=spi0-0cs -#dtoverlay=disable-wifi - -[pi4] -dtoverlay=spi0-0cs -#dtoverlay=disable-wifi - -[pi5] -dtoverlay=spi0-0cs -#dtoverlay=disable-wifi diff --git a/builder/raspberrypi32.yml b/builder/raspberrypi32.yml index 16e18440..bf6a03b7 100644 --- a/builder/raspberrypi32.yml +++ b/builder/raspberrypi32.yml @@ -123,6 +123,7 @@ - libc-ares-dev - libc6-dev - libcpuinfo-dev + - libcurl4-openssl-dev - libdbus-1-dev - libdbus-glib-1-dev - libeigen3-dev @@ -206,6 +207,30 @@ state: present when: hostname.changed + - name: setup /boot/config.txt + blockinfile: + path: /boot/config.txt + insertafter: EOF + block: | + dtparam=i2c1=on + dtparam=i2c_arm=on + dtparam=spi=on + gpu_mem=1 + dtoverlay=dwc2 + #dtoverlay=disable-wifi + + [pi0] + dtoverlay=spi0-0cs + #dtoverlay=disable-wifi + + [pi3] + dtoverlay=spi0-0cs + #dtoverlay=disable-wifi + + [pi4] + dtoverlay=spi0-0cs + #dtoverlay=disable-wifi + - name: Create custom plugin directory file: path: '{{ pwnagotchi.custom_plugin_dir }}' @@ -264,6 +289,24 @@ dest: /usr/local/lib/libpcap.so.0.8 state: link + # install latest hcxtools + + - name: clone hcxtools + git: + repo: https://github.com/ZerBea/hcxtools.git + dest: /usr/local/src/hcxtools + + - name: install hcxtools + shell: "make && make install" + args: + executable: /bin/bash + chdir: /usr/local/src/hcxtools + + - name: remove hcxtools directory + file: + state: absent + path: /usr/local/src/hcxtools + ############################################################### # Install nexmon to fix wireless scanning (takes 2.5G of space) ############################################################### diff --git a/builder/raspberrypi64.yml b/builder/raspberrypi64.yml index 479f11ca..11f1a027 100644 --- a/builder/raspberrypi64.yml +++ b/builder/raspberrypi64.yml @@ -211,6 +211,34 @@ regexp: '(.*)$' line: '\1 modules-load=dwc2,g_ether' + - name: setup /boot/firmware/config.txt + blockinfile: + path: /boot/firmware/config.txt + insertafter: EOF + block: | + dtparam=i2c1=on + dtparam=i2c_arm=on + dtparam=spi=on + gpu_mem=1 + dtoverlay=dwc2 + #dtoverlay=disable-wifi + + [pi0] + dtoverlay=spi0-0cs + #dtoverlay=disable-wifi + + [pi3] + dtoverlay=spi0-0cs + #dtoverlay=disable-wifi + + [pi4] + dtoverlay=spi0-0cs + #dtoverlay=disable-wifi + + [pi5] + dtoverlay=spi0-0cs + #dtoverlay=disable-wifi + - name: change hostname lineinfile: dest: /etc/hostname From 415e5cd551d71782b6b7d8b2474facf786e423a1 Mon Sep 17 00:00:00 2001 From: jayofelony Date: Wed, 3 Apr 2024 09:39:38 +0200 Subject: [PATCH 2/4] Small changes Signed-off-by: jayofelony --- pwnagotchi/plugins/default/gpio_buttons.py | 7 ++++--- pwnagotchi/plugins/default/grid.py | 2 +- pwnagotchi/plugins/default/switcher.py | 5 ++++- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/pwnagotchi/plugins/default/gpio_buttons.py b/pwnagotchi/plugins/default/gpio_buttons.py index 50338aa2..2a5cfe2b 100644 --- a/pwnagotchi/plugins/default/gpio_buttons.py +++ b/pwnagotchi/plugins/default/gpio_buttons.py @@ -14,8 +14,9 @@ class GPIOButtons(plugins.Plugin): self.running = False self.ports = {} self.commands = None + self.options = dict() - def runCommand(self, channel): + def runcommand(self, channel): command = self.ports[channel] logging.info(f"Button Pressed! Running command: {command}") process = subprocess.Popen(command, shell=True, stdin=None, stdout=open("/dev/null", "w"), stderr=None, @@ -35,8 +36,8 @@ class GPIOButtons(plugins.Plugin): gpio = int(gpio) self.ports[gpio] = command GPIO.setup(gpio, GPIO.IN, GPIO.PUD_UP) - GPIO.add_event_detect(gpio, GPIO.FALLING, callback=self.runCommand, bouncetime=600) - #set pimoroni display hat mini LED off/dim + GPIO.add_event_detect(gpio, GPIO.FALLING, callback=self.runcommand, bouncetime=600) + # set pimoroni display hat mini LED off/dim GPIO.setup(17, GPIO.IN, pull_up_down=GPIO.PUD_DOWN) GPIO.setup(22, GPIO.IN, pull_up_down=GPIO.PUD_DOWN) GPIO.setup(27, GPIO.IN, pull_up_down=GPIO.PUD_DOWN) diff --git a/pwnagotchi/plugins/default/grid.py b/pwnagotchi/plugins/default/grid.py index a2a35357..9c24ed53 100644 --- a/pwnagotchi/plugins/default/grid.py +++ b/pwnagotchi/plugins/default/grid.py @@ -89,7 +89,7 @@ class Grid(plugins.Plugin): logging.debug("checking pcap's") config = agent.config() - pcap_files = glob.glob(os.path.join(agent.config()['bettercap']['handshakes'], "*.pcap")) + pcap_files = glob.glob(os.path.join(config['bettercap']['handshakes'], "*.pcap")) num_networks = len(pcap_files) reported = self.report.data_field_or('reported', default=[]) num_reported = len(reported) diff --git a/pwnagotchi/plugins/default/switcher.py b/pwnagotchi/plugins/default/switcher.py index 21335ac3..4d63f41e 100644 --- a/pwnagotchi/plugins/default/switcher.py +++ b/pwnagotchi/plugins/default/switcher.py @@ -18,12 +18,14 @@ def systemd_dropin(name, content): systemctl("daemon-reload") + def systemctl(command, unit=None): if unit: os.system("/bin/systemctl %s %s" % (command, unit)) else: os.system("/bin/systemctl %s" % command) + def run_task(name, options): task_service_name = "switcher-%s-task.service" % name # save all the commands to a shell script @@ -57,7 +59,7 @@ def run_task(name, options): """ % (name, task_service_name, name)) if 'reboot' in options and options['reboot']: - # create a indication file! + # create an indication file! # if this file is set, we want the switcher-tasks to run open('/root/.switcher', 'a').close() @@ -98,6 +100,7 @@ def run_task(name, options): systemctl("daemon-reload") systemctl("start", task_service_name) + class Switcher(plugins.Plugin): __author__ = '33197631+dadav@users.noreply.github.com' __version__ = '0.0.1' From 8991dd681135ada5d39a20be11e7e2c135de58c7 Mon Sep 17 00:00:00 2001 From: Rai <58925163+rai68@users.noreply.github.com> Date: Thu, 4 Apr 2024 03:04:31 +1000 Subject: [PATCH 3/4] Update components.py this allows plugins / ui elements of bitmap to be inverted for plugins etc Signed-off-by: Rai <58925163+rai68@users.noreply.github.com> --- pwnagotchi/ui/components.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pwnagotchi/ui/components.py b/pwnagotchi/ui/components.py index b6d4db49..763f510b 100644 --- a/pwnagotchi/ui/components.py +++ b/pwnagotchi/ui/components.py @@ -10,13 +10,17 @@ class Widget(object): def draw(self, canvas, drawer): raise Exception("not implemented") - +# canvas.paste: https://pillow.readthedocs.io/en/stable/reference/Image.html#PIL.Image.Image.paste +# takes mask variable, to identify color system. (not used for pwnagotchi yet) +# Pwn should use "1" since its mainly black or white displays. class Bitmap(Widget): def __init__(self, path, xy, color=0): super().__init__(xy, color) self.image = Image.open(path) def draw(self, canvas, drawer): + if self.color = 0xFF: + self.image = ImageOps.invert(self.image) canvas.paste(self.image, self.xy) From ac2973889daaa2d8c62ef3f19c27a2c849b6b8a4 Mon Sep 17 00:00:00 2001 From: Jayofelony Date: Wed, 3 Apr 2024 21:14:22 +0200 Subject: [PATCH 4/4] Update FUNDING.yml --- .github/FUNDING.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml index 3be73f82..f8690609 100644 --- a/.github/FUNDING.yml +++ b/.github/FUNDING.yml @@ -1,4 +1,3 @@ # These are supported funding model platforms -github: jayofelony -custom: https://tikkie.me/pay/dubcto94hnskg539kar0 \ No newline at end of file +github: jayofelony \ No newline at end of file