1# This script is used for printing out the number of packets in a pcap file 2 3import sys 4 5from scapy.all import rdpcap 6 7file_name = sys.argv[1] 8try: 9 stream = rdpcap(file_name) 10 n = 0 11 for packet in stream: 12 n += 1 13 print(n) 14except Exception: 15 pass 16