From 45635c0b1ad2b213956689fda69f1f7b16b8576c Mon Sep 17 00:00:00 2001 From: Jeroen Oudshoorn Date: Thu, 28 Sep 2023 00:08:41 +0200 Subject: [PATCH 01/12] v2.4.3 Signed-off-by: Jeroen Oudshoorn --- builder/pwnagotchi.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builder/pwnagotchi.yml b/builder/pwnagotchi.yml index 8aab091d..7e0355b7 100644 --- a/builder/pwnagotchi.yml +++ b/builder/pwnagotchi.yml @@ -563,7 +563,7 @@ line: "\nalias pwnlog='tail -f -n300 /var/log/pwn*.log | sed --unbuffered \"s/,[[:digit:]]\\{3\\}\\]//g\" | cut -d \" \" -f 2-'" insertafter: EOF - - name: Add pwnlog alias + - name: Add pwnver alias lineinfile: dest: /home/pi/.bashrc line: "\nalias pwnver='python3 -c \"import pwnagotchi as p; print(p.__version__)\"'" From 87dd6695846488eebecca97728d67a9d0b14a1eb Mon Sep 17 00:00:00 2001 From: Jeroen Oudshoorn Date: Thu, 28 Sep 2023 14:37:05 +0200 Subject: [PATCH 02/12] Update pwnagotchi.yml --- builder/pwnagotchi.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builder/pwnagotchi.yml b/builder/pwnagotchi.yml index 654f4b0a..7e58fba6 100644 --- a/builder/pwnagotchi.yml +++ b/builder/pwnagotchi.yml @@ -146,7 +146,7 @@ - libusb-1.0-0-dev - libnetfilter-queue-dev environment: - ARCHFLAGS: "-arch armv8" + ARCHFLAGS: "-arch arm64" tasks: - name: Create pi user From a789b103d77d0d8646a66cee29e90416d5c8a290 Mon Sep 17 00:00:00 2001 From: Jeroen Oudshoorn Date: Thu, 28 Sep 2023 15:33:25 +0200 Subject: [PATCH 03/12] v2.4.4 Signed-off-by: Jeroen Oudshoorn --- .idea/inspectionProfiles/profiles_settings.xml | 1 + .idea/misc.xml | 2 +- .idea/pwnagotchi.iml | 2 +- builder/pwnagotchi.json | 2 +- 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml index 105ce2da..dd4c951e 100644 --- a/.idea/inspectionProfiles/profiles_settings.xml +++ b/.idea/inspectionProfiles/profiles_settings.xml @@ -1,5 +1,6 @@ + diff --git a/.idea/misc.xml b/.idea/misc.xml index dc9ea490..6178365c 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,4 +1,4 @@ - + \ No newline at end of file diff --git a/.idea/pwnagotchi.iml b/.idea/pwnagotchi.iml index 38d1fd89..ad51e808 100644 --- a/.idea/pwnagotchi.iml +++ b/.idea/pwnagotchi.iml @@ -4,7 +4,7 @@ - + diff --git a/builder/pwnagotchi.json b/builder/pwnagotchi.json index b7d3dff8..fff56357 100644 --- a/builder/pwnagotchi.json +++ b/builder/pwnagotchi.json @@ -7,7 +7,7 @@ "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", - "output_filename": "images/pwnagotchi-{{user `pwn_version`}}-arm64.img" + "output_filename": "../../../pwnagotchi-{{user `pwn_version`}}-arm64.img" } ], "provisioners": [ From cbb20bdd014a239dc6691503871b743045a49be5 Mon Sep 17 00:00:00 2001 From: Jeroen Oudshoorn Date: Thu, 28 Sep 2023 15:37:08 +0200 Subject: [PATCH 04/12] v2.4.4 Signed-off-by: Jeroen Oudshoorn --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index e64c9a2f..bc5d1cdf 100644 --- a/Makefile +++ b/Makefile @@ -54,7 +54,7 @@ $(PWN_RELEASE).img: | $(PACKER) $(PWN_RELEASE).img: $(SDIST) builder/pwnagotchi.json builder/pwnagotchi.yml $(shell find builder/data -type f) sudo $(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/images + sudo chown -R $$USER:$$USER ../../../ mv builder/images/* ../../../ # If any of these files are updated, rebuild the checksums. From dbc701cf17841b53c1db029612e0ac68a2afbe80 Mon Sep 17 00:00:00 2001 From: Jeroen Oudshoorn Date: Fri, 29 Sep 2023 07:14:55 +0200 Subject: [PATCH 05/12] v2.4.4 Signed-off-by: Jeroen Oudshoorn --- builder/pwnagotchi.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builder/pwnagotchi.yml b/builder/pwnagotchi.yml index 7e58fba6..36896c87 100644 --- a/builder/pwnagotchi.yml +++ b/builder/pwnagotchi.yml @@ -152,7 +152,7 @@ - name: Create pi user user: name: pi - password: "{{ 'raspberry' | password_hash('sha512') }}" + password: "'raspberry' | password_hash('sha512')" shell: /bin/bash update_password: on_create From 7b9ab5a29863cc8c61d07afb222a11e43adad476 Mon Sep 17 00:00:00 2001 From: Jeroen Oudshoorn Date: Fri, 29 Sep 2023 08:38:10 +0200 Subject: [PATCH 06/12] v2.4.4 Signed-off-by: Jeroen Oudshoorn --- builder/pwnagotchi.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builder/pwnagotchi.yml b/builder/pwnagotchi.yml index 36896c87..df3abffa 100644 --- a/builder/pwnagotchi.yml +++ b/builder/pwnagotchi.yml @@ -152,7 +152,7 @@ - name: Create pi user user: name: pi - password: "'raspberry' | password_hash('sha512')" + password: "$1$oQ1S6bS1$Z7T1GXrShpKWgP6nXEtAs." shell: /bin/bash update_password: on_create From d8a25bb772f9b60ee2281861129ba8a615f8bb6e Mon Sep 17 00:00:00 2001 From: Jeroen Oudshoorn Date: Fri, 29 Sep 2023 08:41:04 +0200 Subject: [PATCH 07/12] v2.4.4 Signed-off-by: Jeroen Oudshoorn --- builder/pwnagotchi.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builder/pwnagotchi.yml b/builder/pwnagotchi.yml index df3abffa..169db744 100644 --- a/builder/pwnagotchi.yml +++ b/builder/pwnagotchi.yml @@ -152,7 +152,7 @@ - name: Create pi user user: name: pi - password: "$1$oQ1S6bS1$Z7T1GXrShpKWgP6nXEtAs." + password: "raspberry | password_hash('sha512')" shell: /bin/bash update_password: on_create From 904b92cad32213cd7c8693a6ed1b104330d26d62 Mon Sep 17 00:00:00 2001 From: Jeroen Oudshoorn Date: Fri, 29 Sep 2023 08:52:26 +0200 Subject: [PATCH 08/12] v2.4.4 Signed-off-by: Jeroen Oudshoorn --- builder/pwnagotchi.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builder/pwnagotchi.yml b/builder/pwnagotchi.yml index 169db744..36896c87 100644 --- a/builder/pwnagotchi.yml +++ b/builder/pwnagotchi.yml @@ -152,7 +152,7 @@ - name: Create pi user user: name: pi - password: "raspberry | password_hash('sha512')" + password: "'raspberry' | password_hash('sha512')" shell: /bin/bash update_password: on_create From a0d76b5db75141a86f489ce19780071156ebb2d2 Mon Sep 17 00:00:00 2001 From: Jeroen Oudshoorn Date: Fri, 29 Sep 2023 08:53:08 +0200 Subject: [PATCH 09/12] v2.4.4 Signed-off-by: Jeroen Oudshoorn --- builder/pwnagotchi.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/builder/pwnagotchi.yml b/builder/pwnagotchi.yml index 36896c87..bdb71832 100644 --- a/builder/pwnagotchi.yml +++ b/builder/pwnagotchi.yml @@ -151,6 +151,7 @@ tasks: - name: Create pi user user: + create_home: yes name: pi password: "'raspberry' | password_hash('sha512')" shell: /bin/bash From 21d06bbd70a77e033adbcc85fe1cbd7aa714f19c Mon Sep 17 00:00:00 2001 From: Jeroen Oudshoorn Date: Fri, 29 Sep 2023 09:30:29 +0200 Subject: [PATCH 10/12] v2.4.4 Signed-off-by: Jeroen Oudshoorn --- builder/pwnagotchi.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/builder/pwnagotchi.yml b/builder/pwnagotchi.yml index bdb71832..a9ece67a 100644 --- a/builder/pwnagotchi.yml +++ b/builder/pwnagotchi.yml @@ -151,11 +151,10 @@ tasks: - name: Create pi user user: - create_home: yes name: pi - password: "'raspberry' | password_hash('sha512')" + password: "{{ 'raspberry' | password_hash('sha512') }}" shell: /bin/bash - update_password: on_create + generate_ssh_key: true - name: change hostname lineinfile: From 781e2a616b405b496c8546bd8edb8c62d2b61d58 Mon Sep 17 00:00:00 2001 From: Jeroen Oudshoorn Date: Fri, 29 Sep 2023 10:08:38 +0200 Subject: [PATCH 11/12] v2.4.4 Signed-off-by: Jeroen Oudshoorn --- builder/pwnagotchi.json.pkr.hcl | 117 ++++++++++++++++++++++++++++++++ builder/pwnagotchi.yml | 1 - 2 files changed, 117 insertions(+), 1 deletion(-) create mode 100644 builder/pwnagotchi.json.pkr.hcl diff --git a/builder/pwnagotchi.json.pkr.hcl b/builder/pwnagotchi.json.pkr.hcl new file mode 100644 index 00000000..5eadfcf4 --- /dev/null +++ b/builder/pwnagotchi.json.pkr.hcl @@ -0,0 +1,117 @@ +# This file was autogenerated by the BETA 'packer hcl2_upgrade' command. We +# recommend double checking that everything is correct before going forward. We +# also recommend treating this file as disposable. The HCL2 blocks in this +# file can be moved to other files. For example, the variable blocks could be +# moved to their own 'variables.pkr.hcl' file, etc. Those files need to be +# suffixed with '.pkr.hcl' to be visible to Packer. To use multiple files at +# once they also need to be in the same folder. 'packer inspect folder/' +# will describe to you what is in that folder. + +# Avoid mixing go templating calls ( for example ```{{ upper(`string`) }}``` ) +# and HCL2 calls (for example '${ var.string_value_example }' ). They won't be +# executed together and the outcome will be unknown. + +# All generated input variables will be of 'string' type as this is how Packer JSON +# views them; you can change their type later on. Read the variables type +# constraints documentation +# https://www.packer.io/docs/from-1.5/variables#type-constraints for more info. +# "timestamp" template function replacement +locals { timestamp = regex_replace(timestamp(), "[- TZ:]", "") } + +# source blocks are generated from your builders; a source can be referenced in +# build blocks. A build block runs provisioner and post-processors on a +# source. Read the documentation for source blocks here: +# https://www.packer.io/docs/from-1.5/blocks/source +packer { + required_plugins { + arm-image = { + version = ">= 0.2.7" + source = "github.com/solo-io/arm-image" + } + } +} +source "arm-image" "pwnagotchi" { + 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" + iso_url = "https://downloads.raspberrypi.org/raspios_lite_arm64/images/raspios_lite_arm64-2023-05-03/2023-05-03-raspios-bullseye-arm64-lite.img.xz" + output_filename = "../../../pwnagotchi-${var.pwn_version}-arm64.img" + qemu_binary = "qemu-aarch64-static" + target_image_size = 9368709120 +} + +# a build block invokes sources and runs provisioning steps on them. The +# documentation for build blocks can be found here: +# https://www.packer.io/docs/from-1.5/blocks/build +build { + sources = ["source.arm-image.pwnagotchi"] + + provisioner "file" { + destination = "/usr/bin/pwnlib" + source = "../builder/data/usr/bin/pwnlib" + } + provisioner "file" { + destination = "/usr/bin/bettercap-launcher" + source = "../builder/data/usr/bin/bettercap-launcher" + } + provisioner "file" { + destination = "/usr/bin/pwnagotchi-launcher" + source = "../builder/data/usr/bin/pwnagotchi-launcher" + } + provisioner "file" { + destination = "/usr/bin/monstop" + source = "../builder/data/usr/bin/monstop" + } + provisioner "file" { + destination = "/usr/bin/monstart" + source = "../builder/data/usr/bin/monstart" + } + provisioner "file" { + destination = "/usr/bin/hdmion" + source = "../builder/data/usr/bin/hdmion" + } + provisioner "file" { + destination = "/usr/bin/hdmioff" + source = "../builder/data/usr/bin/hdmioff" + } + provisioner "file" { + destination = "/etc/network/interfaces.d/lo-cfg" + source = "../builder/data/etc/network/interfaces.d/lo-cfg" + } + provisioner "file" { + destination = "/etc/network/interfaces.d/wlan0-cfg" + source = "../builder/data/etc/network/interfaces.d/wlan0-cfg" + } + provisioner "file" { + destination = "/etc/network/interfaces.d/usb0-cfg" + source = "../builder/data/etc/network/interfaces.d/usb0-cfg" + } + provisioner "file" { + destination = "/etc/network/interfaces.d/eth0-cfg" + source = "../builder/data/etc/network/interfaces.d/eth0-cfg" + } + provisioner "file" { + destination = "/etc/systemd/system/pwngrid-peer.service" + source = "../builder/data/etc/systemd/system/pwngrid-peer.service" + } + provisioner "file" { + destination = "/etc/systemd/system/pwnagotchi.service" + source = "../builder/data/etc/systemd/system/pwnagotchi.service" + } + provisioner "file" { + destination = "/etc/systemd/system/bettercap.service" + source = "../builder/data/etc/systemd/system/bettercap.service" + } + provisioner "shell" { + inline = ["chmod +x /usr/bin/*"] + } + provisioner "shell" { + inline = ["chmod +x /etc/update-motd.d/*"] + } + provisioner "shell" { + inline = ["apt-get -y --allow-releaseinfo-change update", "apt-get -y dist-upgrade", "apt-get install -y ansible"] + } + provisioner "ansible-local" { + command = "ANSIBLE_FORCE_COLOR=1 PYTHONUNBUFFERED=1 PWN_VERSION=${var.pwn_version} PWN_HOSTNAME=${var.pwn_hostname} ansible-playbook" + extra_arguments = ["--extra-vars \"ansible_python_interpreter=/usr/bin/python3\""] + playbook_file = "../builder/pwnagotchi.yml" + } +} diff --git a/builder/pwnagotchi.yml b/builder/pwnagotchi.yml index a9ece67a..25ec666c 100644 --- a/builder/pwnagotchi.yml +++ b/builder/pwnagotchi.yml @@ -65,7 +65,6 @@ - libraspberrypi-dev - libraspberrypi-doc - libraspberrypi-bin - - ansible install: - bluez - raspberrypi-kernel-headers From f4f04a9cc1ad9b94adef92eec3760b05f7abc1fe Mon Sep 17 00:00:00 2001 From: Jeroen Oudshoorn Date: Fri, 29 Sep 2023 10:16:39 +0200 Subject: [PATCH 12/12] v2.4.4 Signed-off-by: Jeroen Oudshoorn --- builder/pwnagotchi.json | 5 +++++ builder/pwnagotchi.json.pkr.hcl | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/builder/pwnagotchi.json b/builder/pwnagotchi.json index fff56357..554c1653 100644 --- a/builder/pwnagotchi.json +++ b/builder/pwnagotchi.json @@ -87,6 +87,11 @@ "chmod +x /usr/bin/*" ] }, + { + "type": "file", + "source": "../builder/data/etc/update-motd.d/01-motd", + "destination": "/etc/update-motd.d/01-motd", + }, { "type": "shell", "inline": [ diff --git a/builder/pwnagotchi.json.pkr.hcl b/builder/pwnagotchi.json.pkr.hcl index 5eadfcf4..25f123c6 100644 --- a/builder/pwnagotchi.json.pkr.hcl +++ b/builder/pwnagotchi.json.pkr.hcl @@ -103,6 +103,10 @@ build { provisioner "shell" { inline = ["chmod +x /usr/bin/*"] } + provisioner "file" { + destination = "/etc/update-motd.d/01-motd" + source = "../builder/data/etc/update-motd.d/01-motd" + } provisioner "shell" { inline = ["chmod +x /etc/update-motd.d/*"] }