API

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());

A fatal error has been detected by the Java Runtime Environment:

Hey,

I just trying to create own Packets for a Pcapfile, but I get a fatal JRE Error like this:
Before the fatal Error i had a Nullpointer Exception on the line where i'm filling the udp.source(udpSource);
After 4 tries the error switched to the fatal JRE Error.

I hope you can help me. Sad I don't know how to fix error... -.-

"#
# A fatal error has been detected by the Java Runtime Environment:
#
# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x0000000063b51cf4, pid=5844, tid=4040
#
# JRE version: Java(TM) SE Runtime Environment (8.0_73-b02) (build 1.8.0_73-b02)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (25.73-b02 mixed mode windows-amd64 compressed oops)
# Problematic frame:
# C [jnetpcap.dll+0x11cf4]
#
# Failed to write core dump. Minidumps are not enabled by default on client versions of Windows
#
# An error report file with more information is saved as:
# C:\Users\Ownage\git\fw-ds\hs_err_pid5844.log
#
# If you would like to submit a bug report, please visit:
# http://bugreport.java.com/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#"

THis is my Code:

"import java.io.IOException;
import java.nio.ByteOrder;

import org.jnetpcap.packet.JMemoryPacket;
import org.jnetpcap.packet.JPacket;
import org.jnetpcap.packet.Payload;
import org.jnetpcap.protocol.JProtocol;
import org.jnetpcap.protocol.lan.Ethernet;
import org.jnetpcap.protocol.network.*;
import org.jnetpcap.protocol.tcpip.*;

import fds.Controller.Controller;

public class NewOwnPCap{

private String[] contentPCapView;
private Controller controller = new Controller(null,null);
private Tcp tcp = new Tcp();
private Ip4 ip4;
private Udp udp;;
private Ethernet eth;
private Payload payload = new Payload();
private JPacket packet = new JMemoryPacket(1400);

public NewOwnPCap(String[] content, Controller controll){
this.contentPCapView = content;
this.controller = controll;
}

Syndicate content