PermissionError:[Errno 1]不允许操作(PermissionError: [Errno 1] Operation not permitted)

编程入门 行业动态 更新时间:2024-10-24 00:29:52
PermissionError:[Errno 1]不允许操作(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>

我试图解决它,但不能,我是新的环境因此不知道多少。 就我的搜索而言,这个问题与套接字有关。 但我仍然需要一些简单的解释来理解。

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())

This works perfectly, while running on python script.

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

Throws an error

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.

更多推荐

本文发布于:2023-08-07 02:57:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1460000.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:不允许   操作   Errno   PermissionError   Operation

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!