2019-10-02 17:26:29 +01:00
|
|
|
---
|
|
|
|
- hosts:
|
2023-09-16 01:44:02 +02:00
|
|
|
- 127.0.0.1
|
|
|
|
gather_facts: true
|
2023-08-29 14:13:36 +02:00
|
|
|
become: true
|
2019-10-02 17:26:29 +01:00
|
|
|
vars:
|
2019-10-05 18:51:20 +02:00
|
|
|
pwnagotchi:
|
|
|
|
hostname: "{{ lookup('env', 'PWN_HOSTNAME') | default('pwnagotchi', true) }}"
|
2023-08-24 11:15:12 +02:00
|
|
|
version: "{{ lookup('env', 'PWN_VERSION') | default('pwnagotchi-torch', true) }}"
|
2019-10-05 18:51:20 +02:00
|
|
|
system:
|
|
|
|
boot_options:
|
|
|
|
- "dtoverlay=dwc2"
|
|
|
|
- "dtoverlay=spi1-3cs"
|
2019-10-21 16:38:53 +01:00
|
|
|
- "dtparam=spi=on"
|
|
|
|
- "dtparam=i2c_arm=on"
|
|
|
|
- "dtparam=i2c1=on"
|
2019-10-31 08:49:58 +01:00
|
|
|
- "gpu_mem=16"
|
2019-10-21 16:38:53 +01:00
|
|
|
modules:
|
|
|
|
- "i2c-dev"
|
2019-10-05 18:51:20 +02:00
|
|
|
services:
|
|
|
|
enable:
|
|
|
|
- dphys-swapfile.service
|
2019-10-08 13:33:11 +01:00
|
|
|
- pwnagotchi.service
|
|
|
|
- bettercap.service
|
2019-10-11 15:12:56 +02:00
|
|
|
- pwngrid-peer.service
|
2019-11-07 17:41:17 +01:00
|
|
|
- fstrim.timer
|
2019-10-05 18:51:20 +02:00
|
|
|
disable:
|
|
|
|
- apt-daily.timer
|
|
|
|
- apt-daily.service
|
|
|
|
- apt-daily-upgrade.timer
|
|
|
|
- apt-daily-upgrade.service
|
|
|
|
- bluetooth.service
|
|
|
|
- ifup@wlan0.service
|
|
|
|
packages:
|
2019-10-08 14:59:12 +01:00
|
|
|
bettercap:
|
2023-08-23 14:06:28 +02:00
|
|
|
# We will install bettercap from source
|
|
|
|
# url: "https://github.com/jayofelony/bettercap/releases/download/2.32.1/bettercap-2.32.1.zip"
|
2019-10-09 00:33:19 +01:00
|
|
|
ui: "https://github.com/bettercap/ui/releases/download/v1.3.0/ui.zip"
|
2019-10-11 15:12:56 +02:00
|
|
|
pwngrid:
|
2023-08-31 20:01:54 +02:00
|
|
|
# url: "https://github.com/evilsocket/pwngrid/releases/download/v1.10.3/pwngrid_linux_aarch64_v1.10.3.zip"
|
2019-10-05 18:51:20 +02:00
|
|
|
apt:
|
2023-09-10 18:11:25 +02:00
|
|
|
downgrade:
|
2023-09-24 14:56:29 +02:00
|
|
|
- libpcap0.8-dev_1.9.1-3_arm64.deb
|
2023-09-10 18:11:25 +02:00
|
|
|
- libpcap0.8_1.9.1-3_arm64.deb
|
|
|
|
- libpcap-dev_1.9.1-3_arm64.deb
|
2019-10-10 23:46:10 +01:00
|
|
|
hold:
|
2023-08-23 14:06:28 +02:00
|
|
|
- libpcap-dev
|
|
|
|
- libpcap0.8
|
|
|
|
- libpcap0.8-dev
|
2023-09-25 22:14:31 +02:00
|
|
|
- firmware-atheros
|
|
|
|
- firmware-brcm80211
|
|
|
|
- firmware-libertas
|
|
|
|
- firmware-misc-nonfree
|
|
|
|
- firmware-realtek
|
2019-10-05 18:51:20 +02:00
|
|
|
remove:
|
2019-12-31 14:54:38 +01:00
|
|
|
- raspberrypi-net-mods
|
2023-08-30 11:14:59 +02:00
|
|
|
- dhcpcd5
|
2019-10-05 18:51:20 +02:00
|
|
|
- triggerhappy
|
2023-08-31 09:09:43 +02:00
|
|
|
- wpasupplicant
|
2019-10-05 18:51:20 +02:00
|
|
|
- nfs-common
|
2023-07-19 11:41:20 +02:00
|
|
|
- libraspberrypi0
|
|
|
|
- libraspberrypi-dev
|
|
|
|
- libraspberrypi-doc
|
|
|
|
- libraspberrypi-bin
|
2023-09-10 18:11:25 +02:00
|
|
|
- golang
|
2019-10-05 18:51:20 +02:00
|
|
|
install:
|
2023-08-23 14:06:28 +02:00
|
|
|
- bluez
|
|
|
|
- raspberrypi-kernel-headers
|
|
|
|
- git
|
|
|
|
- libgmp3-dev
|
|
|
|
- gawk
|
|
|
|
- qpdf
|
|
|
|
- bison
|
|
|
|
- flex
|
|
|
|
- make
|
|
|
|
- autoconf
|
|
|
|
- libtool
|
|
|
|
- texinfo
|
|
|
|
- gcc-arm-none-eabi
|
|
|
|
- wl
|
|
|
|
- libfl-dev
|
|
|
|
- g++
|
|
|
|
- xxd
|
|
|
|
- aircrack-ng
|
|
|
|
- time
|
2020-01-18 09:29:28 +01:00
|
|
|
- rsync
|
2019-10-05 18:51:20 +02:00
|
|
|
- vim
|
2023-08-23 14:06:28 +02:00
|
|
|
- wget
|
2019-10-05 18:51:20 +02:00
|
|
|
- screen
|
|
|
|
- build-essential
|
2023-08-23 14:06:28 +02:00
|
|
|
- dkms
|
2019-10-05 18:51:20 +02:00
|
|
|
- python3-pip
|
2019-10-09 13:58:30 +02:00
|
|
|
- python3-smbus
|
2019-10-05 18:51:20 +02:00
|
|
|
- unzip
|
|
|
|
- libopenmpi-dev
|
|
|
|
- libatlas-base-dev
|
2023-08-23 14:06:28 +02:00
|
|
|
- libelf-dev
|
2019-10-05 18:51:20 +02:00
|
|
|
- libopenjp2-7
|
2019-10-08 13:33:11 +01:00
|
|
|
- libtiff5
|
2019-10-05 18:51:20 +02:00
|
|
|
- tcpdump
|
|
|
|
- lsof
|
|
|
|
- libgstreamer1.0-0
|
|
|
|
- libavcodec58
|
|
|
|
- libavformat58
|
|
|
|
- libswscale5
|
|
|
|
- libusb-1.0-0-dev
|
|
|
|
- libnetfilter-queue-dev
|
2019-10-08 13:33:11 +01:00
|
|
|
- libopenmpi3
|
2019-10-05 18:51:20 +02:00
|
|
|
- dphys-swapfile
|
2023-08-23 14:06:28 +02:00
|
|
|
- libdbus-1-dev
|
|
|
|
- libdbus-glib-1-dev
|
|
|
|
- liblapack-dev
|
|
|
|
- libhdf5-dev
|
|
|
|
- libc-ares-dev
|
|
|
|
- libeigen3-dev
|
2019-10-05 18:51:20 +02:00
|
|
|
- fonts-dejavu
|
|
|
|
- fonts-dejavu-core
|
|
|
|
- fonts-dejavu-extra
|
|
|
|
- python3-pil
|
2019-10-09 16:57:00 +01:00
|
|
|
- python3-smbus
|
|
|
|
- libfuse-dev
|
2023-08-23 14:06:28 +02:00
|
|
|
- libatlas-base-dev
|
|
|
|
- libopenblas-dev
|
|
|
|
- libblas-dev
|
2019-10-09 16:57:00 +01:00
|
|
|
- bc
|
2023-08-23 14:06:28 +02:00
|
|
|
- libgl1-mesa-glx
|
|
|
|
- libncursesw5-dev
|
|
|
|
- libssl-dev
|
|
|
|
- libsqlite3-dev
|
|
|
|
- tk-dev
|
|
|
|
- libgdbm-dev
|
|
|
|
- libc6-dev
|
|
|
|
- libbz2-dev
|
|
|
|
- libffi-dev
|
|
|
|
- zlib1g-dev
|
2019-10-09 16:57:00 +01:00
|
|
|
- fonts-freefont-ttf
|
2019-10-21 16:38:53 +01:00
|
|
|
- fbi
|
2023-08-23 14:06:28 +02:00
|
|
|
- python3-flask
|
|
|
|
- python3-flask-cors
|
|
|
|
- python3-flaskext.wtf
|
|
|
|
- build-essential
|
|
|
|
- libpcap-dev
|
|
|
|
- libusb-1.0-0-dev
|
|
|
|
- libnetfilter-queue-dev
|
2023-09-16 01:44:02 +02:00
|
|
|
environment:
|
|
|
|
ARCHFLAGS: "-arch armv8"
|
2019-10-05 18:51:20 +02:00
|
|
|
|
2019-10-02 17:26:29 +01:00
|
|
|
tasks:
|
2023-09-24 21:27:23 +02:00
|
|
|
- name: Create pi user
|
|
|
|
user:
|
|
|
|
name: pi
|
|
|
|
password: "{{ 'raspberry' | password_hash('sha512') }}"
|
|
|
|
shell: /bin/bash
|
|
|
|
update_password: on_create
|
2023-09-16 01:44:02 +02:00
|
|
|
|
2019-10-02 17:26:29 +01:00
|
|
|
- name: change hostname
|
2023-08-29 14:13:36 +02:00
|
|
|
lineinfile:
|
|
|
|
dest: /etc/hostname
|
|
|
|
regexp: '^raspberrypi'
|
|
|
|
line: "{{pwnagotchi.hostname}}"
|
|
|
|
state: present
|
2019-10-21 16:38:53 +01:00
|
|
|
when: lookup('file', '/etc/hostname') == "raspberrypi"
|
|
|
|
register: hostname
|
2019-10-02 17:26:29 +01:00
|
|
|
|
|
|
|
- name: add hostname to /etc/hosts
|
|
|
|
lineinfile:
|
|
|
|
dest: /etc/hosts
|
2019-10-21 16:38:53 +01:00
|
|
|
regexp: '^127\.0\.1\.1[ \t]+raspberrypi'
|
2019-10-21 17:58:00 +01:00
|
|
|
line: "127.0.1.1\t{{pwnagotchi.hostname}}"
|
2019-10-02 17:26:29 +01:00
|
|
|
state: present
|
2019-10-21 16:38:53 +01:00
|
|
|
when: hostname.changed
|
2019-10-02 17:26:29 +01:00
|
|
|
|
2019-10-21 18:41:36 +01:00
|
|
|
- name: disable sap plugin for bluetooth.service
|
|
|
|
lineinfile:
|
|
|
|
dest: /lib/systemd/system/bluetooth.service
|
|
|
|
regexp: '^ExecStart=/usr/lib/bluetooth/bluetoothd$'
|
|
|
|
line: 'ExecStart=/usr/lib/bluetooth/bluetoothd --noplugin=sap'
|
2019-10-02 17:26:29 +01:00
|
|
|
state: present
|
|
|
|
|
2023-09-10 18:11:25 +02:00
|
|
|
- name: configure dphys-swapfile
|
|
|
|
lineinfile:
|
|
|
|
path: /etc/dphys-swapfile
|
|
|
|
regexp: "^CONF_SWAPSIZE=.*$"
|
|
|
|
line: "CONF_SWAPSIZE=2048"
|
|
|
|
|
2019-10-02 17:26:29 +01:00
|
|
|
- name: update apt package cache
|
|
|
|
apt:
|
|
|
|
update_cache: yes
|
|
|
|
|
|
|
|
- name: install packages
|
2023-08-29 14:13:36 +02:00
|
|
|
become_user: root
|
2019-10-02 17:26:29 +01:00
|
|
|
apt:
|
2019-10-05 18:51:20 +02:00
|
|
|
name: "{{ packages.apt.install }}"
|
2019-10-02 17:26:29 +01:00
|
|
|
state: present
|
|
|
|
|
2023-09-10 18:11:25 +02:00
|
|
|
# Install nexmon to fix wireless scanning (takes 2.5G of space)
|
|
|
|
- name: clone nexmon repository
|
2023-08-31 17:11:22 +02:00
|
|
|
git:
|
2023-09-10 18:11:25 +02:00
|
|
|
repo: https://github.com/DrSchottky/nexmon.git
|
|
|
|
dest: /usr/local/src/nexmon
|
|
|
|
register: nexmongit
|
2023-08-31 17:11:22 +02:00
|
|
|
|
2023-09-10 18:11:25 +02:00
|
|
|
- name: make firmware
|
|
|
|
shell: "source ./setup_env.sh && make"
|
|
|
|
args:
|
|
|
|
executable: /bin/bash
|
|
|
|
chdir: /usr/local/src/nexmon/
|
2023-08-31 17:11:22 +02:00
|
|
|
|
2023-09-10 18:11:25 +02:00
|
|
|
- name: choose the right kernel version (bcm43436b0)
|
|
|
|
replace:
|
|
|
|
dest: /usr/local/src/nexmon/patches/bcm43436b0/9_88_4_65/nexmon/Makefile
|
|
|
|
backup: no
|
|
|
|
regexp: "KERNEL_VERSION = .*$"
|
|
|
|
replace: "KERNEL_VERSION = 6.1"
|
2023-08-31 17:11:22 +02:00
|
|
|
|
2023-09-10 18:11:25 +02:00
|
|
|
- name: choose the right kernel release (variable) (bcm43436b0)
|
|
|
|
lineinfile:
|
|
|
|
dest: /usr/local/src/nexmon/patches/bcm43436b0/9_88_4_65/nexmon/Makefile
|
|
|
|
insertafter: "DRIVER_FOLDER_NAME = .*$"
|
|
|
|
line: "KERNEL_RELEASE = 6.1.21-v8+"
|
2023-08-31 17:11:22 +02:00
|
|
|
|
2023-09-10 18:11:25 +02:00
|
|
|
- name: choose the right kernel release (replace string) (bcm43436b0)
|
|
|
|
replace:
|
|
|
|
dest: /usr/local/src/nexmon/patches/bcm43436b0/9_88_4_65/nexmon/Makefile
|
|
|
|
backup: no
|
|
|
|
regexp: "shell uname -r"
|
|
|
|
replace: "KERNEL_RELEASE"
|
2023-08-31 17:11:22 +02:00
|
|
|
|
2023-09-10 18:11:25 +02:00
|
|
|
- name: make firmware patch (bcm43436b0)
|
2023-09-22 07:50:11 +02:00
|
|
|
shell: "source ./setup_env.sh && cd /usr/local/src/nexmon/patches/bcm43436b0/9_88_4_65/nexmon/ && make"
|
2023-09-10 18:11:25 +02:00
|
|
|
args:
|
|
|
|
executable: /bin/bash
|
|
|
|
chdir: /usr/local/src/nexmon/
|
2023-08-31 17:11:22 +02:00
|
|
|
|
2023-09-22 07:50:11 +02:00
|
|
|
- name: install new firmware (bcm43436b0)
|
|
|
|
copy:
|
|
|
|
src: /usr/local/src/nexmon/patches/bcm43436b0/9_88_4_65/nexmon/brcmfmac43436-sdio.bin
|
2023-09-24 21:27:23 +02:00
|
|
|
dest: /usr/lib/firmware/brcm/brcmfmac43436-sdio.bin
|
2023-09-22 07:50:11 +02:00
|
|
|
|
|
|
|
|
2023-09-10 18:11:25 +02:00
|
|
|
- name: choose the right kernel version (bcm43430a1)
|
|
|
|
replace:
|
|
|
|
dest: /usr/local/src/nexmon/patches/bcm43430a1/7_45_41_46/nexmon/Makefile
|
|
|
|
backup: no
|
|
|
|
regexp: "KERNEL_VERSION = .*$"
|
|
|
|
replace: "KERNEL_VERSION = 6.1"
|
2023-08-31 17:11:22 +02:00
|
|
|
|
2023-09-10 18:11:25 +02:00
|
|
|
- name: choose the right kernel release (variable) (bcm43430a1)
|
|
|
|
lineinfile:
|
|
|
|
dest: /usr/local/src/nexmon/patches/bcm43430a1/7_45_41_46/nexmon/Makefile
|
|
|
|
insertafter: "DRIVER_FOLDER_NAME = .*$"
|
|
|
|
line: "KERNEL_RELEASE = 6.1.21-v8+"
|
|
|
|
|
|
|
|
- name: choose the right kernel release (replace string) (bcm43430a1)
|
|
|
|
replace:
|
|
|
|
dest: /usr/local/src/nexmon/patches/bcm43430a1/7_45_41_46/nexmon/Makefile
|
|
|
|
backup: no
|
|
|
|
regexp: "shell uname -r"
|
|
|
|
replace: "KERNEL_RELEASE"
|
|
|
|
|
|
|
|
- name: make firmware patch (bcm43430a1)
|
2023-09-22 07:50:11 +02:00
|
|
|
shell: "source ./setup_env.sh && cd /usr/local/src/nexmon/patches/bcm43430a1/7_45_41_46/nexmon/ && make"
|
2023-09-10 18:11:25 +02:00
|
|
|
args:
|
|
|
|
executable: /bin/bash
|
|
|
|
chdir: /usr/local/src/nexmon/
|
|
|
|
|
2023-09-22 07:50:11 +02:00
|
|
|
- name: install new firmware (bcm43430a1)
|
|
|
|
copy:
|
|
|
|
src: /usr/local/src/nexmon/patches/bcm43430a1/7_45_41_46/nexmon/brcmfmac43430-sdio.bin
|
2023-09-24 21:27:23 +02:00
|
|
|
dest: /usr/lib/firmware/brcm/brcmfmac43430-sdio.bin
|
|
|
|
|
2023-09-25 08:06:38 +02:00
|
|
|
- name: copy 43430-sdio as 43436s-sdio for the special 43430/1 /2
|
2023-09-24 21:27:23 +02:00
|
|
|
copy:
|
|
|
|
src: /usr/lib/firmware/brcm/brcmfmac43430-sdio.bin
|
|
|
|
dest: /usr/lib/firmware/brcm/brcmfmac43436s-sdio.bin
|
2023-09-22 07:50:11 +02:00
|
|
|
|
|
|
|
- name: Delete the firmware blob to avoid it crashing
|
|
|
|
file:
|
|
|
|
state: absent
|
2023-09-24 21:27:23 +02:00
|
|
|
path: /usr/lib/firmware/brcm/brcmfmac43430-sdio.clm_blob
|
2023-09-22 07:50:11 +02:00
|
|
|
|
|
|
|
- name: Delete the RPiZW firmware blob to avoid it crashing
|
|
|
|
file:
|
|
|
|
state: absent
|
2023-09-24 21:27:23 +02:00
|
|
|
path: /usr/lib/firmware/brcm/brcmfmac43430-sdio.raspberrypi,model-zero-w.clm_blob
|
2023-09-22 07:50:11 +02:00
|
|
|
|
|
|
|
- name: Delete the RPi3 firmware blob to avoid it crashing
|
|
|
|
file:
|
|
|
|
state: absent
|
2023-09-24 21:27:23 +02:00
|
|
|
path: /usr/lib/firmware/brcm/brcmfmac43430-sdio.raspberrypi,3-model-b.clm_blob
|
2023-09-22 07:50:11 +02:00
|
|
|
|
2023-09-10 18:11:25 +02:00
|
|
|
- name: choose the right kernel version (bcm43455c0)
|
|
|
|
replace:
|
|
|
|
dest: /usr/local/src/nexmon/patches/bcm43455c0/7_45_206/nexmon/Makefile
|
|
|
|
backup: no
|
|
|
|
regexp: "KERNEL_VERSION = .*$"
|
|
|
|
replace: "KERNEL_VERSION = 6.1"
|
|
|
|
|
|
|
|
- name: choose the right kernel release (variable) (bcm43455c0)
|
|
|
|
lineinfile:
|
|
|
|
dest: /usr/local/src/nexmon/patches/bcm43455c0/7_45_206/nexmon/Makefile
|
|
|
|
insertafter: "DRIVER_FOLDER_NAME = .*$"
|
|
|
|
line: "KERNEL_RELEASE = 6.1.21-v8+"
|
|
|
|
|
|
|
|
- name: choose the right kernel release (replace string) (bcm43455c0)
|
|
|
|
replace:
|
|
|
|
dest: /usr/local/src/nexmon/patches/bcm43455c0/7_45_206/nexmon/Makefile
|
|
|
|
backup: no
|
|
|
|
regexp: "shell uname -r"
|
|
|
|
replace: "KERNEL_RELEASE"
|
|
|
|
|
|
|
|
- name: make firmware patch (bcm43455c0)
|
2023-09-22 07:50:11 +02:00
|
|
|
shell: "source ./setup_env.sh && cd /usr/local/src/nexmon/patches/bcm43455c0/7_45_206/nexmon/ && make"
|
2023-09-10 18:11:25 +02:00
|
|
|
args:
|
|
|
|
executable: /bin/bash
|
|
|
|
chdir: /usr/local/src/nexmon/
|
|
|
|
|
2023-09-22 07:50:11 +02:00
|
|
|
- name: install new firmware (bcm43455c0)
|
|
|
|
copy:
|
|
|
|
src: /usr/local/src/nexmon/patches/bcm43455c0/7_45_206/nexmon/brcmfmac43455-sdio.bin
|
2023-09-24 21:27:23 +02:00
|
|
|
dest: /usr/lib/firmware/brcm/brcmfmac43455-sdio.bin
|
2023-09-22 07:50:11 +02:00
|
|
|
|
2023-09-24 21:27:23 +02:00
|
|
|
- name: backup original driver
|
2023-09-10 18:11:25 +02:00
|
|
|
copy:
|
2023-09-24 21:27:23 +02:00
|
|
|
src: /usr/lib/modules/6.1.21-v8+/kernel/drivers/net/wireless/broadcom/brcm80211/brcmfmac/brcmfmac.ko.xz
|
|
|
|
dest: /usr/lib/modules/6.1.21-v8+/kernel/drivers/net/wireless/broadcom/brcm80211/brcmfmac/brcmfmac.ko.xz.orig
|
2023-09-10 18:11:25 +02:00
|
|
|
|
2023-09-24 21:27:23 +02:00
|
|
|
- name: copy modified driver
|
2023-09-10 18:11:25 +02:00
|
|
|
copy:
|
|
|
|
src: /usr/local/src/nexmon/patches/driver/brcmfmac_6.1.y-nexmon/brcmfmac.ko
|
2023-09-24 21:27:23 +02:00
|
|
|
dest: /usr/lib/modules/6.1.21-v8+/kernel/drivers/net/wireless/broadcom/brcm80211/brcmfmac/brcmfmac.ko
|
2023-09-10 18:11:25 +02:00
|
|
|
|
2023-09-26 16:23:30 +02:00
|
|
|
- name: Add the brcmfmac module
|
2023-09-26 17:08:25 +02:00
|
|
|
community.general.modprobe:
|
2023-09-26 16:23:30 +02:00
|
|
|
name: brcmfmac
|
|
|
|
state: present
|
|
|
|
persistent: present
|
2023-09-25 22:12:40 +02:00
|
|
|
|
2023-09-10 18:11:25 +02:00
|
|
|
# To shrink the final image, remove the nexmon directory (takes 2.5G of space) post build and installation
|
|
|
|
- name: Delete nexmon content & directory
|
|
|
|
file:
|
|
|
|
state: absent
|
|
|
|
path: /usr/local/src/nexmon/
|
|
|
|
|
|
|
|
- name: Creates custom plugin directory
|
|
|
|
file:
|
|
|
|
path: /usr/local/share/pwnagotchi/custom-plugins/
|
|
|
|
state: directory
|
2023-08-23 14:06:28 +02:00
|
|
|
|
2023-09-24 00:28:55 +02:00
|
|
|
- name: clone pwnagotchi repository
|
|
|
|
git:
|
|
|
|
repo: https://github.com/jayofelony/pwnagotchi.git
|
|
|
|
dest: /usr/local/src/pwnagotchi
|
|
|
|
register: pwnagotchigit
|
|
|
|
|
|
|
|
- name: create /usr/local/share/pwnagotchi/ folder
|
|
|
|
file:
|
|
|
|
path: /usr/local/share/pwnagotchi/
|
|
|
|
state: directory
|
|
|
|
|
|
|
|
- name: build pwnagotchi wheel
|
|
|
|
command: "python3 setup.py sdist bdist_wheel"
|
|
|
|
args:
|
|
|
|
chdir: /usr/local/src/pwnagotchi
|
|
|
|
when: (pwnagotchigit.changed) or (pip_packages['pwnagotchi'] is undefined) or (pip_packages['pwnagotchi'] != pwnagotchi_version)
|
|
|
|
|
|
|
|
- name: install pwnagotchi wheel and dependencies
|
2019-10-08 13:33:11 +01:00
|
|
|
pip:
|
2023-09-24 00:28:55 +02:00
|
|
|
name: "{{ lookup('fileglob', '/usr/local/src/pwnagotchi/dist/pwnagotchi*.whl') }}"
|
|
|
|
extra_args: "--no-cache-dir"
|
|
|
|
when: (pwnagotchigit.changed) or (pip_packages['pwnagotchi'] is undefined) or (pip_packages['pwnagotchi'] != pwnagotchi_version)
|
2019-10-04 23:15:47 +01:00
|
|
|
|
2023-09-24 20:13:47 +02:00
|
|
|
- name: remove pwnagotchi folder
|
|
|
|
file:
|
|
|
|
state: absent
|
|
|
|
path: /usr/local/src/pwnagotchi
|
|
|
|
|
2023-08-23 14:06:28 +02:00
|
|
|
# Install go-1.20.6
|
|
|
|
- name: Install go-1.21
|
|
|
|
unarchive:
|
2023-09-10 18:11:25 +02:00
|
|
|
src: https://go.dev/dl/go1.21.1.linux-arm64.tar.gz
|
2023-08-23 14:06:28 +02:00
|
|
|
dest: /usr/local
|
|
|
|
remote_src: yes
|
|
|
|
register: golang
|
|
|
|
|
|
|
|
- name: Update .bashrc for go-1.21
|
|
|
|
blockinfile:
|
|
|
|
dest: /home/pi/.bashrc
|
|
|
|
state: present
|
|
|
|
block: |
|
|
|
|
export GOPATH=$HOME/go
|
|
|
|
export PATH=/usr/local/go/bin:$PATH:$GOPATH/bin
|
|
|
|
when: golang.changed
|
|
|
|
|
2023-09-24 00:43:14 +02:00
|
|
|
- name: download pwngrid 1.10.4
|
2023-08-31 20:01:54 +02:00
|
|
|
git:
|
|
|
|
repo: https://github.com/jayofelony/pwngrid.git
|
2023-09-24 00:28:55 +02:00
|
|
|
dest: /usr/local/src/pwngrid
|
2023-08-31 20:01:54 +02:00
|
|
|
register: pwngrid
|
|
|
|
|
2023-09-24 00:43:14 +02:00
|
|
|
- name: install pwngrid 1.10.4
|
2023-09-24 13:51:27 +02:00
|
|
|
shell: "export GOPATH=$HOME/go && export PATH=/usr/local/go/bin:$PATH:$GOPATH/bin && go mod tidy && make && make install"
|
2023-09-10 18:11:25 +02:00
|
|
|
args:
|
2023-09-24 09:01:35 +02:00
|
|
|
executable: /bin/bash
|
2023-09-10 18:11:25 +02:00
|
|
|
chdir: /usr/local/src/pwngrid
|
2023-08-31 20:01:54 +02:00
|
|
|
when: pwngrid.changed
|
|
|
|
|
2023-09-24 20:13:47 +02:00
|
|
|
- name: remove pwngrid folder
|
|
|
|
file:
|
|
|
|
state: absent
|
|
|
|
path: /usr/local/src/pwngrid
|
|
|
|
|
2023-09-24 00:43:14 +02:00
|
|
|
- name: download bettercap v2.32.1
|
|
|
|
git:
|
|
|
|
repo: https://github.com/jayofelony/bettercap.git
|
|
|
|
dest: /usr/local/src/bettercap
|
|
|
|
register: bettercap
|
|
|
|
|
2023-08-23 14:06:28 +02:00
|
|
|
- name: Install bettercap v2.32.1
|
2023-09-24 13:51:27 +02:00
|
|
|
shell: "export GOPATH=$HOME/go && export PATH=/usr/local/go/bin:$PATH:$GOPATH/bin && go mod tidy && make && make install"
|
2023-08-23 14:06:28 +02:00
|
|
|
args:
|
|
|
|
executable: /bin/bash
|
2023-09-24 00:43:14 +02:00
|
|
|
chdir: /usr/local/src/bettercap
|
|
|
|
when: bettercap.changed
|
2023-08-23 14:06:28 +02:00
|
|
|
|
2023-09-24 20:13:47 +02:00
|
|
|
- name: remove bettercap folder
|
|
|
|
file:
|
|
|
|
state: absent
|
|
|
|
path: /usr/local/src/bettercap
|
|
|
|
|
2019-10-02 17:26:29 +01:00
|
|
|
- name: clone bettercap caplets
|
|
|
|
git:
|
2023-08-26 00:54:31 +02:00
|
|
|
repo: https://github.com/jayofelony/caplets.git
|
2019-10-02 17:26:29 +01:00
|
|
|
dest: /tmp/caplets
|
2019-10-21 16:38:53 +01:00
|
|
|
register: capletsgit
|
2019-10-02 17:26:29 +01:00
|
|
|
|
2023-08-29 21:02:43 +02:00
|
|
|
- name: install bettercap caplets
|
|
|
|
make:
|
|
|
|
chdir: /tmp/caplets
|
|
|
|
target: install
|
|
|
|
when: capletsgit.changed
|
|
|
|
|
|
|
|
- name: download and install bettercap ui
|
|
|
|
unarchive:
|
|
|
|
src: "{{ packages.bettercap.ui }}"
|
|
|
|
dest: /usr/local/share/bettercap/
|
|
|
|
remote_src: yes
|
|
|
|
mode: 0755
|
|
|
|
|
2019-10-08 13:33:11 +01:00
|
|
|
- name: add HDMI powersave to rc.local
|
2019-10-02 17:26:29 +01:00
|
|
|
blockinfile:
|
|
|
|
path: /etc/rc.local
|
|
|
|
insertbefore: "exit 0"
|
|
|
|
block: |
|
2019-10-27 10:38:28 +02:00
|
|
|
if ! /opt/vc/bin/tvservice -s | egrep 'HDMI|DVI'; then
|
2019-10-02 17:26:29 +01:00
|
|
|
/opt/vc/bin/tvservice -o
|
|
|
|
fi
|
|
|
|
|
2019-10-10 23:46:10 +01:00
|
|
|
- name: create /etc/pwnagotchi folder
|
2023-08-29 14:13:36 +02:00
|
|
|
become_user: root
|
2019-10-10 23:46:10 +01:00
|
|
|
file:
|
|
|
|
path: /etc/pwnagotchi
|
|
|
|
state: directory
|
|
|
|
|
|
|
|
- name: check if user configuration exists
|
2023-08-29 14:13:36 +02:00
|
|
|
become_user: root
|
2019-10-10 23:46:10 +01:00
|
|
|
stat:
|
2020-04-14 21:53:17 +02:00
|
|
|
path: /etc/pwnagotchi/config.toml
|
2019-10-10 23:46:10 +01:00
|
|
|
register: user_config
|
|
|
|
|
2020-04-14 21:53:17 +02:00
|
|
|
- name: create /etc/pwnagotchi/config.toml
|
2023-08-29 14:13:36 +02:00
|
|
|
become_user: root
|
2019-10-10 23:46:10 +01:00
|
|
|
copy:
|
2020-04-14 21:53:17 +02:00
|
|
|
dest: /etc/pwnagotchi/config.toml
|
2019-10-10 23:46:10 +01:00
|
|
|
content: |
|
2020-04-14 21:53:17 +02:00
|
|
|
# Add your configuration overrides on this file any configuration changes done to default.toml will be lost!
|
2019-10-10 23:46:10 +01:00
|
|
|
# Example:
|
2020-04-14 21:53:17 +02:00
|
|
|
# ui.display.enabled = true
|
|
|
|
# ui.display.type = "waveshare_2"
|
2019-10-10 23:46:10 +01:00
|
|
|
when: not user_config.stat.exists
|
2019-10-05 23:23:31 +02:00
|
|
|
|
2019-10-02 17:26:29 +01:00
|
|
|
- name: enable ssh on boot
|
2023-08-29 14:13:36 +02:00
|
|
|
become_user: root
|
2019-10-02 17:26:29 +01:00
|
|
|
file:
|
|
|
|
path: /boot/ssh
|
|
|
|
state: touch
|
|
|
|
|
|
|
|
- name: adjust /boot/config.txt
|
2023-08-29 14:13:36 +02:00
|
|
|
become_user: root
|
2019-10-02 17:26:29 +01:00
|
|
|
lineinfile:
|
|
|
|
dest: /boot/config.txt
|
|
|
|
insertafter: EOF
|
|
|
|
line: '{{ item }}'
|
2019-10-10 23:46:10 +01:00
|
|
|
with_items: "{{system.boot_options}}"
|
2019-10-02 17:26:29 +01:00
|
|
|
|
2019-10-21 16:38:53 +01:00
|
|
|
- name: adjust /etc/modules
|
2023-08-29 14:13:36 +02:00
|
|
|
become_user: root
|
2019-10-21 16:38:53 +01:00
|
|
|
lineinfile:
|
|
|
|
dest: /etc/modules
|
|
|
|
insertafter: EOF
|
|
|
|
line: '{{ item }}'
|
|
|
|
with_items: "{{system.modules}}"
|
|
|
|
|
2019-10-02 17:26:29 +01:00
|
|
|
- name: change root partition
|
2023-08-29 14:13:36 +02:00
|
|
|
become_user: root
|
2019-10-02 17:26:29 +01:00
|
|
|
replace:
|
|
|
|
dest: /boot/cmdline.txt
|
|
|
|
backup: no
|
|
|
|
regexp: "root=PARTUUID=[a-zA-Z0-9\\-]+"
|
|
|
|
replace: "root=/dev/mmcblk0p2"
|
|
|
|
|
|
|
|
- name: configure /boot/cmdline.txt
|
2023-08-29 14:13:36 +02:00
|
|
|
become_user: root
|
2019-10-02 17:26:29 +01:00
|
|
|
lineinfile:
|
|
|
|
path: /boot/cmdline.txt
|
|
|
|
backrefs: True
|
|
|
|
state: present
|
|
|
|
backup: no
|
|
|
|
regexp: '(.*)$'
|
2019-10-05 20:42:42 +01:00
|
|
|
line: '\1 modules-load=dwc2,g_ether'
|
2019-10-02 17:26:29 +01:00
|
|
|
|
2023-09-20 09:02:37 +02:00
|
|
|
- name: configure 01-motd
|
2023-08-29 14:13:36 +02:00
|
|
|
become_user: root
|
2019-10-02 17:26:29 +01:00
|
|
|
copy:
|
2023-09-20 10:42:13 +02:00
|
|
|
dest: /etc/update-motd.d/01-motd
|
2019-10-11 12:51:57 +01:00
|
|
|
content: |
|
2023-09-20 10:42:13 +02:00
|
|
|
#!/bin/sh
|
|
|
|
_hostname=$(hostname)
|
|
|
|
_version=$(cut -d"'" -f2 < /usr/local/lib/python3.9/dist-packages/pwnagotchi/_version.py)
|
|
|
|
echo
|
|
|
|
echo "(◕‿‿◕) $_hostname"
|
|
|
|
echo
|
2023-09-24 15:52:18 +02:00
|
|
|
echo " Hi! I'm a pwnagotchi $_version, please take good care of me!"
|
|
|
|
echo " Here are some basic things you need to know to raise me properly!"
|
2023-09-20 10:42:13 +02:00
|
|
|
echo
|
2023-09-24 15:52:18 +02:00
|
|
|
echo " If you want to change my configuration, use /etc/pwnagotchi/config.toml"
|
2023-09-20 10:42:13 +02:00
|
|
|
echo
|
2023-09-24 15:52:18 +02:00
|
|
|
echo " All the configuration options can be found on /etc/pwnagotchi/default.toml,"
|
|
|
|
echo " but don't change this file because I will recreate it every time I'm restarted!"
|
2023-09-20 10:42:13 +02:00
|
|
|
echo
|
2023-09-24 15:52:18 +02:00
|
|
|
echo " I use oPwnGrid as my main API, you can check stats at https://opwngrid.xyz"
|
2023-09-20 10:42:13 +02:00
|
|
|
echo
|
2023-09-24 15:52:18 +02:00
|
|
|
echo " I'm managed by systemd. Here are some basic commands."
|
2023-09-20 10:42:13 +02:00
|
|
|
echo
|
2023-09-24 15:52:18 +02:00
|
|
|
echo " If you want to know what I'm doing, you can check my logs with the command"
|
|
|
|
echo " - pwnlog"
|
|
|
|
echo " - sudo pwnagotchi --version, to check the current version"
|
|
|
|
echo " - sudo pwnagotchi --donate, to see how you can donate to this project"
|
|
|
|
echo " - sudo pwnagotchi --check-update, to see if there is a new version available"
|
2023-09-20 10:42:13 +02:00
|
|
|
echo
|
2023-09-24 15:52:18 +02:00
|
|
|
echo " If you want to know if I'm running, you can use"
|
|
|
|
echo " systemctl status pwnagotchi"
|
2023-09-20 10:42:13 +02:00
|
|
|
echo
|
2023-09-24 15:52:18 +02:00
|
|
|
echo " You can restart me using"
|
|
|
|
echo " systemctl restart pwnagotchi"
|
2023-09-20 10:42:13 +02:00
|
|
|
echo
|
2023-09-24 15:52:18 +02:00
|
|
|
echo " You learn more about me at https://pwnagotchi.ai/"
|
2019-10-21 16:38:53 +01:00
|
|
|
when: hostname.changed
|
2019-10-02 17:26:29 +01:00
|
|
|
|
2023-09-10 18:11:25 +02:00
|
|
|
- name: Add pwnlog alias
|
|
|
|
lineinfile:
|
|
|
|
dest: /home/pi/.bashrc
|
|
|
|
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
|
|
|
|
lineinfile:
|
|
|
|
dest: /home/pi/.bashrc
|
|
|
|
line: "\nalias pwnver='python3 -c \"import pwnagotchi as p; print(p.__version__)\"'"
|
|
|
|
insertafter: EOF
|
|
|
|
|
|
|
|
- name: download old libpcap packages
|
|
|
|
get_url:
|
|
|
|
url: "http://ports.ubuntu.com/pool/main/libp/libpcap/{{ item }}"
|
|
|
|
dest: /usr/local/src/
|
|
|
|
with_items: "{{ packages.apt.downgrade }}"
|
|
|
|
|
|
|
|
- name: install old libpcap packages
|
|
|
|
become_user: root
|
|
|
|
apt:
|
2023-09-24 16:05:41 +02:00
|
|
|
force: True
|
|
|
|
state: present
|
|
|
|
deb: "/usr/local/src/{{ item }}"
|
|
|
|
with_items: "{{ packages.apt.downgrade }}"
|
2023-09-10 18:11:25 +02:00
|
|
|
register: libpcap
|
|
|
|
|
2023-09-24 20:13:47 +02:00
|
|
|
- name: remove old libpcap files
|
|
|
|
become_user: root
|
|
|
|
file:
|
|
|
|
path: "/usr/local/src/{{ item }}"
|
|
|
|
state: absent
|
|
|
|
with_items: "{{ packages.apt.downgrade }}"
|
|
|
|
|
2023-09-10 18:11:25 +02:00
|
|
|
- name: add firmware packages to hold
|
|
|
|
become_user: root
|
|
|
|
dpkg_selections:
|
|
|
|
name: "{{ item }}"
|
|
|
|
selection: hold
|
|
|
|
with_items: "{{ packages.apt.hold }}"
|
|
|
|
when: libpcap.changed
|
|
|
|
|
2023-09-24 20:13:47 +02:00
|
|
|
- name: disable unnecessary services
|
2023-08-29 14:13:36 +02:00
|
|
|
become_user: root
|
2019-10-05 18:51:20 +02:00
|
|
|
systemd:
|
2019-10-08 13:33:11 +01:00
|
|
|
name: "{{ item }}"
|
2019-10-05 18:51:20 +02:00
|
|
|
state: stopped
|
|
|
|
enabled: no
|
2019-10-08 13:33:11 +01:00
|
|
|
with_items: "{{ services.disable }}"
|
2019-10-05 18:51:20 +02:00
|
|
|
|
2023-09-24 20:13:47 +02:00
|
|
|
- name: enable services
|
|
|
|
become_user: root
|
|
|
|
systemd:
|
|
|
|
name: "{{ item }}"
|
|
|
|
enabled: true
|
|
|
|
state: stopped
|
|
|
|
with_items: "{{ services.enable }}"
|
|
|
|
|
2019-10-02 17:26:29 +01:00
|
|
|
- name: remove ssh keys
|
2023-08-29 14:13:36 +02:00
|
|
|
become_user: root
|
2019-10-02 17:26:29 +01:00
|
|
|
file:
|
|
|
|
state: absent
|
2023-09-10 18:11:25 +02:00
|
|
|
path: "{{ item }}"
|
2019-10-05 18:51:20 +02:00
|
|
|
with_fileglob:
|
|
|
|
- "/etc/ssh/ssh_host*_key*"
|
2023-09-26 16:26:10 +02:00
|
|
|
|
|
|
|
- name: remove unnecessary apt packages
|
|
|
|
become_user: root
|
|
|
|
apt:
|
|
|
|
name: "{{ packages.apt.remove }}"
|
|
|
|
state: absent
|
|
|
|
purge: yes
|
|
|
|
|
|
|
|
- name: clean apt cache
|
|
|
|
become_user: root
|
|
|
|
apt:
|
|
|
|
autoclean: true
|
|
|
|
|
|
|
|
- name: remove dependencies that are no longer required
|
|
|
|
become_user: root
|
|
|
|
apt:
|
2023-09-26 17:08:25 +02:00
|
|
|
autoremove: yes
|
|
|
|
|
|
|
|
handlers:
|
|
|
|
- name: reload systemd services
|
|
|
|
become_user: root
|
|
|
|
systemd:
|
|
|
|
daemon_reload: yes
|