Fix display filter typo and add error handling for packet filtering in analyze_pcap function

This commit is contained in:
Yaro Kasear 2025-04-28 16:08:05 -05:00
parent 3675a5e97e
commit 24d9783bb9

View file

@ -30,7 +30,7 @@ def parse_args():
def analyze_pcap(pcapng_path, start_ts, end_ts, ap_bssid, ap_channel): def analyze_pcap(pcapng_path, start_ts, end_ts, ap_bssid, ap_channel):
display_filter = ( display_filter = (
"(wlan.fx.type_subtype == 8 || wlan.fx.type_subtype == 5 || wlan.fc.type == 2) && " "(wlan.fc.type_subtype == 8 || wlan.fc.type_subtype == 5 || wlan.fc.type == 2) && "
"(wlan.bssid || wlan.sa || wlan.da)" "(wlan.bssid || wlan.sa || wlan.da)"
) )
cap = pyshark.FileCapture( cap = pyshark.FileCapture(
@ -61,7 +61,11 @@ def analyze_pcap(pcapng_path, start_ts, end_ts, ap_bssid, ap_channel):
ssid_packet_counts = defaultdict(int) ssid_packet_counts = defaultdict(int)
try: try:
filtered_packets = filter_by_time(cap, start_ts, end_ts) try:
filtered_packets = filter_by_time(cap, start_ts, end_ts)
except Exception as e:
print(f"[!] Error filtering packets: {e}")
filtered_packets = []
( (
bssid_to_ssid, bssid_to_ssid,