You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: doc/scapy/installation.rst
-35Lines changed: 0 additions & 35 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -309,41 +309,6 @@ Screenshots
309
309
:scale:80
310
310
:align:center
311
311
312
-
Known bugs
313
-
^^^^^^^^^^
314
-
315
-
You may bump into the following bugs, which are platform-specific, if Scapy didn't manage work around them automatically:
316
-
317
-
* You may not be able to capture WLAN traffic on Windows. Reasons are explained on the `Wireshark wiki <https://wiki.wireshark.org/CaptureSetup/WLAN>`_ and in the `WinPcap FAQ <https://www.winpcap.org/misc/faq.htm>`_. Try switching off promiscuous mode with ``conf.sniff_promisc=False``.
318
-
* Packets sometimes cannot be sent to localhost (or local IP addresses on your own host).
319
-
320
-
Winpcap/Npcap conflicts
321
-
^^^^^^^^^^^^^^^^^^^^^^^
322
-
323
-
As ``Winpcap`` is becoming old, it's recommended to use ``Npcap`` instead. ``Npcap`` is part of the ``Nmap`` project.
324
-
325
-
.. note::
326
-
This does NOT apply for Windows XP, which isn't supported by ``Npcap``.
327
-
328
-
1. If you get the message ``'Winpcap is installed over Npcap.'`` it means that you have installed both Winpcap and Npcap versions, which isn't recommended.
329
-
330
-
You may first **uninstall winpcap from your Program Files**, then you will need to remove::
331
-
332
-
C:/Windows/System32/wpcap.dll
333
-
C:/Windows/System32/Packet.dll
334
-
335
-
And if you are on an x64 machine::
336
-
337
-
C:/Windows/SysWOW64/wpcap.dll
338
-
C:/Windows/SysWOW64/Packet.dll
339
-
340
-
To use ``Npcap`` instead, as those files are not removed by the ``Winpcap`` un-installer.
341
-
342
-
2. If you get the message ``'The installed Windump version does not work with Npcap'`` it surely means that you have installed an old version of ``Windump``, made for ``Winpcap``.
343
-
Download the correct one on https://github.com/hsluoyz/WinDump/releases
344
-
345
-
In some cases, it could also mean that you had installed ``Npcap`` and ``Winpcap``, and that ``Windump`` is using ``Winpcap``. Fully delete ``Winpcap`` using the above method to solve the problem.
Copy file name to clipboardExpand all lines: doc/scapy/troubleshooting.rst
+74-17Lines changed: 74 additions & 17 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,21 +8,33 @@ FAQ
8
8
I can't sniff/inject packets in monitor mode.
9
9
---------------------------------------------
10
10
11
-
The use monitor mode varies greatly depending on the platform.
11
+
The use monitor mode varies greatly depending on the platform, reasons are explained on the `Wireshark wiki <https://wiki.wireshark.org/CaptureSetup/WLAN>`_:
12
+
13
+
*Unfortunately, changing the 802.11 capture modes is very platform/network adapter/driver/libpcap dependent, and might not be possible at all (Windows is very limited here).*
14
+
15
+
Here is some guidance on how to properly use monitor mode with Scapy:
16
+
17
+
- **Using Libpcap (or Npcap)**:
18
+
``libpcap`` must be called differently by Scapy in order for it to create the sockets in monitor mode. You will need to pass the ``monitor=True`` to any calls that open a socket (``send``, ``sniff``...) or to a Scapy socket that you create yourself (``conf.L2Socket``...)
19
+
20
+
**On Windows**, you additionally need to turn on monitor mode on the WiFi card, use::
21
+
22
+
# Of course, conf.iface can be replaced by any interfaces accessed through conf.ifaces
23
+
>>> conf.iface.setmonitor(True)
12
24
13
-
- **Using Libpcap**
14
-
``libpcap`` must be called differently by Scapy in order for it to create the sockets in monitor mode. You will need to pass the ``monitor=True`` to any calls that open a socket (``send``, ``sniff``...) or to a Scapy socket that you create yourself (``conf.L2Socket``...)
15
25
- **Native Linux (with libpcap disabled):**
16
-
You should set the interface in monitor mode on your own. I personally like
17
-
to use iwconfig for that (replace ``monitor`` by ``managed`` to disable)::
26
+
You should set the interface in monitor mode on your own. The easiest way to do that is to use ``airmon-ng``::
27
+
28
+
$ sudo airmon-ng start wlan0
29
+
30
+
You can also use::
18
31
19
-
$ sudo ifconfig IFACE down
20
-
$ sudo iwconfig IFACE mode monitor
21
-
$ sudo ifconfig IFACE up
32
+
$ iw dev wlan0 interface add mon0 type monitor
33
+
$ ifconfig mon0 up
22
34
23
-
**If you are using Npcap:** please note that Npcap ``npcap-0.9983`` broke the 802.11 util back in 2019. It has yet to be fixed (as of Npcap 0.9994) so in the meantime, use `npcap-0.9982.exe <https://nmap.org/npcap/dist/npcap-0.9982.exe>`_
35
+
If you want to enable monitor mode manually, have a look at https://wiki.wireshark.org/CaptureSetup/WLAN#linux
24
36
25
-
.. note:: many adapters do not support monitor mode, especially on Windows, or may incorrectly report the headers. See `the Wireshark doc about this <https://wiki.wireshark.org/CaptureSetup/WLAN>`_
37
+
.. warning:: **If you are using Npcap:** please note that Npcap ``npcap-0.9983`` broke the 802.11 support until ``npcap-1.3.0``. Avoid using those versions.
26
38
27
39
We make our best to make this work, if your adapter works with Wireshark for instance, but not with Scapy, feel free to report an issue.
28
40
@@ -35,12 +47,14 @@ I can't ping 127.0.0.1 (or ::1). Scapy does not work with 127.0.0.1 (or ::1) on
35
47
36
48
The loopback interface is a very special interface. Packets going through it are not really assembled and disassembled. The kernel routes the packet to its destination while it is still stored an internal structure. What you see with ```tcpdump -i lo``` is only a fake to make you think everything is normal. The kernel is not aware of what Scapy is doing behind his back, so what you see on the loopback interface is also a fake. Except this one did not come from a local structure. Thus the kernel will never receive it.
37
49
38
-
On Linux, in order to speak to local IPv4 applications, you need to build your packets one layer upper, using a PF_INET/SOCK_RAW socket instead of a PF_PACKET/SOCK_RAW (or its equivalent on other systems than Linux)::
50
+
.. note:: Starting from Scapy > **2.5.0**, Scapy will automatically use ``L3RawSocket`` when necessary when using L3-functions (sr-like) on the loopback interface, when libpcap is not in use.
51
+
52
+
**On Linux**, in order to speak to local IPv4 applications, you need to build your packets one layer upper, using a PF_INET/SOCK_RAW socket instead of a PF_PACKET/SOCK_RAW (or its equivalent on other systems than Linux)::
On Windows, BSD, and macOS, you must deactivate the local firewall and set ````conf.iface``` to the loopback interface prior to using the following commands::
70
+
.. warning::
71
+
On Linux, libpcap does not support loopback IPv4 pings:
72
+
>>> conf.use_pcap =True
73
+
>>> sr1(IP() / ICMP())
74
+
Begin emission:
75
+
Finished sending 1 packets.
76
+
.....................................
77
+
78
+
You can disable libpcap using ``conf.use_pcap = False`` or bypass it on layer 3 using ``conf.L3socket = L3RawSocket``.
79
+
80
+
**On Windows, BSD, and macOS**, you must deactivate/configure the local firewall prior to using the following commands::
58
81
59
82
# Layer 3
60
83
>>> sr1(IP() / ICMP())
@@ -63,11 +86,45 @@ On Windows, BSD, and macOS, you must deactivate the local firewall and set ````c
**On Windows**, as ``Winpcap`` is becoming old, it's recommended to use ``Npcap`` instead. ``Npcap`` is part of the ``Nmap`` project.
105
+
106
+
.. note::
107
+
This does NOT apply for Windows XP, which isn't supported by ``Npcap``. On XP, uninstall ``Npcap`` and keep ``Winpcap``.
108
+
109
+
1. If you get the message ``'Winpcap is installed over Npcap.'`` it means that you have installed both Winpcap and Npcap versions, which isn't recommended.
110
+
111
+
You may first **uninstall winpcap from your Program Files**, then you will need to remove some files that are not deleted by the ``Winpcap`` uninstaller::
112
+
113
+
C:/Windows/System32/wpcap.dll
114
+
C:/Windows/System32/Packet.dll
115
+
116
+
And if you are on an x64 machine, additionally the 32-bit variants::
117
+
118
+
C:/Windows/SysWOW64/wpcap.dll
119
+
C:/Windows/SysWOW64/Packet.dll
120
+
121
+
Once that is done, you'll be able to use ``Npcap`` properly.
122
+
123
+
2. If you get the message ``'The installed Windump version does not work with Npcap'`` it means that you have probably installed an old version of ``Windump``, made for ``Winpcap``.
124
+
Download the one compatible with ``Npcap`` on https://github.com/hsluoyz/WinDump/releases
125
+
126
+
In some cases, it could also mean that you had installed both ``Npcap`` and ``Winpcap``, and that the Npcap ``Windump`` is using ``Winpcap``. Fully delete ``Winpcap`` using the above method to solve the problem.
0 commit comments