我想发送从网络设备1嗅探的捕获数据包,并将其注入网络设备2而不更改其内容(将充当线路)
到目前为止,我已经尝试了
byte[] buf = new byte[packet.getTotalSize()];
System.out.println(packet); // packet is the captured/sniffed packet
System.out.println(packet.transferStateAndDataTo(buf));//packet contents to buffer
ByteBuffer b = ByteBuffer.wrap(buf);
Injector injector = new Injector(b); //Injector contains the pcap.sendPacket(b) method
injector.run();