我在c#中使用Pcap.net库来更改和匿名化数据包fileds.i已经从脱机pcap文件读取数据包并且我已经更改了其中的一些字段。 我的问题是有什么办法可以在更改ip地址,mac地址和...之类的数据包之后以pcap格式创建输出文件? 有人可以帮帮我吗?
事先谢谢你 Ftm.E
答案 0 :(得分:0)
是
您应该关注Pcap.Net user guide section "Saving packets to a dump file"。
来自那里的代码片段:
// Open the device
using (PacketCommunicator communicator =
selectedDevice.Open(65536, // portion of the packet to capture
// 65536 guarantees that the whole packet will be captured on all the link layers
PacketDeviceOpenAttributes.Promiscuous, // promiscuous mode
1000)) // read timeout
{
// Open the dump file
using (PacketDumpFile dumpFile = communicator.OpenDump(args[0]))
{
Console.WriteLine("Listening on " + selectedDevice.Description + "... Press Ctrl+C to stop...");
// start the capture
communicator.ReceivePackets(0, dumpFile.Dump);
}
}