Add debug print statements to IndexedCapture for packet indexing insights

This commit is contained in:
Yaro Kasear 2025-04-29 10:32:43 -05:00
parent dca27cf034
commit 32488ccbe2

View file

@ -72,6 +72,27 @@ class IndexedCapture:
capture.close()
# Debugging indexing
# 1. Inspect self.channel_to_aps and self.channel_to_clients
# Are they empty?
print(f"Indexed {len(self.time_index)} packets.")
# Are they missing just specific channels?
print(f"Channels with APs: {len(self.channel_to_aps)}")
# Are they populated, but wrong?
print(f"Channels with clients: {len(self.channel_to_clients)}")
# How many channels were seen?
print(f"Total channels: {len(set(self.channel_to_aps.keys()).union(set(self.channel_to_clients.keys())))}")
# How many APS were put into channel_to_aps?
print(f"Total APs: {sum(len(aps) for aps in self.channel_to_aps.values())}")
# How many clients were put into channel_to_clients?
print(f"Total clients: {sum(len(clients) for clients in self.channel_to_clients.values())}")
# Print out a few entries from channel_to_clients.
for channel, clients in list(self.channel_to_clients.items())[:5]:
print(f"Channel {channel}: {len(clients)} clients")
# Print out a few entries from channel_to_aps.
for channel, aps in list(self.channel_to_aps.items())[:5]:
print(f"Channel {channel}: {len(aps)} APs")
def _process_management_frame(self, packet, wlan, radio, channel):
try:
mgt = packet.get_multiple_layers('wlan.mgt')[0]