pcapy模块

安装

yum install -y epel-release

yum install -y pip gcc    gcc-c++   libpcap-devel python-devel

pip install pcapy

import pcapy as pc
reader = pc.open_live("ens9f0", 65536, 1, 2000)
dumper = reader.dump_open('pcapy_test.pcap')

for _ii in range(10):
hdr, pkt = reader.next()
dumper.dump(hdr, pkt)

05-08 08:21