def read_pcap(path, lfilter=None):
"""Read pcap file and yields packets.
Args:
path (str): path to pcap file
lfilter (function, optional): function to filter returned packets. By
default all packets will be returned.
Yields:
obj: packet
"""
with scapy.PcapReader(path) as reader:
for packet in filter(lfilter, reader):
yield packet
评论列表
文章目录