Recently I wrote a small network tool that I wanted release freely online. But, I didn’t know where to put it, since this is technically an electronics/embedded-development blog (not really for desktop programs). But, I don’t really have any other active development blogs. Oh well, I thought, and I decided to add a network tools section to this blog so I can post any other network tool programs I release in the future (I have one more coming for sure).
The first program released on the Network Tools page is pcap2c, which converts a pcap capture file to a C source file, or more specifically, reformat packets that are stored in a pcap capture file to more easily accessible raw unsigned char arrays. In some of the low-level network work I’ve been dealing with I’d had to retransmit certain packets I captured in Ethereal/Wireshark, and well, I didn’t really have a clean way to do it but extracting it of the pcap capture file, and rearranging it as a C array with perl. I would then compile the raw packet into a small PF_PACKET sockets program that could retransmit it down a particular interface. pcap2c greatly simplifies the process of extracting the packets, and will work with libpcap formatted capture files (Ethereal/Wireshark, tcpdump, etc.).
The next “network tool” that I will have available will read in all the packets from a pcap capture file in memory and allow you to retransmit any of them down an interface on demand. It’s basically a simple debugging tool that retransmits packets you may later want to observe as they traverse the network (watching them get routed, bridged, etc.). Future versions may allow you to edit the packet on the fly and automatically recalculate the IP and TCP checksums, but that’s down the long road, and there are already many projects in that niche.
Link to Network Tools section and pcap2c: Network Tools.
Any suggestions or comments are welcome at: vsergeev at gmail.