From 2bc45ad76261914e957b6590bbc817865140b70f Mon Sep 17 00:00:00 2001 From: Jenny Paxian Date: Fri, 27 Dec 2024 16:26:10 +0100 Subject: [PATCH] Support AP Name for FakeMobileClient --- tools/fakemobileclient.py | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/tools/fakemobileclient.py b/tools/fakemobileclient.py index 8e19c903..d46a674a 100644 --- a/tools/fakemobileclient.py +++ b/tools/fakemobileclient.py @@ -9,8 +9,10 @@ PORT = int(sys.argv[1]) if sys.argv[1:] else 8042 def get_from_lines(lines, keyword): - return next(iter(l for l in lines if l.startswith(keyword))).split(keyword)[1].strip() - + try: + return next(iter(l for l in lines if l.startswith(keyword))).split(keyword)[1].strip() + except StopIteration: + return class FakeMobileClientHandler(http.server.BaseHTTPRequestHandler): def do_GET(self): @@ -30,12 +32,19 @@ class FakeMobileClientHandler(http.server.BaseHTTPRequestHandler): stations = [] for data in output: lines = [l.strip() for l in data[5:].split('\n')] - stations.append({ + + station = { 'bssid': get_from_lines(lines, 'Address:'), 'ssid': get_from_lines(lines, 'ESSID:')[1:-1], 'level': int(get_from_lines(lines, 'Quality=').split('=')[-1][:-4]), 'frequency': int(float(get_from_lines(lines, 'Frequency:').split(' ')[0]) * 1000) - }) + } + + ap_name = get_from_lines(lines, 'IE: Unknown: DD0B000B86010300') + if (ap_name and ap_name != ""): + station['ap_name'] = bytearray.fromhex(ap_name).decode() + + stations.append(station) if not stations: continue