Packet Decoding

java.lang.StringIndexOutOfBoundsException at org.jnetpcap.packet.AbstractMessageHeader.decodeHeader(Unknown Source)

I'm using jnetpcap. When i'm reading a specific dump trace i get this error:

The pwrapper:

Other infos:
version of jnetpacp: 1.3b4
OS: windows xp
Arch: 32 bit

Any help would be appreciated!


Inspecting JBuffer content without fetching

I would like to "inpect" the content of the JBuffer without actually fetching its content. What's the fastest way to do this?

My understanding is that JBuffer.getByteArray() actually copies JBuffer internal buffer to your buffer (supplied as the parameter). I dont want to do that. I just want to peek the content.


make or get cap files

I wanted some test cap,pcap files in order to test the different kinds of malicious activity for my intrusion detection system. Its my academic project. I wanted to test for tcp protocol activities like portscan, dos, bad tcp handshake.etc..How can i get or make the capture files.
Thanking you in advance

Disabling CORE decoders?

Is there a way to disable the one of the CORE protocols? I've tried JRegistry.resetBindings(); AND JRegistry.clearScanners() with no luck.

The reason I would like to do this is because I have a suspicion that one of my capture files may not be decoding properly and would like to try disabling that decoder to make sure that is the problem.

I am getting the following stack trace and I believe the error is on line 178:

char firstChar = line.charAt(0);

and line is an empty string.

java.lang.StringIndexOutOfBoundsException: String index out of range: 0
at java.lang.String.charAt(Unknown Source)
at org.jnetpcap.packet.AbstractMessageHeader.decodeHeader(
at org.jnetpcap.packet.JHeader.decode(
at org.jnetpcap.packet.JPacket.getHeaderByIndex(
at org.jnetpcap.packet.JPacket.getHeader(
at org.jnetpcap.packet.JPacket.getHeader(
at org.jnetpcap.packet.structure.AnnotatedBinding.isBound(
at org.jnetpcap.packet.JHeaderScanner.scanAllBindings(
at org.jnetpcap.packet.JHeaderScanner.scanHeader(
at org.jnetpcap.packet.JScanner.scan(Native Method)
at org.jnetpcap.packet.JScanner.scan(
at org.jnetpcap.packet.JPacket.scan(
at org.jnetpcap.Pcap.nextEx(
at testingPackage.JnetPcapTest.parseFile(
at testingPackage.JnetPcapTest.parseDir(
at testingPackage.JnetPcapTest.main(

Decoding GRE

I am post-processing PCAP files in offline mode and so far so good in decoding IP, TCP, and UDP packets, but what I have come across are GRE packets where I would like to get the tunneled data (src/dst ip/port) but can't seem to access it. Packet format is Ethernet -> IP4 -> GRE -> IP4 -> UDP/TCP.

When I do a header count on the packet I get 3 and maybe its my lack of understanding, but for header @ index 0 it has both Ethernet and Ip4 and the ones at index 1 and 2 have neither. My first thought is that its failing to parse past the GRE header, but this is wild guess at best.

Looking at some older topics there was mention of being able to decode IP in IP and even looking at the JPacket.State javadoc there is mention of decoding Ethernet->Ip4->Snmp->Ip4 or Ethernet->Ip4->Ip4 (IP tunneled IP). The Ip4 in Ip4 makes sense since its one header followed by the other, but the first case of SNMP I am not getting since there doesn't seem to be a built-in protocol Dissector/Decoder for SNMP.

I would appreciate any help on this.