相关疑难解决方法(0)

PermissionError: [Errno 1] 不允许操作

我对 python、linux RPI 和 scapy 完全陌生。我正在尝试使用 scapy 发送一些数据包。
在命令行上(仅当授予 scapy 超级用户权限时)

send(IP(dst="1.2.3.4")/ICMP())
Run Code Online (Sandbox Code Playgroud)

这在 python 脚本上运行时非常有效。

from scapy.all import *
p=send(IP(dst="1.2.3.4")/ICMP())
Run Code Online (Sandbox Code Playgroud)

抛出错误

Traceback (most recent call last):
  File "<pyshell#19>", line 1, in <module>
    send(IP(dst="1.2.3.4")/ICMP())
  File "/usr/local/lib/python3.4/dist-packages/scapy/sendrecv.py",line   255, in send
    __gen_send(conf.L3socket(*args, **kargs), x, inter=inter, loop=loop, count=count,verbose=verbose, realtime=realtime)
  File "/usr/local/lib/python3.4/dist-packages/scapy/arch/linux.py", line 326, in __init__
    self.ins = socket.socket(socket.AF_PACKET, socket.SOCK_RAW, socket.htons(type))
  File "/usr/lib/python3.4/socket.py", line 123, in __init__
    _socket.socket.__init__(self, family, type, proto, fileno)
PermissionError: [Errno 1] Operation not permitted<br>
Run Code Online (Sandbox Code Playgroud)

我正在尝试解决它,但不能,我对环境不熟悉,因此了解不多。就我的搜索而言,这个问题与套接字有关。但我仍然需要一些简单的解释才能理解。

scapy python-3.4

4
推荐指数
1
解决办法
2万
查看次数

标签 统计

python-3.4 ×1

scapy ×1