From 00cefd06fefef256e627134905bb6f34b28a3776 Mon Sep 17 00:00:00 2001 From: Jeroen Oudshoorn Date: Fri, 6 Oct 2023 22:16:59 +0200 Subject: [PATCH 1/8] v2.4.7 Signed-off-by: Jeroen Oudshoorn --- .github/FUNDING.yml | 2 +- pwnagotchi/ai/gym.py | 6 +++--- pwnagotchi/ai/parameter.py | 4 ++-- requirements.txt | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml index 084515ca..8bbfac59 100644 --- a/.github/FUNDING.yml +++ b/.github/FUNDING.yml @@ -1,7 +1,7 @@ # These are supported funding model platforms github: # Replace with up to 4 GitHubSponsors-enabled usernames e.g., [user1, user2] -patreon: evilsocket +patreon: pwnagotchi-torch open_collective: # Replace with a single Open Collective username ko_fi: # Replace with a single Ko-fi username tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel diff --git a/pwnagotchi/ai/gym.py b/pwnagotchi/ai/gym.py index 7134628b..6c0cac10 100644 --- a/pwnagotchi/ai/gym.py +++ b/pwnagotchi/ai/gym.py @@ -1,6 +1,6 @@ import logging -import gym -from gym import spaces +import gymnasium +from gymnasium import spaces import numpy as np import pwnagotchi.ai.featurizer as featurizer @@ -8,7 +8,7 @@ import pwnagotchi.ai.reward as reward from pwnagotchi.ai.parameter import Parameter -class Environment(gym.Env): +class Environment(gymnasium.Env): metadata = {'render.modes': ['human']} params = [ Parameter('min_rssi', min_value=-200, max_value=-50), diff --git a/pwnagotchi/ai/parameter.py b/pwnagotchi/ai/parameter.py index 79f464c5..45e9a85a 100644 --- a/pwnagotchi/ai/parameter.py +++ b/pwnagotchi/ai/parameter.py @@ -1,4 +1,4 @@ -from gym import spaces +from gymnasium import spaces class Parameter(object): @@ -10,7 +10,7 @@ class Parameter(object): self.min_value = min_value self.max_value = max_value + 1 - # gym.space.Discrete is within [0, 1, 2, ..., n-1] + # gymnasium.space.Discrete is within [0, 1, 2, ..., n-1] if self.min_value < 0: self.scale_factor = abs(self.min_value) elif self.min_value > 0: diff --git a/requirements.txt b/requirements.txt index decdc195..f5f2ad1d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ -gym +gymnasium shimmy pycryptodome requests From 36cd9d8dd92384d00e10f0286d2913310a354b79 Mon Sep 17 00:00:00 2001 From: Jeroen Oudshoorn Date: Fri, 6 Oct 2023 23:32:18 +0200 Subject: [PATCH 2/8] v2.4.7 Signed-off-by: Jeroen Oudshoorn --- builder/pwnagotchi.yml | 1 + pwnagotchi/ai/gym.py | 6 +++--- pwnagotchi/ai/parameter.py | 2 +- requirements.txt | 2 +- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/builder/pwnagotchi.yml b/builder/pwnagotchi.yml index 167c71a4..8368dc25 100644 --- a/builder/pwnagotchi.yml +++ b/builder/pwnagotchi.yml @@ -90,6 +90,7 @@ - libbz2-dev - libc-ares-dev - libc6-dev + - libcap-dev - libdbus-1-dev - libdbus-glib-1-dev - libeigen3-dev diff --git a/pwnagotchi/ai/gym.py b/pwnagotchi/ai/gym.py index 6c0cac10..7134628b 100644 --- a/pwnagotchi/ai/gym.py +++ b/pwnagotchi/ai/gym.py @@ -1,6 +1,6 @@ import logging -import gymnasium -from gymnasium import spaces +import gym +from gym import spaces import numpy as np import pwnagotchi.ai.featurizer as featurizer @@ -8,7 +8,7 @@ import pwnagotchi.ai.reward as reward from pwnagotchi.ai.parameter import Parameter -class Environment(gymnasium.Env): +class Environment(gym.Env): metadata = {'render.modes': ['human']} params = [ Parameter('min_rssi', min_value=-200, max_value=-50), diff --git a/pwnagotchi/ai/parameter.py b/pwnagotchi/ai/parameter.py index 45e9a85a..414129b7 100644 --- a/pwnagotchi/ai/parameter.py +++ b/pwnagotchi/ai/parameter.py @@ -1,4 +1,4 @@ -from gymnasium import spaces +from gym import spaces class Parameter(object): diff --git a/requirements.txt b/requirements.txt index f5f2ad1d..decdc195 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ -gymnasium +gym shimmy pycryptodome requests From f9b46fbd6b88b07e780e98bae2629ada7c991343 Mon Sep 17 00:00:00 2001 From: Jeroen Oudshoorn Date: Fri, 6 Oct 2023 23:45:09 +0200 Subject: [PATCH 3/8] v2.4.7 Signed-off-by: Jeroen Oudshoorn --- builder/data/usr/bin/pwnlib | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/builder/data/usr/bin/pwnlib b/builder/data/usr/bin/pwnlib index 23827206..4e78adf6 100755 --- a/builder/data/usr/bin/pwnlib +++ b/builder/data/usr/bin/pwnlib @@ -79,12 +79,12 @@ is_auto_mode() { # if usb0 is up, we're in MANU if is_interface_up usb0; then - return 1 + return 0 fi # if eth0 is up (for other boards), we're in MANU if is_interface_up eth0; then - return 1 + return 0 fi # no override, but none of the interfaces is up -> AUTO @@ -105,12 +105,12 @@ is_auto_mode_no_delete() { # if usb0 is up, we're in MANU if is_interface_up usb0; then - return 1 + return 0 fi # if eth0 is up (for other boards), we're in MANU if is_interface_up eth0; then - return 1 + return 0 fi # no override, but none of the interfaces is up -> AUTO From 633e9087adb8cadef49aa7fc79dd88ac28f43843 Mon Sep 17 00:00:00 2001 From: Jeroen Oudshoorn Date: Sat, 7 Oct 2023 00:07:22 +0200 Subject: [PATCH 4/8] v2.4.7 Signed-off-by: Jeroen Oudshoorn --- pwnagotchi/ai/__init__.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/pwnagotchi/ai/__init__.py b/pwnagotchi/ai/__init__.py index ad41fc10..b5821819 100644 --- a/pwnagotchi/ai/__init__.py +++ b/pwnagotchi/ai/__init__.py @@ -21,18 +21,15 @@ def load(config, agent, epoch, from_disk=True): SB_BACKEND = "stable_baselines3" try: - from stable_baselines3 import A2C + from baselines.common.vec_env import DummyVecEnv + from baselines.a2c import a2c logging.debug("[ai] A2C imported in %.2fs" % (time.time() - start)) start = time.time() - from stable_baselines3.a2c import MlpPolicy + from baselines.a2c.policies import MlpPolicy 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)) - except Exception as e: logging.debug("[ai] stable_baselines3 not accessible. Trying stable_baselines") From 8587ee22c12be72691bc8c4d8bdc28476dec6808 Mon Sep 17 00:00:00 2001 From: Jeroen Oudshoorn Date: Sat, 7 Oct 2023 00:08:26 +0200 Subject: [PATCH 5/8] v2.4.7 Signed-off-by: Jeroen Oudshoorn --- requirements.txt | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/requirements.txt b/requirements.txt index decdc195..0e65289d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -18,7 +18,5 @@ dbus-python toml python-dateutil websockets -torch -torchvision -stable_baselines3 +git+https://github.com/openai/baselines RPi.GPIO From 2f975cedc2a5e4f88f29a50c82cd1c21cd28086a Mon Sep 17 00:00:00 2001 From: Jeroen Oudshoorn Date: Sat, 7 Oct 2023 00:09:03 +0200 Subject: [PATCH 6/8] v2.4.7 Signed-off-by: Jeroen Oudshoorn --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 0e65289d..3e9e54ad 100644 --- a/requirements.txt +++ b/requirements.txt @@ -18,5 +18,5 @@ dbus-python toml python-dateutil websockets -git+https://github.com/openai/baselines +https://github.com/openai/baselines RPi.GPIO From e7ed3883a9faaf9d4a15d4c72074954906432fc2 Mon Sep 17 00:00:00 2001 From: Jeroen Oudshoorn Date: Sat, 7 Oct 2023 00:10:12 +0200 Subject: [PATCH 7/8] v2.4.7 Signed-off-by: Jeroen Oudshoorn --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 3e9e54ad..0e65289d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -18,5 +18,5 @@ dbus-python toml python-dateutil websockets -https://github.com/openai/baselines +git+https://github.com/openai/baselines RPi.GPIO From c8570914da43134346f3b20156ffd34d49cc7085 Mon Sep 17 00:00:00 2001 From: Jeroen Oudshoorn Date: Sat, 7 Oct 2023 00:17:04 +0200 Subject: [PATCH 8/8] v2.4.7 Signed-off-by: Jeroen Oudshoorn --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 0e65289d..d3b2c829 100644 --- a/requirements.txt +++ b/requirements.txt @@ -18,5 +18,5 @@ dbus-python toml python-dateutil websockets -git+https://github.com/openai/baselines +baselines RPi.GPIO