【问题标题】:Understanding the Scapy "Mac address to reach destination not found. Using broadcast." warning了解 Scapy “未找到到达目的地的 Mac 地址。使用广播。”警告
【发布时间】:2013-09-08 14:57:55
【问题描述】:

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

我制作的包如下所示:

>>> 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.
>>> 

【问题讨论】:

  • 我无法重现这个。您能否发布您用于创建数据包的行、您的 scapy 版本以及您正在运行的平台?

标签: scapy


【解决方案1】:

大多数遇到此问题的人都错误地使用send()(或sr()sr1()srloop()而不是sendp()(或@ 987654327@、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]

【讨论】:

    猜你喜欢
    • 2022-07-10
    • 2019-04-19
    • 2021-12-05
    • 2015-06-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-05-28
    相关资源
    最近更新 更多