Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
2.0k views
in Technique[技术] by (71.8m points)

python 3.4 - PermissionError: [Errno 1] Operation not permitted

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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

This means that you need to start your script with sudo/admin rights.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

56.6k users

...