Googling didn't give me great results. Is there any sort of API for Wireshark that abstracts away from the main source code so we can develop programs that interact with it and deal with the data it provides?
edit: I appreciate the suggestions for different ways to receive packets, but I want to implement packet injection into Wireshark. Sniffing will be an important part of my project, however I'm not sure that the suggested solution allows for packet injection.
c++ well could not find one.. but here is the wireshark documentation of Python support..! http://wiki.wireshark.org/Python
Since there's at least one that makes commercial products that integrate somewhat with wireshark , it has to be possible. It seems the immediate integration point is with the data it produces according to wikipedia, Wireshark uses libpcap. A quick google search reveals that there are several options
Scapy actually looks kind of interesting, though it doesn't really do anything to interact with wireshark, but you can capture packets with it.
wireshark uses libpcap, this library abstracts away platform differences in packet sniffing and provides a format for data files. that's how I'd inject packets into wireshark.
Try the lua scripting that they've got in the newer versions of wireshark.. you can write custom dissectors (for your own protocols and so on).
http://wiki.wireshark.org/Lua
I wasn't able to find any information indicating that to be possible in the developer's guide. So that seems indicate "no".
I use
pypcap
to read packets anddpkt
to parse.For example, to use dpkt to read packets from a saved pcap:
To grab frames off the wire with pypcap:
Of course, the two can be used together: (ripped from pypcap's homepage)
Good luck!