From 245e2bec724ef2538d362d9b046721590bd9e372 Mon Sep 17 00:00:00 2001 From: Jeroen Oudshoorn Date: Fri, 8 Sep 2023 20:26:48 +0200 Subject: [PATCH] Revert "Version 2.3.1" This reverts commit b8002c9f0011696c5dc7e97f0c38d693fa330c9c. --- .idea/misc.xml | 2 +- .idea/pwnagotchi.iml | 2 +- README.md | 2 +- bin/pwnagotchi | 2 +- pwnagotchi/bettercap.py | 6 +----- pwnagotchi/grid.py | 7 ++++--- pwnagotchi/plugins/default/fix_services.py | 16 ---------------- pwnagotchi/ui/web/templates/profile.html | 4 ++-- 8 files changed, 11 insertions(+), 30 deletions(-) diff --git a/.idea/misc.xml b/.idea/misc.xml index d95f6c4d..111f0337 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,4 +1,4 @@ - + \ No newline at end of file diff --git a/.idea/pwnagotchi.iml b/.idea/pwnagotchi.iml index b258c893..67a8fbf3 100644 --- a/.idea/pwnagotchi.iml +++ b/.idea/pwnagotchi.iml @@ -4,7 +4,7 @@ - + diff --git a/README.md b/README.md index 3027472f..8b21588f 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # Pwnagotchi -Release
+ **This fork of Pwnagotchi has been overhauled to work solely on 64-bit Raspberry Pi's, it uses PyTorch as it's AI.** Patreon: [Pwnagotchi-Torch](https://www.patreon.com/pwnagotchi_torch) diff --git a/bin/pwnagotchi b/bin/pwnagotchi index abdfae42..2c2392d7 100755 --- a/bin/pwnagotchi +++ b/bin/pwnagotchi @@ -6,7 +6,7 @@ import signal import sys import toml import requests -import os +import json import pwnagotchi from pwnagotchi import utils diff --git a/pwnagotchi/bettercap.py b/pwnagotchi/bettercap.py index bb9f7992..628c3bff 100644 --- a/pwnagotchi/bettercap.py +++ b/pwnagotchi/bettercap.py @@ -4,8 +4,6 @@ import requests import websockets from requests.auth import HTTPBasicAuth -import asyncio # Add asyncio for async functionality -from time import sleep # Add sleep function def decode(r, verbose_errors=True): @@ -51,13 +49,11 @@ class Client(object): logging.debug("Error while parsing event (%s)", ex) except websockets.exceptions.ConnectionClosedError: logging.debug("Lost websocket connection. Reconnecting...") - await asyncio.sleep(1) # Sleep for 5 seconds before reconnecting except websockets.exceptions.WebSocketException as wex: logging.debug("Websocket exception (%s)", wex) - await asyncio.sleep(1) # Sleep for 5 seconds before reconnecting except Exception as e: logging.exception("Other error while opening websocket (%s) with parameter %s", e, s) - await asyncio.sleep(1) # Sleep for 5 seconds before reconnecting + def run(self, command, verbose_errors=True): for _ in range(0, 2): diff --git a/pwnagotchi/grid.py b/pwnagotchi/grid.py index b4abe77a..a76c269d 100644 --- a/pwnagotchi/grid.py +++ b/pwnagotchi/grid.py @@ -13,9 +13,10 @@ API_ADDRESS = "http://127.0.0.1:8666/api/v1" def is_connected(): try: # check DNS - host = 'https://api.opwngrid.xyz/api/v1/uptime' - r = requests.get(host, headers=None, timeout=(30.0, 60.0)) - if r.json().get('isUp'): + host = socket.gethostbyname('api.pwnagotchi.ai') + if host: + # check connectivity itself + socket.create_connection((host, 443), timeout=30) return True except: pass diff --git a/pwnagotchi/plugins/default/fix_services.py b/pwnagotchi/plugins/default/fix_services.py index 987044f5..52026136 100644 --- a/pwnagotchi/plugins/default/fix_services.py +++ b/pwnagotchi/plugins/default/fix_services.py @@ -36,7 +36,6 @@ class Fix_BRCMF(plugins.Plugin): 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'Firmware has halted or crashed') - self.pattern4 = re.compile(r'error 400: could not find interface wlan0mon') self.isReloadingMon = False self.connection = None self.LASTTRY = 0 @@ -174,21 +173,6 @@ class Fix_BRCMF(plugins.Plugin): except Exception as err: logging.error("[FixBRCMF monstart]: %s" % repr(err)) - # Look for pattern 3 - elif len(self.pattern3.findall(other_other_last_lines)) >= 1: - logging.info("[FixBRCMF] wlan0 is down!") - if hasattr(agent, 'view'): - display = agent.view() - display.set('status', 'Restarting wlan0 now!') - display.update(force=True) - try: - # Run the monstart command to restart wlan0mon - cmd_output = subprocess.check_output("ifconfig wlan0 up && monstart", shell=True) - self._status = "up" - logging.info("[FixBRCMF monstart]: %s" % repr(cmd_output)) - except Exception as err: - logging.error("[FixBRCMF monstart]: %s" % repr(err)) - else: print("logs look good") diff --git a/pwnagotchi/ui/web/templates/profile.html b/pwnagotchi/ui/web/templates/profile.html index e422cf5c..b02eb33e 100644 --- a/pwnagotchi/ui/web/templates/profile.html +++ b/pwnagotchi/ui/web/templates/profile.html @@ -8,7 +8,7 @@ Profile {% block script %} $(function(){ $('#qrcode').qrcode({ - text: 'https://opwngrid.xyz/search/{{ fingerprint }}', + text: 'https://pwnagotchi.ai/pwnfile/#{{ fingerprint }}', render: 'div', mode: 0, size: 400, @@ -25,7 +25,7 @@ $(function(){

- {{ fingerprint }} + {{ fingerprint }}