[Python] PROBLEM WHILE USING SCAPY (Permission denied)

Discussão em 'Python' iniciado por Stack, Abril 8, 2025.

  1. Stack

    Stack Membro Participativo

    I am trying to make a simple network scanner in python3 which can scan whole devices on LAN. That's when i heard about Scapy. However, whenever i try to run my program, it returns an error "PermissionError: [Errno 13] Permission denied"

    Here's my code:

    import scapy.all as scapy


    def scan(ip):

    scapy.arping(ip)

    scan("192.168.43.1")


    It would help me a lot if you guys can fix this issue. Thanks for reading.

    COMPLETE OUTPUT:

    Traceback (most recent call last):
    File "network_scanner.py", line 7, in <module>
    scan("192.168.43.1")
    File "network_scanner.py", line 5, in scan
    scapy.arping(ip)
    File "/usr/local/lib/python3.8/dist-
    packages/scapy/layers/l2.py", line 628, in arping
    ans, unans = srp(Ether(dst="ff:ff:ff:ff:ff:ff") /
    ARP(pdst=net), verbose=verbose, # noqa: E501
    File "/usr/local/lib/python3.8/dist-
    packages/scapy/sendrecv.py", line 503, in srp
    s = conf.L2socket(promisc=promisc, iface=iface,
    File "/usr/local/lib/python3.8/dist-
    packages/scapy/arch/linux.py", line 467, in __init__
    self.ins = socket.socket(socket.AF_PACKET,
    socket.SOCK_RAW, socket.htons(type)) # noqa: E501
    File "/usr/lib/python3.8/socket.py", line 231, in __init__
    _socket.socket.__init__(self, family, type, proto, fileno)
    PermissionError: [Errno 13] Permission denied

    Continue reading...

Compartilhe esta Página