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