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

Sniffign in Monitor Mode on Windows Throws Exception - libpcap & WLanHelper path issue #4330

Open
FrequenzForce opened this issue Mar 21, 2024 · 0 comments

Comments

@FrequenzForce
Copy link

Brief description

On a windows machine, with scapy 2.5.0 and npcap 1.79, when calling sniff like this:

a=sniff(iface="Valid Wifi Interface Name",monitor=True,count=5)

Scapy throws an exception due to a path formulation error for WLanHelper.

Scapy version

2.5

Python version

3.12

Operating system

Windows LATEST

Additional environment information

pip show scapy

Name: scapy
Version: 2.5.0
Summary: Scapy: interactive packet manipulation tool
Home-page: https://scapy.net
Author: Philippe BIONDI
Author-email: guillaume@valadon.net
License: GPL-2.0-only
Location: C:\Users\user\AppData\Local\Programs\Python\Python312\Lib\site-packages
Requires:
Required-by:

How to reproduce

  • Install scapy 2.5 per docs
  • Install npcap 1.79
  • Call "sniff" - either interactively or in code - sniff(iface="Valid Wifi Interface Name",monitor=True,count=5)

Actual result

'\WlanHelper.exe' is not recognized as an internal or external command,
operable program or batch file.
Traceback (most recent call last):
File "", line 1, in
File "C:\Users\user\AppData\Local\Programs\Python\Python312\Lib\site-packages\scapy\sendrecv.py", line 1311, in sniff
sniffer.run(*args, **kwargs)
File "C:\Users\user\AppData\Local\Programs\Python\Python312\Lib\site-packages\scapy\sendrecv.py", line 1171, 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 481, in init
fd = open_pcap(
^^^^^^^^^^
File "C:\Users\user\AppData\Local\Programs\Python\Python312\Lib\site-packages\scapy\arch\windows_init
.py", line 766, in open_pcap
monitored = iface.ismonitor()
^^^^^^^^^^^^^^^^^
File "C:\Users\user\AppData\Local\Programs\Python\Python312\Lib\site-packages\scapy\arch\windows_init
.py", line 413, in ismonitor
res = (self.mode() == "monitor")
^^^^^^^^^^^
File "C:\Users\user\AppData\Local\Programs\Python\Python312\Lib\site-packages\scapy\arch\windows_init
.py", line 404, in mode
return self.npcap_get("mode")
^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\user\AppData\Local\Programs\Python\Python312\Lib\site-packages\scapy\arch\windows_init
.py", line 396, in _npcap_get
raise OSError(res.decode("utf8", errors="ignore"))
OSError

Expected result

<Sniffed: TCP:0 UDP:0 ICMP:0 Other:5>

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