win支持度不好,sr貌似是不能用,只有在linux下可以,其它函数是可以的
如何抓取vlan,参考:python - Why isn't scapy capturing VLAN tag information?
结果如下:
>>> conf.use_pcap = True #步骤1
>>> import scapy.arch.pcapdnet #步骤2
>>> conf.L2listen
#确认此处为libpcap
>>> p = sniff(iface='eth0',count=2,filter='udp',timeout=10)
WARNING: __del__: don't know how to close the file descriptor. Bugs ahead ! Please report this bug. #报错原因未知
>>>
>>> p[0] #结果如下,抓到vlan 100
>>>>