From 1be17b1f99b8f0e8e2da6dc56fed29d897ee7d09 Mon Sep 17 00:00:00 2001 From: dadav <33197631+dadav@users.noreply.github.com> Date: Sat, 18 Apr 2020 11:17:46 +0200 Subject: [PATCH] reboot if reload fails --- builder/data/usr/bin/bettercap-launcher | 5 ++++- builder/data/usr/bin/pwnlib | 9 +++++++-- pwnagotchi/plugins/default/watchdog.py | 2 +- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/builder/data/usr/bin/bettercap-launcher b/builder/data/usr/bin/bettercap-launcher index d2dec50..3bc2185 100755 --- a/builder/data/usr/bin/bettercap-launcher +++ b/builder/data/usr/bin/bettercap-launcher @@ -11,7 +11,10 @@ fi # check if wifi driver is bugged if ! check_brcm; then - reload_brcm + if ! reload_brcm; then + echo "Could not reload wifi driver. Reboot" + reboot + fi sleep 10 fi diff --git a/builder/data/usr/bin/pwnlib b/builder/data/usr/bin/pwnlib index 878b4c1..bc29171 100755 --- a/builder/data/usr/bin/pwnlib +++ b/builder/data/usr/bin/pwnlib @@ -22,8 +22,13 @@ check_brcm() { # reload mod reload_brcm() { - rmmod brcmfmac - modprobe brcmfmac + if ! modprobe -r brcmfmac; then + return 1 + fi + if ! modprobe brcmfmac; then + return 1 + fi + return 0 } # starts mon0 diff --git a/pwnagotchi/plugins/default/watchdog.py b/pwnagotchi/plugins/default/watchdog.py index db77248..06aef5f 100644 --- a/pwnagotchi/plugins/default/watchdog.py +++ b/pwnagotchi/plugins/default/watchdog.py @@ -28,7 +28,7 @@ class Watchdog(plugins.Plugin): stdout=subprocess.PIPE).stdout))[-10:]) if len(self.pattern.findall(last_lines)) >= 3: display = agent.view() - display.set('status', 'Blind-Bug detected. Restarting bettercap.') + display.set('status', 'Blind-Bug detected. Restarting.') display.update(force=True) logging.info('[WATCHDOG] Blind-Bug detected. Restarting.') mode = 'MANU' if agent.mode == 'manual' else 'AUTO'