相关疑难解决方法(0)

使用多个线程时,Scapy无法嗅探数据包

我将尝试用简化的示例来演示我的问题.

以下是一个非常简单的(单线程)数据包嗅探器(ICMP):

from scapy.all import *

m_iface = "wlan0"
m_dst = "192.168.0.1"

def print_summary(pkt):
  print pkt.summary()

def plain_sniff():
  sniff(iface = m_iface, count = 10, filter = "icmp and src {0}".format(m_dst), prn = print_summary)
Run Code Online (Sandbox Code Playgroud)

这个嗅探器工作正常,我得到输出:

WARNING: No route found for IPv6 destination :: (no default route?)
Ether / IP / ICMP 192.168.0.1 > 192.168.0.9 echo-reply 0 / Raw
Ether / IP / ICMP 192.168.0.1 > 192.168.0.9 echo-reply 0 / Raw
Ether / IP / ICMP 192.168.0.1 > 192.168.0.9 echo-reply 0 / …
Run Code Online (Sandbox Code Playgroud)

python packet-capture scapy

7
推荐指数
1
解决办法
1万
查看次数

标签 统计

packet-capture ×1

python ×1

scapy ×1