mirror of
https://github.com/jayofelony/pwnagotchi.git
synced 2025-07-01 18:37:27 -04:00
changes to support plugins requesting parts of session, and get notice of events
This commit is contained in:
@ -324,6 +324,12 @@ class Agent(Client, Automata, AsyncAdvertiser, AsyncTrainer):
|
|||||||
found_handshake = False
|
found_handshake = False
|
||||||
jmsg = json.loads(msg)
|
jmsg = json.loads(msg)
|
||||||
|
|
||||||
|
# give plugins access to the events
|
||||||
|
try:
|
||||||
|
plugins.on('bcap_%s' % re.sub(r"[^a-z0-9_]+", "_", jmsg['tag'].lower()), self, jmsg)
|
||||||
|
except Exception as err:
|
||||||
|
logging.error("Processing event: %s" % err)
|
||||||
|
|
||||||
if jmsg['tag'] == 'wifi.client.handshake':
|
if jmsg['tag'] == 'wifi.client.handshake':
|
||||||
filename = jmsg['data']['file']
|
filename = jmsg['data']['file']
|
||||||
sta_mac = jmsg['data']['station']
|
sta_mac = jmsg['data']['station']
|
||||||
|
@ -31,8 +31,10 @@ class Client(object):
|
|||||||
self.websocket = "ws://%s:%s@%s:%d/api" % (username, password, hostname, port)
|
self.websocket = "ws://%s:%s@%s:%d/api" % (username, password, hostname, port)
|
||||||
self.auth = HTTPBasicAuth(username, password)
|
self.auth = HTTPBasicAuth(username, password)
|
||||||
|
|
||||||
def session(self):
|
# session takes optional argument to pull a sub-dictionary
|
||||||
r = requests.get("%s/session" % self.url, auth=self.auth)
|
# ex.: "session/wifi", "session/ble"
|
||||||
|
def session(self, sess="session"):
|
||||||
|
r = requests.get("%s/%s" % (self.url, sess), auth=self.auth)
|
||||||
return decode(r)
|
return decode(r)
|
||||||
|
|
||||||
async def start_websocket(self, consumer):
|
async def start_websocket(self, consumer):
|
||||||
|
Reference in New Issue
Block a user