im trying to retrieve the ack from the tcp like the one wireshark returns. In wireshark it returns an ack of 1 or 647. But when i'm trying to get the ack from the packet it returns a long number that is nothing similar to the ack wireshark returns.
I get these acks:
1918004163 3350411129 3083820792 1730247758 3668869711 4218577993
This is my code:
if (packet.hasHeader(tcp) && packet.hasHeader(ip)) {
long tcpack = packet.getHeader(tcp).ack();
String name = packet.getHeader(tcp).getName();
int urgent = packet.getHeader(tcp).urgent();
int windowScaled = packet.getHeader(tcp).windowScaled();
int window = packet.getHeader(tcp).window();
int wirelen = packet.getCaptureHeader().wirelen();
// System.out.println("WireLen: "+wirelen);
int caplen = packet.getCaptureHeader().caplen();
// System.out.println("caplen: "+caplen);
String ipTypeString = ip.typeEnum().toString();
// System.out.println("IP Type: "+ipTypeString);
String ipDescription = ip.getDescription();
// System.out.println("IP Description: "+ipDescription);
byte[] dIP = packet.getHeader(ip).destination();
byte[] sIP = packet.getHeader(ip).source();
String sourceIP = FormatUtils.ip(sIP);
// System.out.println("Source IP: "+sourceIP);
String destinationIP = FormatUtils.ip(dIP);
// System.out.println("Destination IP: "+destinationIP);
int tcpPORTSource = tcp.source();
// System.out.println("TCP PORT Source:
// "+tcpPORTSource);
int tcpPORTDestination = tcp.destination();
// System.out.println("TCP PORT Destination:
// "+tcpPORTDestination);
if (sourceIP.equals("someip") && tcpPORTSource == 0000 && ipTypeString.equals("TCP")
&& wirelen == 1514) {
// System.out.println("TCP ack: "+tcpack+" name: "+name+ " urgent: "+urgent + " window scaled: "+windowScaled+ " window: "+window);
}
How do i retrieve the same ack value as wireshark?