import pcap # 安装的是pypcap,本博客有安装方法,不过也比较乱,试试吧.import dpktimport socketimport datetime def sniffer(str): pc = pcap.pcap() for timestamp, buf in pc: eth = dpkt.ethernet.Ethernet(buf) if not isinstance(eth.data, dpkt.ip.IP): print('Non IP Packet type not…