简体   繁体   English

Scapy - 嗅探三个接口中的两个

[英]Scapy - sniffing 2 interfaces out of three

I'm using Scapy 2.2.0 and Python 2.6 to sniff on Windows 7. I know that you can supply the iface parameter to the sniff function. 我正在使用Scapy 2.2.0和Python 2.6来嗅探Windows 7.我知道你可以为sniff函数提供iface参数。 for example: 例如:

sniff(count=5,iface = 'eth0', prn=lambda p:p.show())

If you don't supply this parameter, it sniffs in all interfaces. 如果您不提供此参数,它会在所有接口中嗅探。 But is there a way to choose 2 out of 3 interfaces? 但有没有办法选择3个接口中的2个? something like this: (it doesn't work) 这样的事情:(它不起作用)

sniff(count=5, iface='eth0, eth14', prn=lambda p:p.show())

从版本2.3.3开始,现在可以使用数组指定多个接口,如scapy / usage.rst中的此示例:

   sniff(iface=["eth1","eth2"], prn=lambda x: x.sniffed_on+": "+x.summary())

答案很简短:没有办法做到这一点。

You could use threads in python and sniff each interface in a different thread: 你可以在python中使用线程并在另一个线程中嗅探每个接口:

https://docs.python.org/2/library/threading.html https://docs.python.org/2/library/threading.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM