A simple data-link layer Ethernet (802.3) raw packet sniffer in Python. Using the PyPCAP libpcap module ,and npcap for Windows 10 compatibility. Unpacking frame headers, starting from data-link, and printing information.
- MAC
- IPv4
- ARP
- TCP
- UDP
- IGMP
python sniffer.py
Reading raw Data Link Layer packets in Windows 10 is a bit tricky but it works by replacing WpdPack with Npcap while installing PyPCAP
- Install Npcap
- Download the Npcap SDK and place it in the hd root directory as "C:\wpdpack" (the name "wpdpack" is mandatory for PyPCAP to recognise Npcap)
- Download the PyPCAP source and place it in the root directory as well, as "C:\pypcap-1.x.x"
- Install the Microsoft Visual C++ Compiler for Python 2.7
- Start a command prompt for the compiler and install PyPCAP with the following instructions:
set INCLUDE=%INCLUDE%;c:\WpdPack\Include
set LIB=%LIB%;c:\WpdPack\Lib
pushd C:\pypcap-1.x.x //the installed version
python setup.py install