Skip to content

Commit 92cd5d3

Browse files
authored
Merge pull request #47 from jayofelony/dev
removed blind bug check from fix_services.py
2 parents a94e7ee + 99caa7a commit 92cd5d3

File tree

1 file changed

+9
-35
lines changed

1 file changed

+9
-35
lines changed

pwnagotchi/plugins/default/fix_services.py

Lines changed: 9 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,9 @@ class FixServices(plugins.Plugin):
2727

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

53-
if len(self.pattern.findall(last_lines)) >= 3:
54-
if hasattr(agent, 'view'):
55-
display = agent.view()
56-
display.set('status', 'Blind-Bug detected. Restarting.')
57-
display.update(force=True)
58-
logging.info('[Fix_Services] Blind-Bug detected. Restarting.')
59-
try:
60-
self._tryTurningItOffAndOnAgain(agent)
61-
except Exception as err:
62-
logging.warning("[Fix_Services turnOffAndOn] %s" % repr(err))
63-
64-
else:
65-
logging.info("[Fix_Services] Logs look good!")
52+
logging.info("[Fix_Services] Logs look good!")
6653

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

123110
# Look for pattern 1
124-
if len(self.pattern.findall(last_lines)) >= 3:
125-
logging.debug("[Fix_Services]**** Should trigger a reload of the wlan0mon device:\n%s" % last_lines)
126-
if hasattr(agent, 'view'):
127-
display = agent.view()
128-
display.set('status', 'Blind-Bug detected. Restarting.')
129-
display.update(force=True)
130-
logging.info('[Fix_Services] Blind-Bug detected. Restarting.')
131-
try:
132-
self._tryTurningItOffAndOnAgain(agent)
133-
except Exception as err:
134-
logging.warning("[Fix_Services] TTOAOA: %s" % repr(err))
135-
136-
# Look for pattern 2
137-
elif len(self.pattern2.findall(other_last_lines)) >= 5:
111+
if len(self.pattern1.findall(other_last_lines)) >= 5:
138112
logging.debug("[Fix_Services]**** Should trigger a reload of the wlan0mon device:\n%s" % last_lines)
139113
if hasattr(agent, 'view'):
140114
display = agent.view()
@@ -157,8 +131,8 @@ def on_epoch(self, agent, epoch, epoch_data):
157131
except Exception as err:
158132
logging.error("[Fix_Services wifi.recon flip] %s" % repr(err))
159133

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

174-
# Look for pattern 4
175-
elif len(self.pattern4.findall(other_other_last_lines)) >= 3:
148+
# Look for pattern 3
149+
elif len(self.pattern3.findall(other_other_last_lines)) >= 3:
176150
logging.info("[Fix_Services] wlan0 is down!")
177151
if hasattr(agent, 'view'):
178152
display = agent.view()

0 commit comments

Comments
 (0)