Add type assertion and debug statements in query_metrics for AP channel validation
This commit is contained in:
parent
92015c4ba7
commit
a1cc33e842
1 changed files with 6 additions and 3 deletions
|
@ -137,6 +137,9 @@ class IndexedCapture:
|
||||||
]
|
]
|
||||||
|
|
||||||
def query_metrics(self, start_ts, end_ts, ap_bssid, ap_channel):
|
def query_metrics(self, start_ts, end_ts, ap_bssid, ap_channel):
|
||||||
|
ap_channel = int(ap_channel)
|
||||||
|
assert isinstance(ap_channel, int), f"ap_channel must be int, got {type(ap_channel)}"
|
||||||
|
|
||||||
packets = self.get_packets_in_time_range(start_ts, end_ts)
|
packets = self.get_packets_in_time_range(start_ts, end_ts)
|
||||||
|
|
||||||
# Build local windowed structures
|
# Build local windowed structures
|
||||||
|
@ -164,17 +167,17 @@ class IndexedCapture:
|
||||||
|
|
||||||
# Determine subtype
|
# Determine subtype
|
||||||
subtype = int(getattr(wlan, 'type_subtype', '0'), 16)
|
subtype = int(getattr(wlan, 'type_subtype', '0'), 16)
|
||||||
|
|
||||||
# Always debug if resolved channel == AP's channel
|
# Always debug if resolved channel == AP's channel
|
||||||
if channel == ap_channel:
|
if channel == ap_channel:
|
||||||
print(f"[DEBUG] Packet: subtype={subtype}, bssid={bssid}, sa={sa}, da={da}")
|
print(f"[DEBUG] Packet: subtype={subtype}, bssid={bssid}, sa={sa}, da={da}")
|
||||||
|
|
||||||
# Track APs (beacons / probe responses only)
|
# Track APs (beacons / probe responses only)
|
||||||
if subtype in (5, 8) and bssid:
|
if subtype in (5, 8) and bssid:
|
||||||
window_aps[channel].add(bssid)
|
window_aps[channel].add(bssid)
|
||||||
if channel == ap_channel:
|
if channel == ap_channel:
|
||||||
print(f"[DEBUG] [AP] Adding bssid={bssid} to window_aps[{channel}]")
|
print(f"[DEBUG] [AP] Adding bssid={bssid} to window_aps[{channel}]")
|
||||||
|
|
||||||
# Track clients (always)
|
# Track clients (always)
|
||||||
for mac in (sa, da):
|
for mac in (sa, da):
|
||||||
if mac and mac != 'ff:ff:ff:ff:ff:ff':
|
if mac and mac != 'ff:ff:ff:ff:ff:ff':
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue