使用send命令时,“ L3PacketSocket”对象没有属性“ ins”

时间:2019-04-27 13:59:28

标签: python ubuntu udp scapy attributeerror

我正在尝试使用UDP协议发送数据包。我在Ubuntu上运行Python 3并使用scapy。但是,我收到以下错误消息:“ AttributeError:'L2Socket'对象没有属性'ins'”。完整的错误消息可以在下面看到。

我在这里https://github.com/secdev/scapy/issues/1868中读到,由于Ubuntu是通过虚拟机运行的,因此可能无法以root身份运行可能是一个问题。任何帮助都超过了欢迎!

以下是有问题的代码行:

from scapy.all import *
packet = IP(dst="127.0.0.1")/UDP(dport=123)/Raw(load="123")
send(packet)

Here is the error message

1 个答案:

答案 0 :(得分:0)

您需要以root(sudo)身份启动Scapy。

仔细检查错误:它首先说“不允许操作”。 您引用的错误是第一个失败的结果。

已经多次报告,并且第二个错误已在主服务器上修复:https://github.com/secdev/scapy/issues/1942

Scapy将无法在没有root的情况下打开Raw套接字。这是Linux的限制。