A simple network packet sniffer written in C that captures and analyzes packets. This tool uses raw sockets to intercept and display detailed information about Ethernet, IP, TCP, and UDP headers along with the packet payload in hexadecimal and ASCII formats.
- Captures packets on a specified network interface.
- Displays Ethernet, IP, TCP, and UDP header information.
- Prints packet payload in hexadecimal and ASCII formats.
- Provides timestamps for captured packets.
- It uses the Berkeley Packet Filter (BPF) to filter and capture specific types of packets.
- For more information refer to this: https://www.kernel.org/doc/html/v5.12/networking/filter.html
-
Ensure you have the necessary permissions to run the program (typically requires sudo access).
-
Modify the network interface (default is wlan0) in the code to match your setup.
-
This tool currently supports only IPv4 packets without options.
- Clone the repository
git clone https://github.com/ImonChakraborty/pack-sniffer.git
cd pack-sniffer
- Compile the code
gcc -o pack-sniffer pack-sniffer.c
- Run the packet sniffer (requires root privileges):
sudo ./pack-sniffer
- This project is licensed under the GPL-3.0 License - see the LICENSE file for details.
Thank you