The "Carnivore Library for Processing" is a TCP/UDP packet sniffer library for the Processing programming language. The Carnivore Library is based on Jpcap, a java native interface for the libpcap standard sniffing library.
To install the Carnivore Library for Processing:
Windows people must first install Winpcap
Mac people must open a Terminal and execute this commmand (you must do this each time you reboot your mac):
sudo chmod 777 /dev/bpf*
Linux people should read the Linux Readme
You can install Carnivore automatically using Processing's built-in library importer. In Processing select menu "Sketch / Import Library... / Add Library..." and then search on "Carnivore" to install.
1) quit Processing
2) download Carnivore
3) unzip the download folder and copy the "carnvore" folder into the "libraries" folder in your sketchbook.
4) launch Processing
You should preserve the folder structure, like this:
Example #1: print packets to the debug window
Example #2: display nodes in a visual map
Example #3: like #2 but with more features (color, objects for nodes and links, offline mode)
CarnivoreP5(PApplet parent)Example: CarnivoreP5 c = new CarnivoreP5(this);
Creates the Carnivore object
void packetEvent(CarnivorePacket packet)This method is automagically called each time a new packet arrives.
"CarnivoreP5" Class Methods
void setVolumeLimit(int i)Example: c.setVolumeLimit(7);
Output fewer packets from Carnivore. Useful for high volume networks.
void setShouldSkipUDP(boolean b)Example: c.setShouldSkipUDP(true);
Tells Carnivore to skip UDP packets. Options are: "true" or "false" (default)
"CarnivorePacket" Class members
String ascii()The content of the packet converted into ASCII characters. This is handy if you actually want to read the packets. (Note: any bytes outside of the simple ASCII range [greater than 31 and less than 127] are printed as whitespace.)
byte dataThe content of the packet as bytes.
String dateStamp()The date of the packet in the format hour:minute:second:millisecond.
int intTransportProtocolThe packet type as an int, either 6 (TCP) or 17 (UDP).
IPAddress receiverAddressThe packet's receiver IP address. Use
receiverAddress.ipto get the IP address as a string.
int receiverPortThe packet's receiver port.
String receiverSocket()The packet's receiver formated as an "IPaddress:Port" string.
IPAddress senderAddressThe packet's sender IP address. Use
senderAddress.ipto get the IP address as a string.
int senderPortThe packet's sender port.
String senderSocket()The packet's sender formated as an "IPaddress:Port" string.
String strTransportProtocolThe packet type as a string, either "TCP" or "UDP".
String toString()Returns entire packet as a String.
"IPAddress" Class members
String ipThe IP address in 220.127.116.11 format.
int octet1()The first octet of the address.
int octet2()The second octet of the address.
int octet3()The third octet of the address.
int octet4()The fourth octet of the address.
"Log" Class Method
void setDebug(boolean b)Example: Log.setDebug(true);
Turns debugging output on or off. Options are: "true" or "false" (default)