mirror of
https://github.com/jayofelony/pwnagotchi.git
synced 2025-07-01 18:37:27 -04:00
Version 2.3:
Edited auto-update fix_services removed brain part __init__.py remove brain.nn if error occurs and restart pwnagotchi service Signed-off-by: Jeroen Oudshoorn <oudshoorn.jeroen@gmail.com>
This commit is contained in:
@ -1 +1 @@
|
|||||||
__version__ = '2.2.9'
|
__version__ = '2.3'
|
||||||
|
@ -18,7 +18,7 @@ def load(config, agent, epoch, from_disk=True):
|
|||||||
logging.info("[ai] bootstrapping dependencies ...")
|
logging.info("[ai] bootstrapping dependencies ...")
|
||||||
|
|
||||||
start = time.time()
|
start = time.time()
|
||||||
SB_BACKEND = "stable_baselines3";
|
SB_BACKEND = "stable_baselines3"
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from stable_baselines3 import A2C
|
from stable_baselines3 import A2C
|
||||||
@ -78,6 +78,8 @@ def load(config, agent, epoch, from_disk=True):
|
|||||||
return a2c
|
return a2c
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logging.exception("error while starting AI (%s)", e)
|
logging.exception("error while starting AI (%s)", e)
|
||||||
|
logging.info("Deleting brain and restarting.")
|
||||||
|
os.system("rm /root/brain.nn && systemctl restart pwnagotchi")
|
||||||
|
|
||||||
logging.warning("[ai] AI not loaded!")
|
logging.warning("[ai] AI not loaded!")
|
||||||
return False
|
return False
|
||||||
|
@ -123,13 +123,8 @@ def install(display, update):
|
|||||||
if not os.path.exists(source_path):
|
if not os.path.exists(source_path):
|
||||||
source_path = "%s-%s" % (source_path, update['available'])
|
source_path = "%s-%s" % (source_path, update['available'])
|
||||||
|
|
||||||
if "pwngrid" in source_path:
|
# setup.py is going to install data files for us
|
||||||
os.system("cd %s && make && make install" % source_path)
|
os.system("cd %s && pip3 install ." % source_path)
|
||||||
elif "bettercap" in source_path:
|
|
||||||
os.system("cd %s && make && make install" % source_path)
|
|
||||||
else:
|
|
||||||
# setup.py is going to install data files for us
|
|
||||||
os.system("cd %s && pip3 install ." % source_path)
|
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
@ -35,8 +35,7 @@ class Fix_BRCMF(plugins.Plugin):
|
|||||||
self.options = dict()
|
self.options = dict()
|
||||||
self.pattern = re.compile(r'brcmf_cfg80211_nexmon_set_channel.*?Set Channel failed')
|
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.pattern2 = re.compile(r'wifi error while hopping to channel')
|
||||||
self.pattern3 = re.compile(r'error 400: could not find interface wlan0mon')
|
self.pattern3 = re.compile(r'Firmware has halted or crashed')
|
||||||
self.pattern4 = re.compile(r'AI not loaded!')
|
|
||||||
self.isReloadingMon = False
|
self.isReloadingMon = False
|
||||||
self.connection = None
|
self.connection = None
|
||||||
self.LASTTRY = 0
|
self.LASTTRY = 0
|
||||||
@ -174,23 +173,6 @@ class Fix_BRCMF(plugins.Plugin):
|
|||||||
except Exception as err:
|
except Exception as err:
|
||||||
logging.error("[FixBRCMF monstart]: %s" % repr(err))
|
logging.error("[FixBRCMF monstart]: %s" % repr(err))
|
||||||
|
|
||||||
# Look for pattern 4
|
|
||||||
elif len(self.pattern4.findall(other_other_last_lines)) >= 1:
|
|
||||||
logging.info("[FixBRCMF] Having a brain meltdown. Deleting myself.")
|
|
||||||
if hasattr(agent, 'view'):
|
|
||||||
display = agent.view()
|
|
||||||
if display: display.update(force=True,
|
|
||||||
new_data={"status": "Having a brain meltdown. Deleting myself.",
|
|
||||||
"face": faces.SAD})
|
|
||||||
try:
|
|
||||||
# Delete brain /root/brain.nn and restarting pwnagotchi service
|
|
||||||
cmd_output = subprocess.check_output("rm /root/brain.nn && systemctl restart pwnagotchi",
|
|
||||||
shell=True)
|
|
||||||
self._status = "up"
|
|
||||||
logging.info("[FixBRCMF brain]: %s" % repr(cmd_output))
|
|
||||||
except Exception as err:
|
|
||||||
logging.error("[FixBRCMF brain]: %s" % repr(err))
|
|
||||||
|
|
||||||
else:
|
else:
|
||||||
print("logs look good")
|
print("logs look good")
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user