本文介绍了使用send命令时,"L3PacketSocket"对象没有属性"ins"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I am trying to send a packet using a UDP protocol. I am running Python 3 on Ubuntu and using scapy. However, I get the following error message: "AttributeError: 'L2Socket' object has no attribute 'ins'". The full error message can be seen below.

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

I read here https://github.com/secdev/scapy/issues/1868 that it may be a problem with not being able to run as root because Ubuntu is run through a virtual machine. Any help is more than welcome!

以下是有问题的代码行:

These are the lines of code in question:

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

这是错误消息

推荐答案

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

You need to start Scapy as root (sudo).

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

Look at the error closely: it first says "Operation not permitted".The error you're quoting is a consequence of the first one failing.

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

It was already reported multiple times & the second error was fixed on master: https://github.com/secdev/scapy/issues/1942

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

Scapy won't be able to run open a Raw socket without root. That's a Linux restriction.

这篇关于使用send命令时,"L3PacketSocket"对象没有属性"ins"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-30 10:19