In having to research libnet and libpcap, I’ve found that there aren’t really a whole lot of great resources on them. But for those who, like me a week ago, have no idea what these things are, some clarification is helpful. Libnet is the standard packet construction library for C, which can be used to make TCP and UDP packets, amongst others. Libpcap does the opposite: it captures packets off the network. And now that you know the tools I need to pick up in a short amount of time, let’s talk about the resources I eventually found.
Libpcap doesn’t have a whole lot of tutorials that can be easily reached through Google, but I think the best is directly linked from libpcap’s homepage itself. Appropriately titled ‘Programming with pcap‘, this tutorial gives a hands-on approach that shows how to implement a packet sniffer and gives you the source code to the whole thing along with it.
Libnet unfortunately didn’t have great material on its homepage nor easily through Google. Also appropriately titled, the Libnet 1.1 Tutorial for Beginners is exactly what the name would imply. It’s broken up into multiple, discrete sections and provides tons of code and examples.
Check out these great links and, as always, drop a line if you’ve found better links about these libraries. Also, check out the wtfpl (wtf public license); it’s full of fun and begs to be used.