Protocol Specific

Get raw http requests from pcap file

Unable to fetch payload from TCP packet featuring TCP Segmentation Offloading

Ip4 ip = new Ip4();
Tcp tcp = new Tcp();

Pcap pcap = Pcap.openOffline(pcapFile, errbuf);

PcapBpfProgram program = new PcapBpfProgram();
int optimize = 0;         // 0 = false  
int netmask = 0xFFFFFF00; // 255.255.255.0  

if (pcap.compile(program, filterExpression, optimize, netmask) != Pcap.OK) {  
	System.err.println(pcap.getErr());  
	return null;
}

if (pcap.setFilter(program) != Pcap.OK) {  
	System.err.println(pcap.getErr());  
	return null;         
}  

JPacketHandler handler = new JPacketHandler() {

	@Override
	public void nextPacket(JPacket packet, String str) {
		if (packet.hasHeader(ip)) {
			if (packet.hasHeader(tcp)) {
				// snipped packet handling code. This returns false, despite the packet containing TCP header + payload.
			}
		}

Editing SIP headers


sip=packet.getHeader(sip);
if(sip.fieldValue(Sip.Request.RequestUrl)!=null) {
ReqURL= sip.fieldValue(Sip.Request.RequestUrl);
sip.addField(Sip.Request.RequestUrl, ReqURL.split("@")[0]+"@"+destnIP, 1);
}
Syndicate content