I am trying to save to file UDP payload, but it is always limited to 1472 bytes. I've captured the same data using wireshark, and it captured the full datagram payload.
Any idea?
OS: Windows 32 bits JnetPcap Version: 1.3r1339
Sample code:
public void nextPacket(PcapPacket packet, String user) { Udp udp = new Udp(); Ip4 ip = new Ip4(); Payload payload = new Payload(); if (packet.hasHeader(ip) && packet.hasHeader(udp) && packet.hasHeader(payload)){ try { byte[] data = payload.getByteArray(0, payload.size()); FileOutputStream fos; try { fos = new FileOutputStream(new File("dumppayload_"+(new Date().getTime())+".bin")); fos.write(data); fos.close(); try { System.out.println("Received packet. from: "+InetAddress.getByAddress(ip.source()).getCanonicalHostName()+" port "+udp.source()+ " -->"+InetAddress.getByAddress(ip.destination())+" port "+udp.destination()+ ". Length:"+payload.size() +" bytes"); } catch (Throwable e1) { e1.printStackTrace(); } } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } catch (UnknownHostException e) { e.printStackTrace(); } } }
Please help me ! Not only httpAnalyzer but also many library i can't import in jnetpcap 1.3