diff --git a/enrich.py b/enrich.py index d0c44a7..ab7512b 100755 --- a/enrich.py +++ b/enrich.py @@ -317,8 +317,7 @@ def analyze_pcap(pcapng_path, start_ts, end_ts, ap_bssid, ap_channel): try: print(f"[DEBUG] Layers: {[layer.layer_name for layer in packet.layers]}") - if 'radiotap' not in packet or 'wlan' not in packet or not 'wlan.mgt' in packet.get_multiple_layers('wlan.mgt'): - print(f"[DEBUG] Skipping packet due to missing layers: {packet}") + if 'radiotap' not in packet or 'wlan' not in packet: continue radio = packet.radiotap @@ -334,7 +333,12 @@ def analyze_pcap(pcapng_path, start_ts, end_ts, ap_bssid, ap_channel): if subtype not in (5, 8): # Probe Response or Beacon continue - ssid = getattr(packet.wlan.mgt, 'ssid', None) + try: + mgt = packet.get_multiple_layers('wlan.mgt')[0] + ssid = mgt.get_field('ssid') + except (IndexError, AttributeError): + continue + bssid = getattr(wlan, 'bssid', '').lower() # For debugging purposes, print the SSID and BSSID