Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot launch Scapy on Windows 11 with monitor mode enabled #4646

Open
alexis-opolka opened this issue Jan 27, 2025 · 0 comments
Open

Cannot launch Scapy on Windows 11 with monitor mode enabled #4646

alexis-opolka opened this issue Jan 27, 2025 · 0 comments

Comments

@alexis-opolka
Copy link

Brief description

When we try to launch sniff() on Windows 11 with the monitor mode enabled, we only get a OSError: Generic Error

Scapy version

https://github.com/secdev/scapy.git@3cbb62e04637f686867f9693275c14be938a229f

Python version

Python 3.12.8

Operating system

Microsoft Windows 11 [Version 10.0.26100.2605]

Additional environment information

Npcap was installed with only raw 802.11 support (and monitor mode).

How to reproduce

from scapy.all import sniff

if __name__ == "__main__":

    try:
        packets = sniff(iface="Ethernet", count=4, filter="arp", monitor=True)

    except OSError as e:
        print("OSError:", e)
        exit(1)

Actual result

The unhandled code will print out this traceback:

Traceback (most recent call last):
  File "C:\Users\<user>\Documents\depots\sae-501\issues\scapy_win_oserror.py", line 5, in <module>
    packets = sniff(iface="Ethernet", count=4, filter="arp", monitor=True)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\<user>\AppData\Local\Programs\Python\Python312\Lib\site-packages\scapy\sendrecv.py", line 1424, in sniff
    sniffer._run(*args, **kwargs)
  File "C:\Users\<user>\AppData\Local\Programs\Python\Python312\Lib\site-packages\scapy\sendrecv.py", line 1273, in _run
    sniff_sockets[_RL2(iface)(type=ETH_P_ALL, iface=iface,
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\<user>\AppData\Local\Programs\Python\Python312\Lib\site-packages\scapy\arch\libpcap.py", line 530, in __init__
    fd = open_pcap(
         ^^^^^^^^^^
  File "C:\Users\<user>\AppData\Local\Programs\Python\Python312\Lib\site-packages\scapy\arch\windows\__init__.py", line 784, in open_pcap
    return _orig_open_pcap(iface_network_name, *args, **kargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\<user>\AppData\Local\Programs\Python\Python312\Lib\site-packages\scapy\arch\libpcap.py", line 366, in __init__
    raise OSError(errmsg)
OSError: Generic error

N.B. The user name has been omitted.

Expected result

No unhandled error + the packets from my network.

Related resources

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant