Skip to content

Commit 70bffe5

Browse files
committed
changes to support plugins requesting parts of session, and get notice of events
1 parent 544314b commit 70bffe5

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

pwnagotchi/agent.py

+6
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,12 @@ async def _on_event(self, msg):
324324
found_handshake = False
325325
jmsg = json.loads(msg)
326326

327+
# give plugins access to the events
328+
try:
329+
plugins.on('bcap_%s' % re.sub(r"[^a-z0-9_]+", "_", jmsg['tag'].lower()), self, jmsg)
330+
except Exception as err:
331+
logging.error("Processing event: %s" % err)
332+
327333
if jmsg['tag'] == 'wifi.client.handshake':
328334
filename = jmsg['data']['file']
329335
sta_mac = jmsg['data']['station']

pwnagotchi/bettercap.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,10 @@ def __init__(self, hostname='localhost', scheme='http', port=8081, username='use
3131
self.websocket = "ws://%s:%s@%s:%d/api" % (username, password, hostname, port)
3232
self.auth = HTTPBasicAuth(username, password)
3333

34-
def session(self):
35-
r = requests.get("%s/session" % self.url, auth=self.auth)
34+
# session takes optional argument to pull a sub-dictionary
35+
# ex.: "session/wifi", "session/ble"
36+
def session(self, sess="session"):
37+
r = requests.get("%s/%s" % (self.url, sess), auth=self.auth)
3638
return decode(r)
3739

3840
async def start_websocket(self, consumer):

0 commit comments

Comments
 (0)