From 6591ea2e372e971b7d67603b5a8d7cde742d61aa 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 12a9ce8d..64eb35b1 100644 --- a/pwnagotchi/bettercap.py +++ b/pwnagotchi/bettercap.py @@ -44,8 +44,10 @@ class Client(object): 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):