style="display:inline-block;width:728px;height:90px"
data-ad-client="ca-pub-7505528228218001"
data-ad-slot="1225241371">

API

jNetPcap v2 discussion

Its been a while since jnetpcap received a refresh and I think one is overdue. I would like to start a discussion on how to proceed with jnetPcap v2.

building jnetcap with android project

Hello All

is there a way to import JnetPcap to work with android project ?

i find page that says to build the jni folder

i tried it , the ndk-build failed

is there a good way to have this work ?

not getting all the downloaded payload

hi,

i'm using jnetpcap 1.4 as packet analyzer for a http file donwload.
i'm getting all the payload when the file i'm trying to donwload is less than 1.5Mo but when i try to get a file more bigger i'm not getting all the payload and im stucked.

Can someone help me please thanks.

JVM crash while modifying Pcap Packet with SCTP payload

I am new to jnetPcap, I am trying to build simple application that reads from a pcap file that has SCTP payload and modifies some of the attributes in the SCTP payload data and writes the modified pcap packet to another file. The following JVM crash is reported in the console while running my app after processing 31 pcakets:

jNetPCAP API version: 1.4.r1425
OS: Open Suse 13.2, kernel version: 3.16.7-35-desktop #1 SMP PREEMPT Sun Feb 7 17:32:21 UTC 2016 (832c776) x86_64 x86_64 x86_64 GNU/Linux

CRASH INFO:
-------------
#
# A fatal error has been detected by the Java Runtime Environment:
#
# SIGSEGV (0xb) at pc=0x00007f06558ca125, pid=3373, tid=139665193740032
#
# JRE version: Java(TM) SE Runtime Environment (7.0_79-b15) (build 1.7.0_79-b15)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (24.79-b02 mixed mode linux-amd64 compressed oops)
# Problematic frame:
# C [libc.so.6+0x78125]2016-08-22 07:13:24

THREAD DUMP:
-------------
I also did a kill -3 on the pid, here's the thread dump info:
Full thread dump Java HotSpot(TM) 64-Bit Server VM (24.79-b02 mixed mode):

"DisposableGC" daemon prio=10 tid=0x00007f065011f800 nid=0xd3f in Object.wait() [0x00007f061fddc000]
java.lang.Thread.State: TIMED_WAITING (on object monitor)
at java.lang.Object.wait(Native Method)
- waiting on <0x00000007d7181608> (a java.lang.ref.ReferenceQueue$Lock)
at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:135)
- locked <0x00000007d7181608> (a java.lang.ref.ReferenceQueue$Lock)
at org.jnetpcap.nio.DisposableGC.drainRefQueueLoop(Unknown Source)
at org.jnetpcap.nio.DisposableGC$2.run(Unknown Source)
at java.lang.Thread.run(Thread.java:745)

"Service Thread" daemon prio=10 tid=0x00007f065009f800 nid=0xd3d runnable [0x0000000000000000]
java.lang.Thread.State: RUNNABLE

"C2 CompilerThread1" daemon prio=10 tid=0x00007f065009d800 nid=0xd3c waiting on condition [0x0000000000000000]
java.lang.Thread.State: RUNNABLE

IP address, Request Response for UDP Packet

Is there a way to get a formatted IP, request Response for a captured UDP DNS packet?

What I am doing doesn't give a proper solution.

public void nextPacket(PcapPacket packet, String user) {

                if (!packet.hasHeader(udp)) {
                    return; // not a UDP package, skip
                }
                // Process Output
                if (packet.hasHeader(udp)) {
                    System.out.println("Got UDP Packet");
                    if (packet.getHeader(udp).source() == 53) {
                        System.out.println("This packet is a Response");
                        System.out.println("The Source :" + packet.getHeader(udp).source());
                        System.out.println("The Destination :" + packet.getHeader(udp).destination());
                    }

                    if (packet.getHeader(udp).destination() == 53) {
                        System.out.println("This packet is a Request");
                        System.out.println("The Source :" + packet.getHeader(udp).source());
                        System.out.println("The Destination :" + packet.getHeader(udp).destination());
                    }

                  
                    System.out.println("The Request :" + packet.getHeader(udp).checksum());
                    System.out.println("The Size of packet :" + packet.getTotalSize());