diff --git a/.idea/misc.xml b/.idea/misc.xml
index 111f0337..d95f6c4d 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 67a8fbf3..b258c893 100644
--- a/.idea/pwnagotchi.iml
+++ b/.idea/pwnagotchi.iml
@@ -4,7 +4,7 @@
-
+
diff --git a/README.md b/README.md
index 8b21588f..3027472f 100644
--- a/README.md
+++ b/README.md
@@ -1,5 +1,5 @@
# Pwnagotchi
-
+
**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 2c2392d7..abdfae42 100755
--- a/bin/pwnagotchi
+++ b/bin/pwnagotchi
@@ -6,7 +6,7 @@ import signal
import sys
import toml
import requests
-import json
+import os
import pwnagotchi
from pwnagotchi import utils
diff --git a/pwnagotchi/bettercap.py b/pwnagotchi/bettercap.py
index 628c3bff..bb9f7992 100644
--- a/pwnagotchi/bettercap.py
+++ b/pwnagotchi/bettercap.py
@@ -4,6 +4,8 @@ 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):
@@ -49,11 +51,13 @@ 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 a76c269d..b4abe77a 100644
--- a/pwnagotchi/grid.py
+++ b/pwnagotchi/grid.py
@@ -13,10 +13,9 @@ API_ADDRESS = "http://127.0.0.1:8666/api/v1"
def is_connected():
try:
# check DNS
- host = socket.gethostbyname('api.pwnagotchi.ai')
- if host:
- # check connectivity itself
- socket.create_connection((host, 443), timeout=30)
+ host = 'https://api.opwngrid.xyz/api/v1/uptime'
+ r = requests.get(host, headers=None, timeout=(30.0, 60.0))
+ if r.json().get('isUp'):
return True
except:
pass
diff --git a/pwnagotchi/plugins/default/fix_services.py b/pwnagotchi/plugins/default/fix_services.py
index 52026136..987044f5 100644
--- a/pwnagotchi/plugins/default/fix_services.py
+++ b/pwnagotchi/plugins/default/fix_services.py
@@ -36,6 +36,7 @@ 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
@@ -173,6 +174,21 @@ 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 b02eb33e..e422cf5c 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://pwnagotchi.ai/pwnfile/#{{ fingerprint }}',
+ text: 'https://opwngrid.xyz/search/{{ fingerprint }}',
render: 'div',
mode: 0,
size: 400,
@@ -25,7 +25,7 @@ $(function(){