Add frequency lookup functions for channel details
This commit is contained in:
parent
0801d97f54
commit
c2a808a431
1 changed files with 10 additions and 1 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue