PermissionError: [Errno 1] 不允许操作 [英] PermissionError: [Errno 1] Operation not permitted
问题描述
我对 python、linux RPI 和 scapy 完全陌生.我正在尝试使用 scapy 发送一些数据包.
在命令行上(仅当 scapy 具有超级用户权限时)
I am completely new to python, linux RPI and scapy. I am trying to send some packets using scapy.
On Command Line (only if super user privileges are given to scapy)
send(IP(dst="1.2.3.4")/ICMP())
这在 python 脚本上运行时效果很好.
This works perfectly, while running on python script.
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>
我正在尝试解决它,但无法解决,我对环境不熟悉,因此了解不多.就我的搜索而言,这个问题与套接字有关.但我还是需要一些简单的解释才能理解.
I am trying to solve it but cannot, I am new to the environment therefore don't know much. As far as my search goes this issue is relevant to sockets. But I still need some simple explanation to understand.
推荐答案
这意味着您需要以 sudo/admin 权限启动脚本.
This means that you need to start your script with sudo/admin rights.
这篇关于PermissionError: [Errno 1] 不允许操作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!