blob: e3d98fc8ce2ba0366033cff86f98f247459ccb1e [file] [log] [blame]
Sui Chenb65280f2020-06-30 18:14:03 -07001# This script is used for printing out the number of packets in a pcap file
2
Sui Chenb65280f2020-06-30 18:14:03 -07003import sys
4
Patrick Williamsa3db66b2022-12-04 16:27:08 -06005from scapy.all import rdpcap
6
Sui Chenb65280f2020-06-30 18:14:03 -07007file_name = sys.argv[1]
8try:
9 stream = rdpcap(file_name)
10 n = 0
11 for packet in stream:
12 n += 1
13 print(n)
Patrick Williamsa3db66b2022-12-04 16:27:08 -060014except Exception:
Sui Chenb65280f2020-06-30 18:14:03 -070015 pass