Signed-off-by: Jeroen Oudshoorn <oudshoorn.jeroen@gmail.com>
This commit is contained in:
Jeroen Oudshoorn
2023-09-29 11:45:57 +02:00
7 changed files with 132 additions and 8 deletions

View File

@ -1,5 +1,6 @@
<component name="InspectionProjectProfileManager">
<settings>
<option name="PROJECT_PROFILE" value="Default" />
<option name="USE_PROJECT_PROFILE" value="false" />
<version value="1.0" />
</settings>

2
.idea/misc.xml generated
View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.10" project-jdk-type="Python SDK" />
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.10 (pwnagotchi)" project-jdk-type="Python SDK" />
</project>

2
.idea/pwnagotchi.iml generated
View File

@ -4,7 +4,7 @@
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/venv" />
</content>
<orderEntry type="jdk" jdkName="Python 3.10" jdkType="Python SDK" />
<orderEntry type="jdk" jdkName="Python 3.10 (pwnagotchi)" jdkType="Python SDK" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
<component name="PyDocumentationSettings">

View File

@ -54,8 +54,6 @@ $(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
mv builder/images/* ../../../
# If any of these files are updated, rebuild the checksums.
$(PWN_RELEASE).sha256: $(PWN_RELEASE).img

View File

@ -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": [
@ -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": [

View File

@ -0,0 +1,121 @@
# 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 "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/*"]
}
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"
}
}

View File

@ -65,7 +65,6 @@
- libraspberrypi-dev
- libraspberrypi-doc
- libraspberrypi-bin
- ansible
install:
- bluez
- raspberrypi-kernel-headers
@ -146,7 +145,7 @@
- libusb-1.0-0-dev
- libnetfilter-queue-dev
environment:
ARCHFLAGS: "-arch armv8"
ARCHFLAGS: "-arch arm64"
tasks:
- name: Create pi user
@ -154,7 +153,7 @@
name: pi
password: "{{ 'raspberry' | password_hash('sha512') }}"
shell: /bin/bash
update_password: on_create
generate_ssh_key: true
- name: change hostname
lineinfile: