了解斯卡皮"Mac address to reach destination not found. Using broadcast."警告



如果我生成一个没有任何上层有效负载的以太网帧,并使用 sendp() 在第二层发送它,那么我会收到"Mac address to reach destination not found. Using broadcast."警告,并且连接到线的帧确实使用 ff:ff:ff:ff:ff:ff:ff:ff 作为目标 MAC 地址。为什么会这样?斯卡皮不应该准确地发送我构建的框架吗?

我精心制作的包可以在下面看到:

>>> ls(x)
dst        : DestMACField         = '01:00:0c:cc:cc:cc' (None)
src        : SourceMACField       = '00:11:22:33:44:55' (None)
type       : XShortEnumField      = 0               (0)
>>> sendp(x, iface="eth0")
WARNING: Mac address to reach destination not found. Using broadcast.
.
Sent 1 packets.
>>> 

遇到此问题的大多数人错误地使用了send() (或sr()sr1()srloop()而不是sendp() (或srp()srp1()srploop())。根据记录,像send()这样的"不p"功能用于发送第3层数据包(send(IP())),而"with-p"变体用于发送第2层数据包(sendp(Ether() / IP()))。

如果您像下面那样定义x并使用sendp()(而不是send())并且您仍然遇到此问题,您可能应该尝试使用项目的 git 存储库中的最新版本(请参阅 https://github.com/secdev/scapy)。

我试过:

>>> x = Ether(src='01:00:0c:cc:cc:cc', dst='00:11:22:33:44:55')
>>> ls(x)
dst        : DestMACField         = '00:11:22:33:44:55' (None)
src        : SourceMACField       = '01:00:0c:cc:cc:cc' (None)
type       : XShortEnumField      = 0               (0)
>>> sendp(x, iface='eth0')
.
Sent 1 packets.

同时我正在运行 tcpdump:

# tcpdump -eni eth0 ether host 00:11:22:33:44:55
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on eth0, link-type EN10MB (Ethernet), capture size 65535 bytes
12:33:47.774570 01:00:0c:cc:cc:cc > 00:11:22:33:44:55, 802.3, length 14: [|llc]

相关内容

最新更新