Refactor client tracking in handle_packet to improve clarity and add debug logging for counted clients.

This commit is contained in:
Yaro Kasear 2025-05-01 10:52:20 -05:00
parent 021ea90d9a
commit 7be1b48831

View file

@ -86,13 +86,14 @@ def handle_packet(pkt):
ssid_map[a2] = ssid ssid_map[a2] = ssid
# === Track all seen clients === # === Track all seen clients ===
sa = dot11.addr2.lower() if dot11.addr2 else None if dot11.type == 2:
da = dot11.addr1.lower() if dot11.addr1 else None sa = dot11.addr2.lower() if dot11.addr2 else None
da = dot11.addr1.lower() if dot11.addr1 else None
for mac in (sa, da):
if is_unicast(mac) and mac != target_ap_bssid:
clients[mac] += 1
for mac in (sa, da):
if is_unicast(mac) and mac != target_ap_bssid:
print(f"[D] Counting client: {mac} (frame type: {dot11.type}, subtype: {dot11.subtype})")
clients[mac] += 1
# 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: