Skip to content

Commit

Permalink
Merge pull request #47 from jayofelony/dev
Browse files Browse the repository at this point in the history
removed blind bug check from fix_services.py
  • Loading branch information
jayofelony authored Feb 4, 2024
2 parents a94e7ee + 99caa7a commit 92cd5d3
Showing 1 changed file with 9 additions and 35 deletions.
44 changes: 9 additions & 35 deletions pwnagotchi/plugins/default/fix_services.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,9 @@ class FixServices(plugins.Plugin):

def __init__(self):
self.options = dict()
self.pattern = re.compile(r'brcmf_cfg80211_nexmon_set_channel.*?Set Channel failed')
self.pattern2 = re.compile(r'wifi error while hopping to channel')
self.pattern3 = re.compile(r'Firmware has halted or crashed')
self.pattern4 = re.compile(r'error 400: could not find interface wlan0mon')
self.pattern1 = re.compile(r'wifi error while hopping to channel')
self.pattern2 = re.compile(r'Firmware has halted or crashed')
self.pattern3 = re.compile(r'error 400: could not find interface wlan0mon')
self.isReloadingMon = False
self.connection = None
self.LASTTRY = 0
Expand All @@ -50,19 +49,7 @@ def on_ready(self, agent):
if ",UP," in str(cmd_output):
logging.info("wlan0mon is up.")

if len(self.pattern.findall(last_lines)) >= 3:
if hasattr(agent, 'view'):
display = agent.view()
display.set('status', 'Blind-Bug detected. Restarting.')
display.update(force=True)
logging.info('[Fix_Services] Blind-Bug detected. Restarting.')
try:
self._tryTurningItOffAndOnAgain(agent)
except Exception as err:
logging.warning("[Fix_Services turnOffAndOn] %s" % repr(err))

else:
logging.info("[Fix_Services] Logs look good!")
logging.info("[Fix_Services] Logs look good!")

except Exception as err:
logging.error("[Fix_Services ip link show wlan0mon]: %s" % repr(err))
Expand Down Expand Up @@ -121,20 +108,7 @@ def on_epoch(self, agent, epoch, epoch_data):
logging.debug("[Fix_Services]**** checking")

# Look for pattern 1
if len(self.pattern.findall(last_lines)) >= 3:
logging.debug("[Fix_Services]**** Should trigger a reload of the wlan0mon device:\n%s" % last_lines)
if hasattr(agent, 'view'):
display = agent.view()
display.set('status', 'Blind-Bug detected. Restarting.')
display.update(force=True)
logging.info('[Fix_Services] Blind-Bug detected. Restarting.')
try:
self._tryTurningItOffAndOnAgain(agent)
except Exception as err:
logging.warning("[Fix_Services] TTOAOA: %s" % repr(err))

# Look for pattern 2
elif len(self.pattern2.findall(other_last_lines)) >= 5:
if len(self.pattern1.findall(other_last_lines)) >= 5:
logging.debug("[Fix_Services]**** Should trigger a reload of the wlan0mon device:\n%s" % last_lines)
if hasattr(agent, 'view'):
display = agent.view()
Expand All @@ -157,8 +131,8 @@ def on_epoch(self, agent, epoch, epoch_data):
except Exception as err:
logging.error("[Fix_Services wifi.recon flip] %s" % repr(err))

# Look for pattern 3
elif len(self.pattern3.findall(other_last_lines)) >= 1:
# Look for pattern 2
elif len(self.pattern2.findall(other_last_lines)) >= 1:
logging.info("[Fix_Services] Firmware has halted or crashed. Restarting wlan0mon.")
if hasattr(agent, 'view'):
display = agent.view()
Expand All @@ -171,8 +145,8 @@ def on_epoch(self, agent, epoch, epoch_data):
except Exception as err:
logging.error("[Fix_Services monstart]: %s" % repr(err))

# Look for pattern 4
elif len(self.pattern4.findall(other_other_last_lines)) >= 3:
# Look for pattern 3
elif len(self.pattern3.findall(other_other_last_lines)) >= 3:
logging.info("[Fix_Services] wlan0 is down!")
if hasattr(agent, 'view'):
display = agent.view()
Expand Down

0 comments on commit 92cd5d3

Please sign in to comment.