reboot if reload fails

This commit is contained in:
dadav 2020-04-18 11:17:46 +02:00
parent 2dee3987d4
commit 1be17b1f99
3 changed files with 12 additions and 4 deletions
builder/data/usr/bin
pwnagotchi/plugins/default

@ -11,7 +11,10 @@ fi
# check if wifi driver is bugged # check if wifi driver is bugged
if ! check_brcm; then if ! check_brcm; then
reload_brcm if ! reload_brcm; then
echo "Could not reload wifi driver. Reboot"
reboot
fi
sleep 10 sleep 10
fi fi

@ -22,8 +22,13 @@ check_brcm() {
# reload mod # reload mod
reload_brcm() { reload_brcm() {
rmmod brcmfmac if ! modprobe -r brcmfmac; then
modprobe brcmfmac return 1
fi
if ! modprobe brcmfmac; then
return 1
fi
return 0
} }
# starts mon0 # starts mon0

@ -28,7 +28,7 @@ class Watchdog(plugins.Plugin):
stdout=subprocess.PIPE).stdout))[-10:]) stdout=subprocess.PIPE).stdout))[-10:])
if len(self.pattern.findall(last_lines)) >= 3: if len(self.pattern.findall(last_lines)) >= 3:
display = agent.view() display = agent.view()
display.set('status', 'Blind-Bug detected. Restarting bettercap.') display.set('status', 'Blind-Bug detected. Restarting.')
display.update(force=True) display.update(force=True)
logging.info('[WATCHDOG] Blind-Bug detected. Restarting.') logging.info('[WATCHDOG] Blind-Bug detected. Restarting.')
mode = 'MANU' if agent.mode == 'manual' else 'AUTO' mode = 'MANU' if agent.mode == 'manual' else 'AUTO'