cys3c/sniffer ? reverse-engineered prompt
Reverse engineered prompt
Build me a C tool that reads a tcpdump style pcap file and parses the traffic into something human readable.
I want it to handle Ethernet packets with IP datagrams, then recognize TCP and UDP traffic, print the basic packet details to the console, and keep count of how many packets were TCP, UDP, or neither. For TCP connections, save each connection into separate files in the current folder, with a small metadata file plus one file for data going from the initiator and one for data going back the other way. It should avoid duplicate payloads, track bytes and packet counts in each direction, and note whether the connection ended cleanly.
Also add support for spotting SMTP email sessions and writing each message to its own file with the sender and receiver IPs, whether the server accepted it, and the message headers and body. And for HTTP traffic, detect cookies and save the name value pairs for each connection in a cookie file.
Use the sample input style from the README, and if you need to check packet parsing details, look up current docs online.
Are you gonna build this?
make sure you review the code using coderabbit