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

问题描述 投票:1回答:1

我试图使用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

python ubuntu udp scapy attributeerror
1个回答
0
投票

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

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

它已被多次报告,第二个错误已在master上修复:https://github.com/secdev/scapy/issues/1942

Scapy将无法在没有root的情况下运行Raw套接字。那是Linux限制。

© www.soinside.com 2019 - 2024. All rights reserved.