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:
Jeroen Oudshoorn
2023-09-06 10:20:43 +02:00
parent 7a7b700dad
commit 0be91b6e2f
4 changed files with 7 additions and 28 deletions

View File

@ -1 +1 @@
__version__ = '2.2.9'
__version__ = '2.3'

View File

@ -18,7 +18,7 @@ def load(config, agent, epoch, from_disk=True):
logging.info("[ai] bootstrapping dependencies ...")
start = time.time()
SB_BACKEND = "stable_baselines3";
SB_BACKEND = "stable_baselines3"
try:
from stable_baselines3 import A2C
@ -78,6 +78,8 @@ def load(config, agent, epoch, from_disk=True):
return a2c
except Exception as 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!")
return False

View File

@ -123,13 +123,8 @@ def install(display, update):
if not os.path.exists(source_path):
source_path = "%s-%s" % (source_path, update['available'])
if "pwngrid" in source_path:
os.system("cd %s && make && make 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)
# setup.py is going to install data files for us
os.system("cd %s && pip3 install ." % source_path)
return True

View File

@ -35,8 +35,7 @@ class Fix_BRCMF(plugins.Plugin):
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'error 400: could not find interface wlan0mon')
self.pattern4 = re.compile(r'AI not loaded!')
self.pattern3 = re.compile(r'Firmware has halted or crashed')
self.isReloadingMon = False
self.connection = None
self.LASTTRY = 0
@ -174,23 +173,6 @@ class Fix_BRCMF(plugins.Plugin):
except Exception as 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:
print("logs look good")