mirror of
https://github.com/jayofelony/pwnagotchi.git
synced 2025-07-01 18:37:27 -04:00
Version 2.3.6
Signed-off-by: Jeroen Oudshoorn <oudshoorn.jeroen@gmail.com> Signed-off-by: Jeroen Oudshoorn <oudshoorn.jeroen@gmail.com>
This commit is contained in:
@ -4,7 +4,6 @@ import time
|
||||
import re
|
||||
|
||||
|
||||
|
||||
from pwnagotchi._version import __version__
|
||||
|
||||
_name = None
|
||||
|
@ -1 +1 @@
|
||||
__version__ = '2.3.5'
|
||||
__version__ = '2.3.6'
|
||||
|
@ -394,7 +394,6 @@ class Agent(Client, Automata, AsyncAdvertiser, AsyncTrainer):
|
||||
# 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']:
|
||||
|
@ -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
|
||||
@ -32,6 +33,8 @@ class Client(object):
|
||||
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"
|
||||
@ -41,24 +44,25 @@ class Client(object):
|
||||
|
||||
@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):
|
||||
|
@ -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"
|
||||
]
|
||||
|
@ -1,5 +1,4 @@
|
||||
import subprocess
|
||||
import socket
|
||||
import requests
|
||||
import json
|
||||
import logging
|
||||
@ -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)
|
||||
|
Reference in New Issue
Block a user