diff --git a/listener.py b/listener.py index b525054..551691b 100755 --- a/listener.py +++ b/listener.py @@ -86,15 +86,18 @@ def handle_packet(pkt): ssid_map[a2] = ssid # === Track all seen clients === - if is_unicast(a1) and a1 not in aps: - clients[a1] += 1 - if is_unicast(a2) and a2 not in aps: - clients[a2] += 1 + 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 + # Track clients talking to the same AP we're connected to if target_ap_bssid: if a1 and a2: - if target_ap_bssid in (a1.lower(), a2.lower()): + if target_ap_bssid in (a1, a2): peer = a2 if a1 == target_ap_bssid else a1 if is_unicast(peer) and peer not in aps: ap_clients[target_ap_bssid][peer] += 1