A lightweight C-based packet sniffer that captures Ethernet, IP, TCP, and UDP packets and saves them to a .pcap file for analysis in Wireshark.
✔ Captures raw network packets
✔ Extracts MAC, IP, TCP, and UDP headers
✔ Saves packets to a .pcap file
✔ Lightweight and fast
Install libpcap before compiling:
Ubuntu/Debian:
sudo apt install libpcap-dev -yFedora:
sudo dnf install libpcap-devel -yArch Linux:
sudo pacman -S libpcap1️⃣ Compile the program
make2️⃣ Run the sniffer
sudo make run3️⃣ View packets in Wireshark
wireshark captured.pcap| Command | Description |
|---|---|
make |
Compile the program |
make run |
Run the program (requires sudo) |
make clean |
Remove compiled files & logs |
[+] Capturing packets...
Packet Type: Incoming
Source MAC: AA:BB:CC:DD:EE:FF
Destination MAC: 11:22:33:44:55:66
Protocol: IP
Source IP: 192.168.1.10
Destination IP: 8.8.8.8
Protocol: UDP
Source Port: 53
Destination Port: 443