خرید بک لینک

Vote count: 0

I want to get through a pcap file and go to each packet. Then get IP Address and manipulate it. In the end, I'm going to write it into a new pcap file.

I use pcap4j version 1.6.4 and below is how I get the Source IP Address:

String fname = "FileName";
String dumpFile = "newFileName";
PcapHandle h = Pcaps.openOffline(fname);
PcapDumper dumper = h.dumpOpen(newFileName);
Packet p = null;
while ((p = h.getNextPacket()) != null) {
    IpV4Packet ip = p.get(IpV4Packet.class);
    Inet4Address srcAddr = ip.getHeader().getSrcAddr();
}

As I mentioned, I got the Source IP Address and now I don't know how to set the new Source IP Address and write it to NewFileName.

Any help would be appreciated.

asked 2 mins ago

- - , .
.

برچسب: نویسنده: استخدام کار تاريخ: دوشنبه 21 تير 1395 ساعت: 16:32

صفحه بندی