A simple packet sniffer written in C that captures TCP and DNS packets and saves them to a capture.pcap file.
To compile the project, run:
makeThis program requires root privileges to open a raw socket.
sudo ./snifferTo stop capturing, press Ctrl+C. The program will gracefully close the socket and the output file.
- Captures all packets on the network interface.
- Filters and displays details for TCP packets and DNS requests (port 53).
- Saves captured data to
capture.pcapwhich can be opened in Wireshark.