Refactor get_clients_on_channel to remove redundant debug prints and improve clarity

This commit is contained in:
Yaro Kasear 2025-04-14 10:16:10 -05:00
parent eb74eb3962
commit 7cdb89b203

View file

@ -110,11 +110,6 @@ def get_clients_on_channel(capture, ap_channel, ap_bssid):
print(f"[!] Could not parse channel number: {ap_channel}")
return 0
# For debugging purposes, we can print the channel details
channel_details = get_freq_details(ap_channel)
if channel_details:
print(f"[+] Channel {ap_channel} details: {channel_details}")
clients = set()
for packet in capture:
@ -122,27 +117,14 @@ def get_clients_on_channel(capture, ap_channel, ap_bssid):
if 'radiotap' not in packet or 'wlan' not in packet:
continue
print(f"[DEBUG] Packet has channel_freq: {hasattr(packet.radiotap, 'channel_freq')}, freq: {getattr(packet.radiotap, 'channel_freq', 'N/A')}")
radio = packet.radiotap
wlan = packet.wlan
packet_freq = int(getattr(radio, 'channel_freq', -1))
packet_channel = get_channel_from_freq(packet_freq)
# For debugging purposes, we can print the frequency and channel
if packet_channel:
print(f"[+] Packet Frequency: {packet_freq} MHz, Channel: {packet_channel}")
else:
print(f"[!] Packet Frequency: {packet_freq} MHz, Channel: Unknown")
if packet_channel == -1:
print(f"[!] Packet channel not found in lookup table.")
continue
if packet_channel == 0:
print(f"[!] Packet channel is zero, skipping.")
continue
if packet_channel == 255:
print(f"[!] Packet channel is 255, skipping.")
continue
if packet_channel != ap_channel:
continue