0

I want to play a bit with scapy to get familiar with crafting and working with packets. So for so good. But when I want to send a packet an OS error appears: Saying that it can not set hardware filter to promiscuous mode. My OS is Windows 11. I am using the interactive mode of Scapy with admin rights. I am connected to my router through LAN.

I am trying to do this:

b = Ether(dst = "ff:ff:ff:ff:ff:ff")
send(b)

Error:

Traceback (most recent call last):
File "<console>", line 1, in <module>
  File "C:\Users\****\AppData\Roaming\Python\Python311\site-packages\scapy\sendrecv.py", line 445, in send
    return _send(
           ^^^^^^
  File "C:\Users\****\AppData\Roaming\Python\Python311\site-packages\scapy\sendrecv.py", line 414, in _send
    socket = socket or _func(iface)(iface=iface, **kargs)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\****\AppData\Roaming\Python\Python311\site-packages\scapy\arch\libpcap.py", line 529, in __init__
    fd = open_pcap(iface, MTU, self.promisc, 100,
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\****\AppData\Roaming\Python\Python311\site-packages\scapy\arch\windows\__init__.py", line 770, in open_pcap
    return _orig_open_pcap(iface_network_name, *args, **kargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\****\AppData\Roaming\Python\Python311\site-packages\scapy\arch\libpcap.py", line 338, in __init__
    raise OSError(error)
OSError: \Device\NPF_{21330BA1-83F1-4778-B42D-89E43A29CE77}: failed to set hardware filter to promiscuous mode: Ein an das System angeschlossenes Gerät funktioniert nicht.  (31)

It does not matter how I specify the packet (different dst etc.) and even if I manually set the interface it still throws the error.

3
  • You probably need Administrator privilege to do this.
    – Barmar
    Commented Dec 5, 2023 at 22:20
  • as I remember tools like wireshark (and maybe scapy too) to work with packages needed C/C++ library pcap (Linux) or winpcap (WIndows) or npca (Windows) (to get promiscuous mode). But on some systems it may still need admin privileges.
    – furas
    Commented Dec 6, 2023 at 1:26
  • I opened scapy with admin rights (as mentioned). Also I do use wireshark as well so I have installed pcap as well. Don't really know whats going on here.
    – user13021032
    Commented Dec 9, 2023 at 22:08

1 Answer 1

0

There are two options:

conf.sniff_promisc = False

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.