fix(fix_services): merge duplicate pattern handlers 5 and 6

Patterns 5 (concurrent map iteration) and 6 (panic: runtime error) had
identical handlers — both log "Bettercap has crashed!", restart bettercap,
and restart pwnagotchi. Merge into a single elif with an or condition.

Closes #539

Signed-off-by: PwnPacker <4704376+CoderFX@users.noreply.github.com>
This commit is contained in:
CoderFX
2026-03-11 17:12:37 +02:00
parent 3d9280a61a
commit 3962c75730

View File

@@ -228,17 +228,9 @@ class FixServices(plugins.Plugin):
except Exception as err:
logging.error("[Fix_Services monstart]: %s" % repr(err))
# Look for pattern 5
elif len(self.pattern5.findall(other_other_last_lines)) >= 1:
logging.debug("[Fix_Services] Bettercap has crashed!")
if hasattr(agent, 'view'):
display.set('status', 'Restarting pwnagotchi!')
display.update(force=True)
subprocess.run(["systemctl", "restart", "bettercap"], timeout=30)
pwnagotchi.restart("AUTO")
# Look for pattern 6
elif len(self.pattern6.findall(other_other_last_lines)) >= 1:
# Look for patterns 5 or 6 (bettercap crash / Go panic)
elif (self.pattern5.findall(other_other_last_lines) or
self.pattern6.findall(other_other_last_lines)):
logging.debug("[Fix_Services] Bettercap has crashed!")
if hasattr(agent, 'view'):
display.set('status', 'Restarting pwnagotchi!')