mirror of
https://github.com/jayofelony/pwnagotchi.git
synced 2025-07-01 18:37:27 -04:00
@ -7,6 +7,8 @@ import random
|
|||||||
from requests.auth import HTTPBasicAuth
|
from requests.auth import HTTPBasicAuth
|
||||||
from time import sleep
|
from time import sleep
|
||||||
|
|
||||||
|
import pwnagotchi
|
||||||
|
|
||||||
requests.adapters.DEFAULT_RETRIES = 5 # increase retries number
|
requests.adapters.DEFAULT_RETRIES = 5 # increase retries number
|
||||||
|
|
||||||
ping_timeout = 180
|
ping_timeout = 180
|
||||||
@ -66,7 +68,7 @@ class Client(object):
|
|||||||
|
|
||||||
# restarted every time the connection fails
|
# restarted every time the connection fails
|
||||||
while True:
|
while True:
|
||||||
logging.info("creating new websocket...")
|
logging.info("[bettercap] creating new websocket...")
|
||||||
try:
|
try:
|
||||||
async with websockets.connect(s, ping_interval=ping_interval, ping_timeout=ping_timeout, max_queue=max_queue) as ws:
|
async with websockets.connect(s, ping_interval=ping_interval, ping_timeout=ping_timeout, max_queue=max_queue) as ws:
|
||||||
# listener loop
|
# listener loop
|
||||||
@ -97,8 +99,7 @@ class Client(object):
|
|||||||
except OSError:
|
except OSError:
|
||||||
sleep_time = min_sleep + max_sleep*random.random()
|
sleep_time = min_sleep + max_sleep*random.random()
|
||||||
logging.warning('connection to the bettercap endpoint failed...')
|
logging.warning('connection to the bettercap endpoint failed...')
|
||||||
logging.warning('retrying connection in {} sec'.format(sleep_time))
|
pwnagotchi.restart("AUTO")
|
||||||
await asyncio.sleep(sleep_time)
|
|
||||||
continue
|
continue
|
||||||
|
|
||||||
def run(self, command, verbose_errors=True):
|
def run(self, command, verbose_errors=True):
|
||||||
|
Reference in New Issue
Block a user