diff --git a/kismet_enrich_from_pcap.py b/kismet_enrich_from_pcap.py index 1d6bf35..cd042f6 100644 --- a/kismet_enrich_from_pcap.py +++ b/kismet_enrich_from_pcap.py @@ -31,6 +31,26 @@ def analyze_pcap(pcapng_path, start_ts, end_ts): def main(): args = parse_args() + cap = pyshark.FileCapture( + args.pcapng, + use_json=True, + include_raw=False, + keep_packets=False + ) + + # Checking if the pcapng file is valid + count = 0 + try: + for packet in cap: + count += 1 + if count > 0: + break + except Exception as e: + print(f"[!] Error reading pcapng file: {e}") + return + finally: + cap.close() + with open(args.csv, newline='') as infile, open(args.output, 'w', newline='', encoding='utf-8') as outfile: reader = csv.DictReader(infile) fieldnames = reader.fieldnames + [