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