Fixing Makefile and ansible playbook

Signed-off-by: Jeroen Oudshoorn <oudshoorn.jeroen@gmail.com>

Signed-off-by: Jeroen Oudshoorn <oudshoorn.jeroen@gmail.com>
This commit is contained in:
Jeroen Oudshoorn
2023-08-26 00:54:31 +02:00
parent 3b82839936
commit 560894604c
5 changed files with 48 additions and 52 deletions

View File

@ -92,6 +92,7 @@ def do_auto_mode(agent):
else:
logging.exception("main loop exception (%s)", e)
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser = plugins_cmd.add_parsers(parser)
@ -119,7 +120,6 @@ if __name__ == '__main__':
args = parser.parse_args()
if plugins_cmd.used_plugin_cmd(args):
config = utils.load_config(args)
log.setup_logging(args, config)

View File

@ -3,7 +3,8 @@
"name": "pwnagotchi",
"type": "arm-image",
"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",
"iso_checksum": "sha256:bf982e56b0374712d93e185780d121e3f5c3d5e33052a95f72f9aed468d58fa7"
"iso_checksum": "sha256:bf982e56b0374712d93e185780d121e3f5c3d5e33052a95f72f9aed468d58fa7",
"target_image_size": 9368709120
}
],
"provisioners": [

View File

@ -137,21 +137,6 @@
- libnetfilter-queue-dev
tasks:
- name: download old libpcap packages
get_url:
url: "http://ports.ubuntu.com/pool/main/libp/libpcap/{{ item }}"
dest: /usr/local/src/
with_items:
- libpcap0.8-dev_1.9.1-_arm64.deb
- libpcap0.8_1.9.1-3_arm64.deb
- libpcap-dev_1.9.1-3_arm64.deb
- name: install old libpcap packages
apt:
deb: /usr/local/src/libpcap*
args: allow-downgrades
register: libpcap
- name: change hostname
hostname:
name: "{{pwnagotchi.hostname}}"
@ -173,13 +158,6 @@
line: 'ExecStart=/usr/lib/bluetooth/bluetoothd --noplugin=sap'
state: present
- name: add firmware packages to hold
dpkg_selections:
name: "{{ item }}"
selection: hold
with_items: "{{ packages.apt.hold }}"
when: libpcap.changed
- name: update apt package cache
apt:
update_cache: yes
@ -202,7 +180,7 @@
- name: configure dphys-swapfile
file:
path: /etc/dphys-swapfile
content: "CONF_SWAPSIZE=2048"
content: "CONF_SWAPSIZE=1024"
- name: clone papirus repository
git:
@ -337,7 +315,7 @@
- name: clone bettercap caplets
git:
repo: https://github.com/bettercap/caplets.git
repo: https://github.com/jayofelony/caplets.git
dest: /tmp/caplets
register: capletsgit
@ -414,19 +392,13 @@
executable: /bin/bash
chdir: /usr/local/src/nexmon/
- name: choose kernel
shell: "uname -r"
register: kernel
- name: copy modified driver
copy:
src: /usr/local/src/nexmon/patches/driver/brcmfmac_6.1.y-nexmon/brcmfmac.ko
dest: "/lib/modules/{{ kernel.stdout }}/kernel/drivers/net/wireless/broadcom/brcm80211/brcmfmac/brcmfmac.ko"
dest: "/lib/modules/{{ ansible_kernel }}/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"
- name: "Update kernel modules"
command: /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
@ -551,6 +523,28 @@
apt:
autoremove: yes
- name: download old libpcap packages
get_url:
url: "http://ports.ubuntu.com/pool/main/libp/libpcap/{{ item }}"
dest: /usr/local/src/
with_items:
- libpcap0.8-dev_1.9.1-_arm64.deb
- libpcap0.8_1.9.1-3_arm64.deb
- libpcap-dev_1.9.1-3_arm64.deb
- name: install old libpcap packages
apt:
deb: /usr/local/src/libpcap*
args: allow-downgrades
register: libpcap
- name: add firmware packages to hold
dpkg_selections:
name: "{{ item }}"
selection: hold
with_items: "{{ packages.apt.hold }}"
when: libpcap.changed
- name: enable services
systemd:
name: "{{ item }}"

View File

@ -2,11 +2,12 @@ main.name = ""
main.lang = "en"
main.confd = "/etc/pwnagotchi/conf.d/"
main.custom_plugin_repos = [
"https://github.com/evilsocket/pwnagotchi-plugins-contrib/archive/master.zip"
"https://github.com/evilsocket/pwnagotchi-plugins-contrib/archive/master.zip",
"https://github.com/PwnPeter/pwnagotchi-plugins/archive/master.zip",
]
main.custom_plugins = "/usr/local/share/pwnagotchi/custom-plugins/"
main.fix_brcmf_plugin.enabled = true
main.plugins.fix_brcmf_plugin.enabled = true
main.iface = "wlan0mon"
main.mon_start_cmd = "/usr/bin/monstart"
@ -29,7 +30,7 @@ main.plugins.grid.exclude = [
main.plugins.auto-update.enabled = false
main.plugins.auto-update.install = false
main.plugins.auto-update.interval = 1
main.plugins.auto-update.interval = 24
main.plugins.net-pos.enabled = false
main.plugins.net-pos.api_key = "test"
@ -95,7 +96,7 @@ main.plugins.bt-tether.devices.ios-phone.max_tries = 0
main.plugins.bt-tether.devices.ios-phone.share_internet = false
main.plugins.bt-tether.devices.ios-phone.priority = 999
main.plugins.memtemp.enabled = true
main.plugins.memtemp.enabled = false
main.plugins.memtemp.scale = "celsius"
main.plugins.memtemp.orientation = "horizontal"
@ -145,7 +146,7 @@ main.log.path = "/var/log/pwnagotchi.log"
main.log.rotation.enabled = true
main.log.rotation.size = "10M"
main.plugins.age.enabled = true
main.plugins.age.enabled = false
main.plugins.age.age_x_coord = 0
main.plugins.age.age_y_coord = 32
main.plugins.age.str_x_coord = 67
@ -165,7 +166,7 @@ ai.params.learning_rate = 0.001
ai.params.verbose = 1
personality.advertise = true
personality.deauth = false
personality.deauth = true
personality.associate = true
personality.channels = []
personality.min_rssi = -200

View File

@ -67,7 +67,7 @@ class Fix_BRCMF(plugins.Plugin):
try:
self._tryTurningItOffAndOnAgain(agent)
except Exception as err:
logging.warning("[FixBRCMF turnOffAndfOn] %s" % repr(err))
logging.warning("[FixBRCMF turnOffAndOn] %s" % repr(err))
else:
logging.info("[FixBRCMF] Logs look good, too:\n%s" % last_lines)
self._status = ""
@ -262,29 +262,29 @@ class Fix_BRCMF(plugins.Plugin):
# success! now make the mon0
try:
cmd_output = subprocess.check_output(
"sudo iw phy \"$(iw phy | head -1 | cut -d' ' -f2)\" interface add mon0 type monitor && sudo ifconfig mon0 up",
"airmon-ng start wlan0",
shell=True)
self.logPrintView("info",
"[FixBRCMF interface add mon0] worked #%d: %s" % (tries, cmd_output))
"[FixBRCMF interface add wlan0mon] worked #%d: %s" % (tries, cmd_output))
self._status = "up"
time.sleep(tries + 5)
try:
# try accessing mon0 in bettercap
result = connection.run("set wifi.interface mon0")
result = connection.run("set wifi.interface wlan0mon")
if "success" in result:
logging.info("[FixBRCMF set wifi.interface mon0] worked: %s" % repr(result))
logging.info("[FixBRCMF set wifi.interface wlan0mon] worked: %s" % repr(result))
self._status = ""
self._count = self._count + 1
time.sleep(1)
# stop looping and get back to recon
break
else:
logging.info("[FixBRCMF set wifi.interfaceface mon0] failed? %s" % repr(result))
logging.info("[FixBRCMF set wifi.interfaceface wlan0mon] failed? %s" % repr(result))
except Exception as err:
logging.info(
"[FixBRCMF set wifi.interface mon0] except: %s" % (repr(result), repr(err)))
"[FixBRCMF set wifi.interface wlan0mon] except: %s" % (repr(result), repr(err)))
except Exception as cerr: #
if not display: print("failed loading mon0 attempt #%d: %s" % (tries, repr(cerr)))
if not display: print("failed loading wlan0mon attempt #%d: %s" % (tries, repr(cerr)))
except Exception as err: # from modprobe
if not display: print("Failed reloading brcmfmac")
logging.error("[FixBRCMF] Failed reloading brcmfmac %s" % repr(err))
@ -308,7 +308,7 @@ class Fix_BRCMF(plugins.Plugin):
"face": faces.INTENSE})
else:
print("And back on again...")
logging.info("[FixBRCMF] mon0 back up")
logging.info("[FixBRCMF] wlan0mon back up")
else:
self.LASTTRY = time.time()
@ -369,13 +369,13 @@ class Fix_BRCMF(plugins.Plugin):
# run from command line to brute force a reload
if __name__ == "__main__":
print("Performing brcmfmac reload and restart mon0 in 5 seconds...")
print("Performing brcmfmac reload and restart wlan0mon in 5 seconds...")
fb = Fix_BRCMF()
data = {'Message': "kernel: brcmfmac: brcmf_cfg80211_nexmon_set_channel: Set Channel failed: chspec=1234"}
event = {'data': data}
agent = Client('localhost', port=8081, username="pwnagotchi", password="pwnagotchi");
agent = Client('localhost', port=8081, username="pwnagotchi", password="pwnagotchi")
time.sleep(2)
print("3 seconds")