I'm trying to print out the response data when I make a HTTP request, where jpcap is sniffing the packets.
I've managed to get some header info, but I can't get the actual HTML contents. This is the code I'm using:
try {
NetworkInterface[] devices = JpcapCaptor.getDeviceList();
System.out.println("Opening interface");
JpcapCaptor captor=JpcapCaptor.openDevice(devices[0], 65535, true, 20);
captor.setFilter("ip and tcp", true);
while(true) {
Packet thisPacket = captor.getPacket();
if(thisPacket != null) {
TCPPacket p = (TCPPacket)thisPacket;
System.out.println(p.toString());
}
}
} catch (Exception e) {
System.out.println("Error: " + e );
}
Thanks for the help