From 7d2a03c79f5686f1b46b969e6aeb164c7541d9e7 Mon Sep 17 00:00:00 2001 From: Jeroen Oudshoorn Date: Tue, 23 Jan 2024 11:13:23 +0100 Subject: [PATCH] Changing behaviour when mon_max_blind_epochs is hit, from full reboot to simple restart to save uptime. --- pwnagotchi/agent.py | 4 ++++ pwnagotchi/automata.py | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/pwnagotchi/agent.py b/pwnagotchi/agent.py index 28d9bec4..af9227c4 100644 --- a/pwnagotchi/agent.py +++ b/pwnagotchi/agent.py @@ -277,6 +277,10 @@ class Agent(Client, Automata, AsyncAdvertiser, AsyncTrainer): self._save_recovery_data() pwnagotchi.reboot() + def _restart(self): + self._save_recovery_data() + pwnagotchi.restart("AUTO") + def _save_recovery_data(self): logging.warning("writing recovery data to %s ...", RECOVERY_DATA_FILE) with open(RECOVERY_DATA_FILE, 'w') as fp: diff --git a/pwnagotchi/automata.py b/pwnagotchi/automata.py index 25d112a6..9b7f9c8e 100644 --- a/pwnagotchi/automata.py +++ b/pwnagotchi/automata.py @@ -138,6 +138,6 @@ class Automata(object): plugins.on('epoch', self, self._epoch.epoch - 1, self._epoch.data()) if self._epoch.blind_for >= self._config['main']['mon_max_blind_epochs']: - logging.critical("%d epochs without visible access points -> rebooting ...", self._epoch.blind_for) - self._reboot() + logging.critical("%d epochs without visible access points -> restarting ...", self._epoch.blind_for) + self._restart() self._epoch.blind_for = 0