PermissionError: [Errno 1] Operation not allowed

I am completely new to python, linux RPI and scapy. I am trying to send some packages using scapy.
On the command line (only if superuser privileges are on scapy)

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

      

This works great when running on a python script.

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

      

Gives an error message

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'm trying to work it out but can't, but I'm new to the environment so I don't know much. As far as my search goes, this issue has to do with sockets. But I still need a simple explanation to understand.

+3


source to share


1 answer


This means you need to run your script as sudo / admin.



+4


source







All Articles