Add debug output to get_aps_on_channel for packet validation

This commit is contained in:
Yaro Kasear 2025-04-15 09:07:04 -05:00
parent 8fdd4336d1
commit 9a13209620

View file

@ -167,16 +167,19 @@ def get_aps_on_channel(capture, ap_channel):
for packet in capture:
try:
if 'radiotap' not in packet or 'wlan' not in packet:
print(f"[!] Packet missing radiotap or wlan layer: {packet}")
continue
# Match channel frequency
freq = int(getattr(packet.radiotap, 'channel_freq', -1))
if freq != from_channel_freq:
print(f"[!] Frequency mismatch: {freq} != {from_channel_freq}")
continue
# Check for beacon or probe response
ts_hex = getattr(packet.wlan, 'type_subtype', None)
if ts_hex is None:
print(f"[!] Missing type_subtype in packet: {packet}")
continue
# For debugging purposes, display the type_subtype value with some sarcasm
@ -184,6 +187,7 @@ def get_aps_on_channel(capture, ap_channel):
ts = int(ts_hex, 16)
if ts not in (5, 8): # Probe Response or Beacon
print(f"[!] Not a probe response or beacon: {ts}")
continue
# Grab BSSID