diff --git a/builder/data/etc/systemd/system/pwnagotchi.service b/builder/data/etc/systemd/system/pwnagotchi.service index 5b7a153e..b48f7dfe 100644 --- a/builder/data/etc/systemd/system/pwnagotchi.service +++ b/builder/data/etc/systemd/system/pwnagotchi.service @@ -6,7 +6,7 @@ After=pwngrid-peer.service [Service] Type=simple -WorkingDirectory=/tmp +WorkingDirectory=~ ExecStart=/usr/bin/pwnagotchi-launcher Restart=always RestartSec=30 diff --git a/builder/data/etc/update-motd.d/01-motd b/builder/data/etc/update-motd.d/01-motd index 0f26121b..f549cd6d 100755 --- a/builder/data/etc/update-motd.d/01-motd +++ b/builder/data/etc/update-motd.d/01-motd @@ -23,9 +23,9 @@ echo " - sudo pwnagotchi --donate, to see how you can donate to this project" echo " - sudo pwnagotchi --check-update, to see if there is a new version available" echo echo " If you want to know if I'm running, you can use" -echo " systemctl status pwnagotchi" +echo " sudo systemctl status pwnagotchi" echo echo " You can restart me using" -echo " systemctl restart pwnagotchi" +echo " sudo systemctl restart pwnagotchi" echo echo " You learn more about me at https://pwnagotchi.ai/" \ No newline at end of file diff --git a/pwnagotchi/ai/__init__.py b/pwnagotchi/ai/__init__.py index 1c56d630..ba458651 100644 --- a/pwnagotchi/ai/__init__.py +++ b/pwnagotchi/ai/__init__.py @@ -3,7 +3,7 @@ import time import logging # https://stackoverflow.com/questions/40426502/is-there-a-way-to-suppress-the-messages-tensorflow-prints/40426709 -os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3' # or any {'0', '1', '2'} +# os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3' # or any {'0', '1', '2'} def load(config, agent, epoch, from_disk=True): @@ -15,47 +15,47 @@ def load(config, agent, epoch, from_disk=True): try: begin = time.time() - logging.info("[ai] bootstrapping dependencies ...") + logging.info("[AI] bootstrapping dependencies ...") start = time.time() SB_BACKEND = "stable_baselines3" from stable_baselines3 import A2C - logging.debug("[ai] A2C imported in %.2fs" % (time.time() - start)) + logging.debug("[AI] A2C imported in %.2fs" % (time.time() - start)) start = time.time() from stable_baselines3.a2c import MlpPolicy - logging.debug("[ai] MlpPolicy imported in %.2fs" % (time.time() - start)) + logging.debug("[AI] MlpPolicy imported in %.2fs" % (time.time() - start)) SB_A2C_POLICY = MlpPolicy start = time.time() from stable_baselines3.common.vec_env import DummyVecEnv - logging.debug("[ai] DummyVecEnv imported in %.2fs" % (time.time() - start)) + logging.debug("[AI] DummyVecEnv imported in %.2fs" % (time.time() - start)) start = time.time() import pwnagotchi.ai.gym as wrappers - logging.debug("[ai] gym wrapper imported in %.2fs" % (time.time() - start)) + logging.debug("[AI] gym wrapper imported in %.2fs" % (time.time() - start)) env = wrappers.Environment(agent, epoch) env = DummyVecEnv([lambda: env]) - logging.info("[ai] creating model ...") + logging.info("[AI] creating model ...") start = time.time() a2c = A2C(SB_A2C_POLICY, env, **config['params']) - logging.debug("[ai] A2C created in %.2fs" % (time.time() - start)) + logging.debug("[AI] A2C created in %.2fs" % (time.time() - start)) if from_disk and os.path.exists(config['path']): - logging.info("[ai] loading %s ..." % config['path']) + logging.info("[AI] loading %s ..." % config['path']) start = time.time() a2c.load(config['path'], env) - logging.debug("[ai] A2C loaded in %.2fs" % (time.time() - start)) + logging.debug("[AI] A2C loaded in %.2fs" % (time.time() - start)) else: - logging.info("[ai] model created:") + logging.info("[AI] model created:") for key, value in config['params'].items(): logging.info(" %s: %s" % (key, value)) - logging.debug("[ai] total loading time is %.2fs" % (time.time() - begin)) + logging.debug("[AI] total loading time is %.2fs" % (time.time() - begin)) return a2c except Exception as e: @@ -63,5 +63,5 @@ def load(config, agent, epoch, from_disk=True): logging.info("[AI] Deleting brain and restarting.") os.system("rm /root/brain.nn && service pwnagotchi restart") - logging.warning("[ai] AI not loaded!") + logging.warning("[AI] AI not loaded!") return False diff --git a/pwnagotchi/ai/gym.py b/pwnagotchi/ai/gym.py index 2af64f5f..6179e76e 100644 --- a/pwnagotchi/ai/gym.py +++ b/pwnagotchi/ai/gym.py @@ -138,13 +138,13 @@ class Environment(gym.Env): self._last_render = self._epoch_num - logging.info("[ai] --- training epoch %d/%d ---" % (self._epoch_num, self._agent.training_epochs())) - logging.info("[ai] REWARD: %f" % self.last['reward']) + logging.info("[AI] --- training epoch %d/%d ---" % (self._epoch_num, self._agent.training_epochs())) + logging.info("[AI] REWARD: %f" % self.last['reward']) logging.debug( - "[ai] policy: %s" % ', '.join("%s:%s" % (name, value) for name, value in self.last['params'].items())) + "[AI] policy: %s" % ', '.join("%s:%s" % (name, value) for name, value in self.last['params'].items())) - logging.info("[ai] observation:") + logging.info("[AI] observation:") for name, value in self.last['state'].items(): if 'histogram' in name: logging.info(" %s" % name.replace('_histogram', '')) diff --git a/pwnagotchi/plugins/cmd.py b/pwnagotchi/plugins/cmd.py index 6b159902..b0b9bf9e 100644 --- a/pwnagotchi/plugins/cmd.py +++ b/pwnagotchi/plugins/cmd.py @@ -271,7 +271,7 @@ def _get_installed(config): Get all installed plugins """ installed = dict() - search_dirs = [ default_path, config['main']['custom_plugins'] ] + search_dirs = [default_path, config['main']['custom_plugins']] for search_dir in search_dirs: if search_dir: for filename in glob.glob(os.path.join(search_dir, "*.py")):