Skip to content
This repository has been archived by the owner on Mar 5, 2024. It is now read-only.

Commit

Permalink
Version 2.3.6
Browse files Browse the repository at this point in the history
Signed-off-by: Jeroen Oudshoorn <[email protected]>

Signed-off-by: Jeroen Oudshoorn <[email protected]>
  • Loading branch information
jayofelony committed Sep 9, 2023
1 parent 8e2a641 commit c6b2fa6
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 26 deletions.
1 change: 0 additions & 1 deletion pwnagotchi/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import re



from pwnagotchi._version import __version__

_name = None
Expand Down
2 changes: 1 addition & 1 deletion pwnagotchi/_version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '2.3.5'
__version__ = '2.3.6'
1 change: 0 additions & 1 deletion pwnagotchi/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,6 @@ def start_event_polling(self):
# start a thread and pass in the mainloop
_thread.start_new_thread(self._event_poller, (asyncio.get_event_loop(),))


def is_module_running(self, module):
s = self.session()
for m in s['modules']:
Expand Down
42 changes: 23 additions & 19 deletions pwnagotchi/bettercap.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ def decode(r, verbose_errors=True):


class Client(object):
def __init__(self, hostname='localhost', scheme='http', port=8081, username='user', password='pass'):
def __init__(self, hostname='localhost', scheme='http', port=8081, username='user', password='pass',
max_websockets=5):
self.hostname = hostname
self.scheme = scheme
self.port = port
Expand All @@ -32,6 +33,8 @@ def __init__(self, hostname='localhost', scheme='http', port=8081, username='use
self.url = "%s://%s:%d/api" % (scheme, hostname, port)
self.websocket = "ws://%s:%s@%s:%d/api" % (username, password, hostname, port)
self.auth = HTTPBasicAuth(username, password)
self.max_websockets = max_websockets
self.websocket_semaphore = asyncio.Semaphore(max_websockets)

# session takes optional argument to pull a sub-dictionary
# ex.: "session/wifi", "session/ble"
Expand All @@ -41,24 +44,25 @@ def session(self, sess="session"):

@backoff.on_exception(backoff.expo, requests.exceptions.ConnectionError, max_tries=10)
async def start_websocket(self, consumer):
s = "%s/events" % self.websocket
while True:
try:
async with websockets.connect(s, ping_interval=60, ping_timeout=90) as ws:
async for msg in ws:
try:
await consumer(msg)
except Exception as ex:
logging.debug("Error while parsing event (%s)", ex)
except websockets.exceptions.ConnectionClosedError:
logging.debug("Lost websocket connection. Reconnecting...")
await asyncio.sleep(1) # Sleep for x seconds before reconnecting
except websockets.exceptions.WebSocketException as wex:
logging.debug("Websocket exception (%s)", wex)
await asyncio.sleep(1) # Sleep for x 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 x seconds before reconnecting
async with self.websocket_semaphore:
s = "%s/events" % self.websocket
while True:
try:
async with websockets.connect(s, ping_interval=60, ping_timeout=90) as ws:
async for msg in ws:
try:
await consumer(msg)
except Exception as ex:
logging.debug("Error while parsing event (%s)", ex)
except websockets.ConnectionClosedError:
logging.debug("Lost websocket connection. Reconnecting...")
await asyncio.sleep(5) # Sleep for x seconds before reconnecting
except websockets.WebSocketException as wex:
logging.debug("Websocket exception (%s)", wex)
await asyncio.sleep(5) # Sleep for x seconds before reconnecting
except Exception as e:
logging.exception("Other error while opening websocket (%s) with parameter %s", e, s)
await asyncio.sleep(5) # Sleep for x seconds before reconnecting

@backoff.on_exception(backoff.expo, requests.exceptions.ConnectionError, max_tries=10)
def run(self, command, verbose_errors=True):
Expand Down
4 changes: 2 additions & 2 deletions pwnagotchi/defaults.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ main.plugins.pisugar2.enabled = false
main.plugins.pisugar2.shutdown = 5
main.plugins.pisugar2.sync_rtc_on_boot = false

main.plugins.grid.enabled = false
main.plugins.grid.report = false
main.plugins.grid.enabled = true
main.plugins.grid.report = true
main.plugins.grid.exclude = [
"YourHomeNetworkHere"
]
Expand Down
4 changes: 2 additions & 2 deletions pwnagotchi/grid.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import subprocess
import socket
import requests
import json
import logging
Expand Down Expand Up @@ -84,7 +83,8 @@ def update_data(last_session):
},
'uname': subprocess.getoutput("uname -a"),
'brain': brain,
'version': pwnagotchi.__version__
'version': pwnagotchi.__version__,
'build': "Pwnagotchi-Torch by Jayofelony"
}

logging.debug("updating grid data: %s" % data)
Expand Down

0 comments on commit c6b2fa6

Please sign in to comment.