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

2 replies [Last post]
GTA 3
Offline
Joined: 03/03/2016

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;
}

public void makePacket() throws IOException {

packet.order(ByteOrder.BIG_ENDIAN);
packet.setUShort(12, Integer.parseInt(contentPCapView[2].substring(2),16));
packet.scan(JProtocol.ETHERNET_ID);

byte[] sourceMAC = controller.getSplittedByteArray(contentPCapView[0]);
byte[] destMAC = controller.getSplittedByteArray(contentPCapView[1]);

eth = packet.getHeader(new Ethernet());
eth.source(sourceMAC);
eth.destination(destMAC);
eth.checksum(eth.calculateChecksum());

for(int i = 0; i < contentPCapView.length; ++i){
System.out.println(contentPCapView[i]);
}

//IP v4 packet
packet.setUByte(14, controller.getStringtoInt(contentPCapView[3]) | controller.getStringtoInt(contentPCapView[4]));
packet.scan(JProtocol.ETHERNET_ID);

ip4 = packet.getHeader(new Ip4());
ip4.type(Ip4.Ip4Type.UDP);

// ip4.length(packetSize - ethernet.size());
byte[] sourceIPAddress = controller.getSplittedByteArray(contentPCapView[13]);
byte[] destIPAddress = controller.getSplittedByteArray(contentPCapView[14]);

ip4.source(sourceIPAddress);
ip4.destination(destIPAddress);

ip4.ttl(controller.getStringtoInt(contentPCapView[10]));
ip4.flags(controller.getStringtoInt(contentPCapView[8]));
ip4.offset(controller.getStringtoInt(contentPCapView[9]));
ip4.checksum(ip4.calculateChecksum());

//UDP packet
packet.scan(JProtocol.ETHERNET_ID);
udp = packet.getHeader(new Udp());
System.out.println(controller.getStringtoInt("0"));

int udpSource = controller.getStringtoInt(contentPCapView[15]);
udp.source(udpSource);
udp.destination(controller.getStringtoInt(contentPCapView[16]));
udp.length(controller.getStringtoInt(contentPCapView[17]));
udp.checksum(udp.calculateChecksum());
// packet.setByteArray(headerLength, data);
// packet.scan(Ethernet.ID);
//
// if (pcap.sendPacket(packet) != Pcap.OK) {
// throw new IOException(String.format(
// "Failed to send UDP packet with error: %s", pcap.getErr()));
// }
}
}

GTA 3
Offline
Joined: 03/03/2016
Sry for Repost.I'm hoping

Sry for Repost.
I'm hoping that this forum is not dead. Sad

I have another idea.

Can work with

packet.setUShort(34, 202); // TCP source port
packet.setUShort(36, 1460); // TCP destination port

instead of udp= udp.source(sourcePost);?

So 34 is for the TCP source port.
Which number is for udp source port?

EDIT:

Found it on a earlier post.
udp.setUShort(0, 2333); // udp.source(2333)
udp.setUShort(2, 1212); // udp.destination(1212)
udp.setUShort(6, udp.calculateChecksum()); // udp.checksum(udp.calculateChecksum()) Smile

Hope that is working. Sticking out tongue

leonakatokwa1
Offline
Joined: 05/26/2016
I don't think its dead but

I don't think its dead but there's not a lot of people active today i guess? - Gary McClure

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.