Add tracking for deadpoint candidates and unlinked devices in AP detection
This commit is contained in:
parent
fdc38e6413
commit
4ed8082481
1 changed files with 11 additions and 2 deletions
13
listener.py
13
listener.py
|
@ -25,6 +25,8 @@ target_ap_bssid = None
|
||||||
beacon_counts = defaultdict(int)
|
beacon_counts = defaultdict(int)
|
||||||
current_channel = None
|
current_channel = None
|
||||||
include_probes = False
|
include_probes = False
|
||||||
|
deadpoint_candidates = set()
|
||||||
|
unlinked_candidates = set()
|
||||||
|
|
||||||
# === Signal handling ===
|
# === Signal handling ===
|
||||||
def stop_sniff(signum, frame):
|
def stop_sniff(signum, frame):
|
||||||
|
@ -86,6 +88,7 @@ def handle_packet(pkt):
|
||||||
beacon_counts[a2] += 1
|
beacon_counts[a2] += 1
|
||||||
if beacon_counts[a2] > 1:
|
if beacon_counts[a2] > 1:
|
||||||
aps.add(a2)
|
aps.add(a2)
|
||||||
|
deadpoint_candidates.add(a2)
|
||||||
ssid = parse_ssid(pkt)
|
ssid = parse_ssid(pkt)
|
||||||
if ssid:
|
if ssid:
|
||||||
ssid_map[a2] = ssid
|
ssid_map[a2] = ssid
|
||||||
|
@ -98,6 +101,8 @@ def handle_packet(pkt):
|
||||||
for mac in (sa, da):
|
for mac in (sa, da):
|
||||||
if is_unicast(mac) and mac != target_ap_bssid:
|
if is_unicast(mac) and mac != target_ap_bssid:
|
||||||
clients[mac] += 1
|
clients[mac] += 1
|
||||||
|
if mac not in aps:
|
||||||
|
unlinked_candidates.add(mac)
|
||||||
|
|
||||||
# Track clients talking to the same AP we're connected to
|
# Track clients talking to the same AP we're connected to
|
||||||
if target_ap_bssid:
|
if target_ap_bssid:
|
||||||
|
@ -134,7 +139,9 @@ def write_csv(outfile):
|
||||||
"CiscoAvgReportedClients": "N/A",
|
"CiscoAvgReportedClients": "N/A",
|
||||||
"CiscoMaxReportedClients": "N/A",
|
"CiscoMaxReportedClients": "N/A",
|
||||||
"NumberofBSSIDsOnSSID": "N/A",
|
"NumberofBSSIDsOnSSID": "N/A",
|
||||||
"NumberofChannelsOnSSID": "N/A"
|
"NumberofChannelsOnSSID": "N/A",
|
||||||
|
"UnlinkedDevices": len(unlinked_candidates),
|
||||||
|
"Deadpoints": len([ap for ap in deadpoint_candidates if not ap_clients.get(ap)])
|
||||||
}
|
}
|
||||||
|
|
||||||
new_file = not os.path.exists(outfile)
|
new_file = not os.path.exists(outfile)
|
||||||
|
@ -174,9 +181,11 @@ def print_suspect_aps():
|
||||||
print("\n[?] Suspect SSIDs (possibly printers, IoT, weird stuff):")
|
print("\n[?] Suspect SSIDs (possibly printers, IoT, weird stuff):")
|
||||||
suspects = []
|
suspects = []
|
||||||
keywords = ("setup", "direct-", "hp", "epson", "canon", "brother", "smart", "wifi-", "printer")
|
keywords = ("setup", "direct-", "hp", "epson", "canon", "brother", "smart", "wifi-", "printer")
|
||||||
|
|
||||||
for bssid, ssid in ssid_map.items():
|
for bssid, ssid in ssid_map.items():
|
||||||
if any(kw in ssid.lower() for kw in keywords):
|
if any(kw in ssid.lower() for kw in keywords) or (bssid in deadpoint_candidates and not ap_clients.get(bssid)):
|
||||||
suspects.append((bssid, ssid))
|
suspects.append((bssid, ssid))
|
||||||
|
|
||||||
if suspects:
|
if suspects:
|
||||||
for bssid, ssid in suspects:
|
for bssid, ssid in suspects:
|
||||||
print(f" - {bssid} (SSID: {ssid})")
|
print(f" - {bssid} (SSID: {ssid})")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue