mirror of
https://github.com/jayofelony/pwnagotchi.git
synced 2025-07-01 18:37:27 -04:00
Add files via upload
This commit is contained in:
12
Makefile
12
Makefile
@ -38,10 +38,10 @@ $(PWN_RELEASE).img: | $(PACKER)
|
|||||||
|
|
||||||
# If the packer or ansible files are updated, rebuild the image.
|
# 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)
|
$(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
|
# $(PACKER) plugins install github.com/mkaczanowski/builder-arm
|
||||||
cd builder && sudo $(UNSHARE) $(PACKER) build -var "pwn_hostname=$(PWN_HOSTNAME)" -var "pwn_version=$(PWN_VERSION)" pwnagotchi.json
|
cd builder/packer-builder-arm/packer-builder-arm && sudo $(UNSHARE) $(PACKER) build -var "pwn_hostname=$(PWN_HOSTNAME)" -var "pwn_version=$(PWN_VERSION)" ../../pwnagotchi.json
|
||||||
sudo chown -R $$USER:$$USER builder/output-pwnagotchi
|
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.
|
# If any of these files are updated, rebuild the checksums.
|
||||||
$(PWN_RELEASE).sha256: $(PWN_RELEASE).img
|
$(PWN_RELEASE).sha256: $(PWN_RELEASE).img
|
||||||
@ -57,6 +57,6 @@ image: $(PWN_RELEASE).zip
|
|||||||
clean:
|
clean:
|
||||||
- python3 setup.py clean --all
|
- python3 setup.py clean --all
|
||||||
- rm -rf dist pwnagotchi.egg-info
|
- rm -rf dist pwnagotchi.egg-info
|
||||||
- rm -f $(PACKER)
|
- rm -rf $(PACKER)
|
||||||
- rm -f $(PWN_RELEASE).*
|
- rm -rf $(PWN_RELEASE).*
|
||||||
- sudo rm -rf builder/output-pwnagotchi builder/packer_cache
|
- sudo rm -rf builder/output-pwnagotchi builder/packer_cache
|
||||||
|
@ -1,27 +1,65 @@
|
|||||||
{ "builders": [
|
{
|
||||||
|
"builders": [
|
||||||
{
|
{
|
||||||
"name": "pwnagotchi",
|
"name": "pwnagotchi",
|
||||||
"type": "arm-image",
|
"type": "arm",
|
||||||
"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",
|
"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",
|
||||||
"iso_checksum": "sha256:bf982e56b0374712d93e185780d121e3f5c3d5e33052a95f72f9aed468d58fa7",
|
"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",
|
||||||
"target_image_size": 9368709120,
|
"file_checksum_type": "sha256",
|
||||||
"qemu_args": [
|
"file_target_extension": "xz",
|
||||||
"-m 8G"
|
"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"]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"provisioners": [
|
"provisioners": [
|
||||||
|
{
|
||||||
|
"inline": ["mkdir -p /usr/local/src/pwnagotchi"],
|
||||||
|
"type": "shell"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"type": "file",
|
"type": "file",
|
||||||
"sources": [
|
"sources": [
|
||||||
"../dist/pwnagotchi-{{user `pwn_version`}}.tar.gz"
|
"../../../dist/pwnagotchi-{{user `pwn_version`}}.tar.gz"
|
||||||
],
|
],
|
||||||
"destination": "/usr/local/src/pwnagotchi/"
|
"destination": "/usr/local/src/pwnagotchi/"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"type": "shell",
|
||||||
|
"inline": [
|
||||||
|
"apt-get -y --allow-releaseinfo-change update",
|
||||||
|
"apt-get install -y --no-install-recommends ansible"
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"type": "ansible-local",
|
"type": "ansible-local",
|
||||||
"playbook_file": "pwnagotchi.yml",
|
"playbook_file": "../../../builder/pwnagotchi.yml",
|
||||||
"extra_arguments": [ "--extra-vars \"ansible_python_interpreter=/usr/bin/python3\"" ],
|
"extra_arguments": [
|
||||||
|
"--extra-vars \"ansible_python_interpreter=/usr/bin/python3\""
|
||||||
|
],
|
||||||
"command": "ANSIBLE_FORCE_COLOR=1 PYTHONUNBUFFERED=1 PWN_VERSION={{user `pwn_version`}} PWN_HOSTNAME={{user `pwn_hostname`}} ansible-playbook"
|
"command": "ANSIBLE_FORCE_COLOR=1 PYTHONUNBUFFERED=1 PWN_VERSION={{user `pwn_version`}} PWN_HOSTNAME={{user `pwn_hostname`}} ansible-playbook"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
---
|
---
|
||||||
- hosts:
|
- hosts:
|
||||||
- 127.0.0.1
|
- all
|
||||||
become: yes
|
become: true
|
||||||
vars:
|
vars:
|
||||||
pwnagotchi:
|
pwnagotchi:
|
||||||
hostname: "{{ lookup('env', 'PWN_HOSTNAME') | default('pwnagotchi', true) }}"
|
hostname: "{{ lookup('env', 'PWN_HOSTNAME') | default('pwnagotchi', true) }}"
|
||||||
@ -48,7 +48,6 @@
|
|||||||
- libpcap0.8-dev
|
- libpcap0.8-dev
|
||||||
remove:
|
remove:
|
||||||
- raspberrypi-net-mods
|
- raspberrypi-net-mods
|
||||||
- dhcpcd5
|
|
||||||
- triggerhappy
|
- triggerhappy
|
||||||
- wpa_supplicant
|
- wpa_supplicant
|
||||||
- nfs-common
|
- nfs-common
|
||||||
@ -138,8 +137,11 @@
|
|||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
- name: change hostname
|
- name: change hostname
|
||||||
hostname:
|
lineinfile:
|
||||||
name: "{{pwnagotchi.hostname}}"
|
dest: /etc/hostname
|
||||||
|
regexp: '^raspberrypi'
|
||||||
|
line: "{{pwnagotchi.hostname}}"
|
||||||
|
state: present
|
||||||
when: lookup('file', '/etc/hostname') == "raspberrypi"
|
when: lookup('file', '/etc/hostname') == "raspberrypi"
|
||||||
register: hostname
|
register: hostname
|
||||||
|
|
||||||
@ -163,25 +165,23 @@
|
|||||||
update_cache: yes
|
update_cache: yes
|
||||||
|
|
||||||
- name: remove unnecessary apt packages
|
- name: remove unnecessary apt packages
|
||||||
|
become_user: root
|
||||||
apt:
|
apt:
|
||||||
name: "{{ packages.apt.remove }}"
|
name: "{{ packages.apt.remove }}"
|
||||||
state: absent
|
state: absent
|
||||||
purge: yes
|
purge: yes
|
||||||
|
|
||||||
- name: upgrade apt distro
|
- name: upgrade apt distro
|
||||||
|
become_user: root
|
||||||
apt:
|
apt:
|
||||||
upgrade: dist
|
upgrade: dist
|
||||||
|
|
||||||
- name: install packages
|
- name: install packages
|
||||||
|
become_user: root
|
||||||
apt:
|
apt:
|
||||||
name: "{{ packages.apt.install }}"
|
name: "{{ packages.apt.install }}"
|
||||||
state: present
|
state: present
|
||||||
|
|
||||||
- name: configure dphys-swapfile
|
|
||||||
file:
|
|
||||||
path: /etc/dphys-swapfile
|
|
||||||
content: "CONF_SWAPSIZE=1024"
|
|
||||||
|
|
||||||
- name: clone papirus repository
|
- name: clone papirus repository
|
||||||
git:
|
git:
|
||||||
repo: https://github.com/repaper/gratis.git
|
repo: https://github.com/repaper/gratis.git
|
||||||
@ -335,18 +335,21 @@
|
|||||||
# Raspberry Pi Zero 2w (chipset 43436b0)
|
# Raspberry Pi Zero 2w (chipset 43436b0)
|
||||||
|
|
||||||
- name: make firmware patch (bcm43436b0)
|
- name: make firmware patch (bcm43436b0)
|
||||||
|
become_user: root
|
||||||
shell: "source ./setup_env.sh && cd /usr/local/src/nexmon/patches/bcm43436b0/9_88_4_65/nexmon/ && make"
|
shell: "source ./setup_env.sh && cd /usr/local/src/nexmon/patches/bcm43436b0/9_88_4_65/nexmon/ && make"
|
||||||
args:
|
args:
|
||||||
executable: /bin/bash
|
executable: /bin/bash
|
||||||
chdir: /usr/local/src/nexmon/
|
chdir: /usr/local/src/nexmon/
|
||||||
|
|
||||||
- name: backup original firmware
|
- name: backup original firmware
|
||||||
|
become_user: root
|
||||||
shell: "source ./setup_env.sh && cd /usr/local/src/nexmon/patches/bcm43436b0/9_88_4_65/nexmon/ && make backup-firmware"
|
shell: "source ./setup_env.sh && cd /usr/local/src/nexmon/patches/bcm43436b0/9_88_4_65/nexmon/ && make backup-firmware"
|
||||||
args:
|
args:
|
||||||
executable: /bin/bash
|
executable: /bin/bash
|
||||||
chdir: /usr/local/src/nexmon/
|
chdir: /usr/local/src/nexmon/
|
||||||
|
|
||||||
- name: install new firmware
|
- name: install new firmware
|
||||||
|
become_user: root
|
||||||
shell: "source ./setup_env.sh && cd /usr/local/src/nexmon/patches/bcm43436b0/9_88_4_65/nexmon/ && make install-firmware"
|
shell: "source ./setup_env.sh && cd /usr/local/src/nexmon/patches/bcm43436b0/9_88_4_65/nexmon/ && make install-firmware"
|
||||||
args:
|
args:
|
||||||
executable: /bin/bash
|
executable: /bin/bash
|
||||||
@ -355,18 +358,21 @@
|
|||||||
# Raspberry Pi zero 2w (chipset 43430a1)
|
# Raspberry Pi zero 2w (chipset 43430a1)
|
||||||
|
|
||||||
- name: make firmware patch (bcm43430a1)
|
- name: make firmware patch (bcm43430a1)
|
||||||
|
become_user: root
|
||||||
shell: "source ./setup_env.sh && cd /usr/local/src/nexmon/patches/bcm43430a1/7_45_41_46/nexmon/ && make"
|
shell: "source ./setup_env.sh && cd /usr/local/src/nexmon/patches/bcm43430a1/7_45_41_46/nexmon/ && make"
|
||||||
args:
|
args:
|
||||||
executable: /bin/bash
|
executable: /bin/bash
|
||||||
chdir: /usr/local/src/nexmon/
|
chdir: /usr/local/src/nexmon/
|
||||||
|
|
||||||
- name: backup original firmware
|
- name: backup original firmware
|
||||||
|
become_user: root
|
||||||
shell: "source ./setup_env.sh && cd /usr/local/src/nexmon/patches/bcm43430a1/7_45_41_46/nexmon/ && make backup-firmware"
|
shell: "source ./setup_env.sh && cd /usr/local/src/nexmon/patches/bcm43430a1/7_45_41_46/nexmon/ && make backup-firmware"
|
||||||
args:
|
args:
|
||||||
executable: /bin/bash
|
executable: /bin/bash
|
||||||
chdir: /usr/local/src/nexmon/
|
chdir: /usr/local/src/nexmon/
|
||||||
|
|
||||||
- name: install new firmware
|
- name: install new firmware
|
||||||
|
become_user: root
|
||||||
shell: "source ./setup_env.sh && cd /usr/local/src/nexmon/patches/bcm43430a1/7_45_41_46/nexmon/ && make install-firmware"
|
shell: "source ./setup_env.sh && cd /usr/local/src/nexmon/patches/bcm43430a1/7_45_41_46/nexmon/ && make install-firmware"
|
||||||
args:
|
args:
|
||||||
executable: /bin/bash
|
executable: /bin/bash
|
||||||
@ -375,29 +381,34 @@
|
|||||||
# Raspberry Pi 4
|
# Raspberry Pi 4
|
||||||
|
|
||||||
- name: make firmware patch (bcm43455c0)
|
- name: make firmware patch (bcm43455c0)
|
||||||
|
become_user: root
|
||||||
shell: "source ./setup_env.sh && cd /usr/local/src/nexmon/patches/bcm43455c0/7_45_206/nexmon/ && make"
|
shell: "source ./setup_env.sh && cd /usr/local/src/nexmon/patches/bcm43455c0/7_45_206/nexmon/ && make"
|
||||||
args:
|
args:
|
||||||
executable: /bin/bash
|
executable: /bin/bash
|
||||||
chdir: /usr/local/src/nexmon/
|
chdir: /usr/local/src/nexmon/
|
||||||
|
|
||||||
- name: backup original firmware
|
- name: backup original firmware
|
||||||
|
become_user: root
|
||||||
shell: "source ./setup_env.sh && cd /usr/local/src/nexmon/patches/bcm43455c0/7_45_206/nexmon/ && make backup-firmware"
|
shell: "source ./setup_env.sh && cd /usr/local/src/nexmon/patches/bcm43455c0/7_45_206/nexmon/ && make backup-firmware"
|
||||||
args:
|
args:
|
||||||
executable: /bin/bash
|
executable: /bin/bash
|
||||||
chdir: /usr/local/src/nexmon/
|
chdir: /usr/local/src/nexmon/
|
||||||
|
|
||||||
- name: install new firmware
|
- name: install new firmware
|
||||||
|
become_user: root
|
||||||
shell: "source ./setup_env.sh && cd /usr/local/src/nexmon/patches/bcm43455c0/7_45_206/nexmon/ && make install-firmware"
|
shell: "source ./setup_env.sh && cd /usr/local/src/nexmon/patches/bcm43455c0/7_45_206/nexmon/ && make install-firmware"
|
||||||
args:
|
args:
|
||||||
executable: /bin/bash
|
executable: /bin/bash
|
||||||
chdir: /usr/local/src/nexmon/
|
chdir: /usr/local/src/nexmon/
|
||||||
|
|
||||||
- name: copy modified driver
|
- name: copy modified driver
|
||||||
|
become_user: root
|
||||||
copy:
|
copy:
|
||||||
src: /usr/local/src/nexmon/patches/driver/brcmfmac_6.1.y-nexmon/brcmfmac.ko
|
src: /usr/local/src/nexmon/patches/driver/brcmfmac_6.1.y-nexmon/brcmfmac.ko
|
||||||
dest: "/lib/modules/{{ ansible_kernel }}/kernel/drivers/net/wireless/broadcom/brcm80211/brcmfmac/brcmfmac.ko"
|
dest: "/lib/modules/{{ ansible_kernel }}/kernel/drivers/net/wireless/broadcom/brcm80211/brcmfmac/brcmfmac.ko"
|
||||||
|
|
||||||
- name: "Update kernel modules"
|
- name: "Update kernel modules"
|
||||||
|
become_user: root
|
||||||
command: /sbin/depmod -a
|
command: /sbin/depmod -a
|
||||||
|
|
||||||
# To shrink the final image, remove the nexmon directory (takes 2.5G of space) post build and installation
|
# To shrink the final image, remove the nexmon directory (takes 2.5G of space) post build and installation
|
||||||
@ -429,16 +440,19 @@
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
- name: create /etc/pwnagotchi folder
|
- name: create /etc/pwnagotchi folder
|
||||||
|
become_user: root
|
||||||
file:
|
file:
|
||||||
path: /etc/pwnagotchi
|
path: /etc/pwnagotchi
|
||||||
state: directory
|
state: directory
|
||||||
|
|
||||||
- name: check if user configuration exists
|
- name: check if user configuration exists
|
||||||
|
become_user: root
|
||||||
stat:
|
stat:
|
||||||
path: /etc/pwnagotchi/config.toml
|
path: /etc/pwnagotchi/config.toml
|
||||||
register: user_config
|
register: user_config
|
||||||
|
|
||||||
- name: create /etc/pwnagotchi/config.toml
|
- name: create /etc/pwnagotchi/config.toml
|
||||||
|
become_user: root
|
||||||
copy:
|
copy:
|
||||||
dest: /etc/pwnagotchi/config.toml
|
dest: /etc/pwnagotchi/config.toml
|
||||||
content: |
|
content: |
|
||||||
@ -449,11 +463,13 @@
|
|||||||
when: not user_config.stat.exists
|
when: not user_config.stat.exists
|
||||||
|
|
||||||
- name: enable ssh on boot
|
- name: enable ssh on boot
|
||||||
|
become_user: root
|
||||||
file:
|
file:
|
||||||
path: /boot/ssh
|
path: /boot/ssh
|
||||||
state: touch
|
state: touch
|
||||||
|
|
||||||
- name: adjust /boot/config.txt
|
- name: adjust /boot/config.txt
|
||||||
|
become_user: root
|
||||||
lineinfile:
|
lineinfile:
|
||||||
dest: /boot/config.txt
|
dest: /boot/config.txt
|
||||||
insertafter: EOF
|
insertafter: EOF
|
||||||
@ -461,6 +477,7 @@
|
|||||||
with_items: "{{system.boot_options}}"
|
with_items: "{{system.boot_options}}"
|
||||||
|
|
||||||
- name: adjust /etc/modules
|
- name: adjust /etc/modules
|
||||||
|
become_user: root
|
||||||
lineinfile:
|
lineinfile:
|
||||||
dest: /etc/modules
|
dest: /etc/modules
|
||||||
insertafter: EOF
|
insertafter: EOF
|
||||||
@ -468,6 +485,7 @@
|
|||||||
with_items: "{{system.modules}}"
|
with_items: "{{system.modules}}"
|
||||||
|
|
||||||
- name: change root partition
|
- name: change root partition
|
||||||
|
become_user: root
|
||||||
replace:
|
replace:
|
||||||
dest: /boot/cmdline.txt
|
dest: /boot/cmdline.txt
|
||||||
backup: no
|
backup: no
|
||||||
@ -475,6 +493,7 @@
|
|||||||
replace: "root=/dev/mmcblk0p2"
|
replace: "root=/dev/mmcblk0p2"
|
||||||
|
|
||||||
- name: configure /boot/cmdline.txt
|
- name: configure /boot/cmdline.txt
|
||||||
|
become_user: root
|
||||||
lineinfile:
|
lineinfile:
|
||||||
path: /boot/cmdline.txt
|
path: /boot/cmdline.txt
|
||||||
backrefs: True
|
backrefs: True
|
||||||
@ -484,6 +503,7 @@
|
|||||||
line: '\1 modules-load=dwc2,g_ether'
|
line: '\1 modules-load=dwc2,g_ether'
|
||||||
|
|
||||||
- name: configure motd
|
- name: configure motd
|
||||||
|
become_user: root
|
||||||
copy:
|
copy:
|
||||||
dest: /etc/motd
|
dest: /etc/motd
|
||||||
content: |
|
content: |
|
||||||
@ -516,6 +536,7 @@
|
|||||||
when: hostname.changed
|
when: hostname.changed
|
||||||
|
|
||||||
- name: clean apt cache
|
- name: clean apt cache
|
||||||
|
become_user: root
|
||||||
apt:
|
apt:
|
||||||
autoclean: yes
|
autoclean: yes
|
||||||
|
|
||||||
@ -533,12 +554,14 @@
|
|||||||
- libpcap-dev_1.9.1-3_arm64.deb
|
- libpcap-dev_1.9.1-3_arm64.deb
|
||||||
|
|
||||||
- name: install old libpcap packages
|
- name: install old libpcap packages
|
||||||
|
become_user: root
|
||||||
apt:
|
apt:
|
||||||
deb: /usr/local/src/libpcap*
|
deb: /usr/local/src/libpcap*
|
||||||
args: allow-downgrades
|
args: allow-downgrades
|
||||||
register: libpcap
|
register: libpcap
|
||||||
|
|
||||||
- name: add firmware packages to hold
|
- name: add firmware packages to hold
|
||||||
|
become_user: root
|
||||||
dpkg_selections:
|
dpkg_selections:
|
||||||
name: "{{ item }}"
|
name: "{{ item }}"
|
||||||
selection: hold
|
selection: hold
|
||||||
@ -546,6 +569,7 @@
|
|||||||
when: libpcap.changed
|
when: libpcap.changed
|
||||||
|
|
||||||
- name: enable services
|
- name: enable services
|
||||||
|
become_user: root
|
||||||
systemd:
|
systemd:
|
||||||
name: "{{ item }}"
|
name: "{{ item }}"
|
||||||
state: started
|
state: started
|
||||||
@ -553,6 +577,7 @@
|
|||||||
with_items: "{{ services.enable }}"
|
with_items: "{{ services.enable }}"
|
||||||
|
|
||||||
- name: disable unecessary services
|
- name: disable unecessary services
|
||||||
|
become_user: root
|
||||||
systemd:
|
systemd:
|
||||||
name: "{{ item }}"
|
name: "{{ item }}"
|
||||||
state: stopped
|
state: stopped
|
||||||
@ -560,6 +585,7 @@
|
|||||||
with_items: "{{ services.disable }}"
|
with_items: "{{ services.disable }}"
|
||||||
|
|
||||||
- name: remove ssh keys
|
- name: remove ssh keys
|
||||||
|
become_user: root
|
||||||
file:
|
file:
|
||||||
state: absent
|
state: absent
|
||||||
path: "{{item}}"
|
path: "{{item}}"
|
||||||
@ -568,5 +594,6 @@
|
|||||||
|
|
||||||
handlers:
|
handlers:
|
||||||
- name: reload systemd services
|
- name: reload systemd services
|
||||||
|
become_user: root
|
||||||
systemd:
|
systemd:
|
||||||
daemon_reload: yes
|
daemon_reload: yes
|
||||||
|
Reference in New Issue
Block a user