PermissionError: [Errno 1] Operation not permitted

PermissionError: [Errno 1] Operation not permitted

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

send(IP(dst="1.2.3.4")/ICMP())

这很完美,而 运行 在 python 脚本上。

from scapy.all import *
p=send(IP(dst="1.2.3.4")/ICMP())

抛出错误

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>

我正在尝试解决它,但不能,我是新手,所以了解不多。就我的搜索而言,这个问题与套接字有关。但是我还是需要一些简单的解释才能理解。

这意味着您需要使用 sudo/admin 权限启动您的脚本。