From e1f532b7316f433591f0080a24555b532fe1654f Mon Sep 17 00:00:00 2001 From: Sniffleupagus Date: Tue, 12 Dec 2023 19:37:56 -0800 Subject: [PATCH] allow session() to request a subtree of info --- pwnagotchi/bettercap.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pwnagotchi/bettercap.py b/pwnagotchi/bettercap.py index 1f9217d0b..592ac5c23 100644 --- a/pwnagotchi/bettercap.py +++ b/pwnagotchi/bettercap.py @@ -31,8 +31,10 @@ def __init__(self, hostname='localhost', scheme='http', port=8081, username='use self.websocket = "ws://%s:%s@%s:%d/api" % (username, password, hostname, port) self.auth = HTTPBasicAuth(username, password) - def session(self): - r = requests.get("%s/session" % self.url, auth=self.auth) + # session takes optional argument to pull a sub-dictionary + # ex.: "session/wifi", "session/ble" + def session(self, sess="session"): + r = requests.get("%s/%s" % (self.url, sess), auth=self.auth) return decode(r) async def start_websocket(self, consumer):