From 7be1b48831f78c16a87b9822c8fd0fb93efca289 Mon Sep 17 00:00:00 2001 From: Yaro Kasear Date: Thu, 1 May 2025 10:52:20 -0500 Subject: [PATCH] Refactor client tracking in handle_packet to improve clarity and add debug logging for counted clients. --- listener.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/listener.py b/listener.py index 551691b..dd9183f 100755 --- a/listener.py +++ b/listener.py @@ -86,13 +86,14 @@ def handle_packet(pkt): ssid_map[a2] = ssid # === Track all seen clients === - 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 + if dot11.type == 2: + 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: + 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 if target_ap_bssid: