From c2a808a431126a33fe23847d9ca8c59f7e58683f Mon Sep 17 00:00:00 2001 From: Yaro Kasear Date: Fri, 11 Apr 2025 13:44:03 -0500 Subject: [PATCH] Add frequency lookup functions for channel details --- kismet_enrich_from_pcap.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/kismet_enrich_from_pcap.py b/kismet_enrich_from_pcap.py index 751681f..ffc888e 100755 --- a/kismet_enrich_from_pcap.py +++ b/kismet_enrich_from_pcap.py @@ -53,6 +53,15 @@ CHANNEL_LOOKUP_TABLE = { 165: {"freq": 5825, "dfs": False, "band": "UNII-3"}, } +FREQ_LOOKUP_TABLE = {v["freq"]: ch for ch, v in CHANNEL_LOOKUP_TABLE.items()} + +def get_channel_from_freq(freq): + return FREQ_LOOKUP_TABLE.get(freq, None) + +def get_freq_details(channel): + return CHANNEL_LOOKUP_TABLE.get(channel, None) + + def parse_args(): parser = argparse.ArgumentParser() parser.add_argument('--csv', required=True, help='Input speedtest CSV') @@ -95,7 +104,7 @@ def get_clients_on_ap(capture, ap_bssid): return len(clients) def get_clients_on_channel(capture, ap_channel, ap_bssid): - from_channel_freq = CHANNEL_LOOKUP_TABLE.get(ap_channel, {}).get('freq', None) + from_channel_freq = get_channel_from_freq(ap_channel) if not from_channel_freq: print(f"[!] Invalid channel: {ap_channel}") return 0