Signed-off-by: Jeroen Oudshoorn <oudshoorn.jeroen@gmail.com>
This commit is contained in:
Jeroen Oudshoorn
2023-09-10 18:11:25 +02:00
parent 4d65fe1b49
commit c5c3464760
5 changed files with 167 additions and 48 deletions

2
.idea/misc.xml generated
View File

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

2
.idea/pwnagotchi.iml generated
View File

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

View File

@ -39,6 +39,10 @@
pwngrid: pwngrid:
# url: "https://github.com/evilsocket/pwngrid/releases/download/v1.10.3/pwngrid_linux_aarch64_v1.10.3.zip" # url: "https://github.com/evilsocket/pwngrid/releases/download/v1.10.3/pwngrid_linux_aarch64_v1.10.3.zip"
apt: apt:
downgrade:
- libpcap0.8-dev_1.9.1-_arm64.deb
- libpcap0.8_1.9.1-3_arm64.deb
- libpcap-dev_1.9.1-3_arm64.deb
hold: hold:
- libpcap-dev - libpcap-dev
- libpcap0.8 - libpcap0.8
@ -53,6 +57,7 @@
- libraspberrypi-dev - libraspberrypi-dev
- libraspberrypi-doc - libraspberrypi-doc
- libraspberrypi-bin - libraspberrypi-bin
- golang
install: install:
- bluez - bluez
- raspberrypi-kernel-headers - raspberrypi-kernel-headers
@ -158,6 +163,12 @@
line: 'ExecStart=/usr/lib/bluetooth/bluetoothd --noplugin=sap' line: 'ExecStart=/usr/lib/bluetooth/bluetoothd --noplugin=sap'
state: present state: present
- name: configure dphys-swapfile
lineinfile:
path: /etc/dphys-swapfile
regexp: "^CONF_SWAPSIZE=.*$"
line: "CONF_SWAPSIZE=2048"
- name: update apt package cache - name: update apt package cache
apt: apt:
update_cache: yes update_cache: yes
@ -175,11 +186,118 @@
name: "{{ packages.apt.install }}" name: "{{ packages.apt.install }}"
state: present state: present
- name: clone hannadiamond repository # Install nexmon to fix wireless scanning (takes 2.5G of space)
- name: clone nexmon repository
git: git:
repo: https://github.com/hannadiamond/pwnagotchi-plugins.git repo: https://github.com/DrSchottky/nexmon.git
dest: /usr/local/src/hannadiamond dest: /usr/local/src/nexmon
register: hannadiamondgit # version: bfb3fe90c881498d7ee245b38f16722c1de26fa1
register: nexmongit
- name: make firmware
shell: "source ./setup_env.sh && make"
args:
executable: /bin/bash
chdir: /usr/local/src/nexmon/
- 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"
- 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+"
- 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"
- name: make firmware patch (bcm43436b0)
shell: "source ./setup_env.sh && cd /usr/local/src/nexmon/patches/bcm43436b0/9_88_4_65/nexmon/ && make && make install-firmware"
args:
executable: /bin/bash
chdir: /usr/local/src/nexmon/
- 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"
- 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)
shell: "source ./setup_env.sh && cd /usr/local/src/nexmon/patches/bcm43430a1/7_45_41_46/nexmon/ && make && make install-firmware"
args:
executable: /bin/bash
chdir: /usr/local/src/nexmon/
- 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)
shell: "source ./setup_env.sh && cd /usr/local/src/nexmon/patches/bcm43455c0/7_45_206/nexmon/ && make && make install-firmware"
args:
executable: /bin/bash
chdir: /usr/local/src/nexmon/
- name: copy modified driver (everyone but RPiZW)
copy:
src: /lib/modules/6.1.21-v8+/kernel/drivers/net/wireless/broadcom/brcm80211/brcmfmac/brcmfmac.ko
dest: /lib/modules/6.1.21-v8+/kernel/drivers/net/wireless/broadcom/brcm80211/brcmfmac/brcmfmac.ko.orig
- name: copy modified driver (everyone but RPiZW)
copy:
src: /usr/local/src/nexmon/patches/driver/brcmfmac_6.1.y-nexmon/brcmfmac.ko
dest: /lib/modules/6.1.21-v8+/kernel/drivers/net/wireless/broadcom/brcm80211/brcmfmac/brcmfmac.ko
- name: ensure depmod runs on reboot to load modified driver (brcmfmac)
lineinfile:
dest: /etc/rc.local
line: "/sbin/depmod -a"
# 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 - name: Creates custom plugin directory
file: file:
@ -187,40 +305,6 @@
state: directory state: directory
when: hannadiamondgit.changed when: hannadiamondgit.changed
- name: Copy ups_hat_c.py
copy:
src: /usr/local/src/hannadiamond/plugins/ups_hat_c.py
dest: /usr/local/share/pwnagotchi/custom-plugins/ups_hat_c.py
owner: root
group: root
mode: '644'
- name: Delete hannadiamond content & directory
file:
state: absent
path: /usr/local/src/hannadiamond
when: hannadiamondgit.changed
- name: clone pisugar 2 git
git:
repo: https://github.com/PiSugar/pisugar2py.git
dest: /usr/local/lib/python3.9/dist-packages
- name: clone pisugar2 plugin
git:
repo: https://github.com/PiSugar/pwnagotchi-pisugar2-plugin.git
dest: /usr/local/share/pwnagotchi/custom-plugins/
- name: clone pisugar3 plugin
git:
repo: https://github.com/nullm0ose/pwnagotchi-plugin-pisugar3.git
dest: /usr/local/share/pwnagotchi/custom-plugins/
- name: clone pwnagotchi plugins repository
git:
repo: https://github.com/evilsocket/pwnagotchi-plugins-contrib.git
dest: /usr/local/share/pwnagotchi/custom-plugins
- name: collect python pip package list - name: collect python pip package list
command: "pip3 list" command: "pip3 list"
register: pip_output register: pip_output
@ -269,7 +353,7 @@
# Install go-1.20.6 # Install go-1.20.6
- name: Install go-1.21 - name: Install go-1.21
unarchive: unarchive:
src: https://go.dev/dl/go1.21.0.linux-arm64.tar.gz src: https://go.dev/dl/go1.21.1.linux-arm64.tar.gz
dest: /usr/local dest: /usr/local
remote_src: yes remote_src: yes
register: golang register: golang
@ -291,9 +375,9 @@
- name: install pwngrid - name: install pwngrid
shell: "export GOPATH=$HOME/go && export PATH=/usr/local/go/bin:$PATH:$GOPATH/bin && make && sudo make install" shell: "export GOPATH=$HOME/go && export PATH=/usr/local/go/bin:$PATH:$GOPATH/bin && make && sudo make install"
arsg: args:
executables: /bin/bash executables: /bin/bash
chdir: /usr/local/src/pwngrid chdir: /usr/local/src/pwngrid
when: pwngrid.changed when: pwngrid.changed
- name: Install bettercap v2.32.1 - name: Install bettercap v2.32.1
@ -426,6 +510,39 @@
You learn more about me at https://pwnagotchi.ai/ You learn more about me at https://pwnagotchi.ai/
when: hostname.changed when: hostname.changed
- 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:
deb: /usr/local/src/libpcap*
args: allow-downgrades
register: libpcap
- name: add firmware packages to hold
become_user: root
dpkg_selections:
name: "{{ item }}"
selection: hold
with_items: "{{ packages.apt.hold }}"
when: libpcap.changed
- name: clean apt cache - name: clean apt cache
become_user: root become_user: root
apt: apt:
@ -447,7 +564,7 @@
become_user: root become_user: root
file: file:
state: absent state: absent
path: "{{item}}" path: "{{ item }}"
with_fileglob: with_fileglob:
- "/etc/ssh/ssh_host*_key*" - "/etc/ssh/ssh_host*_key*"

View File

@ -1 +1 @@
__version__ = '2.3.6' __version__ = '2.3.7'

View File

@ -27,6 +27,7 @@ def check(version, repo, native=True):
resp = requests.get("https://api.github.com/repos/%s/releases/latest" % repo) resp = requests.get("https://api.github.com/repos/%s/releases/latest" % repo)
latest = resp.json() latest = resp.json()
info['available'] = latest_ver = latest['tag_name'].replace('v', '') info['available'] = latest_ver = latest['tag_name'].replace('v', '')
is_arm = info['arch'].startswith('arm')
local = version_to_tuple(info['current']) local = version_to_tuple(info['current'])
remote = version_to_tuple(latest_ver) remote = version_to_tuple(latest_ver)
@ -34,10 +35,11 @@ def check(version, repo, native=True):
if not native: if not native:
info['url'] = "https://github.com/%s/archive/%s.zip" % (repo, latest['tag_name']) info['url'] = "https://github.com/%s/archive/%s.zip" % (repo, latest['tag_name'])
else: else:
# check if this release is compatible with armv8+ # check if this release is compatible with arm6
for asset in latest['assets']: for asset in latest['assets']:
download_url = asset['browser_download_url'] download_url = asset['browser_download_url']
if download_url.endswith('.zip'): if download_url.endswith('.zip') and (
info['arch'] in download_url or (is_arm and 'armhf' in download_url)):
info['url'] = download_url info['url'] = download_url
break break
@ -182,7 +184,7 @@ class AutoUpdate(plugins.Plugin):
to_install = [] to_install = []
to_check = [ to_check = [
('jayofelony/bettercap', parse_version('bettercap -version'), True, 'bettercap'), ('jayofelony/bettercap', parse_version('bettercap -version'), True, 'bettercap'),
('jayofelony/pwngrid', parse_version('pwngrid -version'), True, 'pwngrid-peer'), ('rai68/opwngrid/', parse_version('pwngrid -version'), True, 'pwngrid-peer'),
('jayofelony/pwnagotchi', pwnagotchi.__version__, False, 'pwnagotchi') ('jayofelony/pwnagotchi', pwnagotchi.__version__, False, 'pwnagotchi')
] ]