Add tracking for deadpoint candidates and unlinked devices in AP detection

This commit is contained in:
Yaro Kasear 2025-05-01 15:01:19 -05:00
parent fdc38e6413
commit 4ed8082481

View file

@ -25,6 +25,8 @@ target_ap_bssid = None
beacon_counts = defaultdict(int)
current_channel = None
include_probes = False
deadpoint_candidates = set()
unlinked_candidates = set()
# === Signal handling ===
def stop_sniff(signum, frame):
@ -86,6 +88,7 @@ def handle_packet(pkt):
beacon_counts[a2] += 1
if beacon_counts[a2] > 1:
aps.add(a2)
deadpoint_candidates.add(a2)
ssid = parse_ssid(pkt)
if ssid:
ssid_map[a2] = ssid
@ -98,6 +101,8 @@ def handle_packet(pkt):
for mac in (sa, da):
if is_unicast(mac) and mac != target_ap_bssid:
clients[mac] += 1
if mac not in aps:
unlinked_candidates.add(mac)
# Track clients talking to the same AP we're connected to
if target_ap_bssid:
@ -134,7 +139,9 @@ def write_csv(outfile):
"CiscoAvgReportedClients": "N/A",
"CiscoMaxReportedClients": "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)
@ -174,9 +181,11 @@ def print_suspect_aps():
print("\n[?] Suspect SSIDs (possibly printers, IoT, weird stuff):")
suspects = []
keywords = ("setup", "direct-", "hp", "epson", "canon", "brother", "smart", "wifi-", "printer")
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))
if suspects:
for bssid, ssid in suspects:
print(f" - {bssid} (SSID: {ssid})")