Tuesday, April 03, 2007

Low-level networking in Java

Sniffer in Java ? Hm.. Not possible ? Not actually so. There is pcap library which is used by Wireshark (formerly Ethereal), tcpdump, Snort, Nmap. The most sweet thing is that there is a binding between Java and native pcap library - jpcap. Nice thing. With the help of it I was able to capture ICMP packets from Java code. I've noticed that data in every ping request is the same - it is "abcdefghijklmnopqrstuvwabcdefghi" in string representation. It's on my Windows box.

3 comments:

Joe Attardi said...

There is another library I came across, RockSaw: http://www.savarese.org/software/rocksaw/

I haven't tried it though, so I don't know how it would compare.

Joe

n2 said...

Here is a Java implementation of Ethereal/Wireshark: http://yuba.stanford.edu/JEthereal/

Balhau said...

If you understand Java, JNI, C and Assembly you know that everything is possible in java...