Add debug print statements to query_metrics for improved packet tracking

This commit is contained in:
Yaro Kasear 2025-04-29 11:20:36 -05:00
parent c6fb5ca049
commit a1aefedaff

View file

@ -138,7 +138,6 @@ class IndexedCapture:
def query_metrics(self, start_ts, end_ts, ap_bssid, ap_channel):
packets = self.get_packets_in_time_range(start_ts, end_ts)
print(f"[DEBUG] Packets in window: {len(packets)} between {start_ts} and {end_ts}")
# Build local windowed structures
window_clients = defaultdict(set)
@ -163,18 +162,22 @@ class IndexedCapture:
else:
continue
print(f"[DEBUG] Packet ts={packet.frame_info.time_epoch}, freq={freq}, resolved_channel={channel}, ap_channel={ap_channel}")
# Track APs (beacons / probe responses only!)
subtype = int(getattr(wlan, 'type_subtype', '0'), 16)
if subtype in (5, 8) and bssid:
window_aps[channel].add(bssid)
if channel == ap_channel:
print(f"[DEBUG] Adding bssid={bssid} to window_aps[{channel}]")
# Track clients
for mac in (sa, da):
if mac and mac != 'ff:ff:ff:ff:ff:ff':
window_clients[channel].add(mac)
if channel == ap_channel:
print(f"[DEBUG] Adding mac={mac} to window_clients[{channel}]")
# Track signals
signal = getattr(radio, 'dbm_antsignal', None)
if signal: