【发布时间】:2015-04-08 06:37:48
【问题描述】:
我在 c# 中使用 Pcap.net 库来更改和匿名化数据包文件。我已经从离线 pcap 文件中读取了数据包,并且我已经更改了其中的一些字段。 我的问题是,在更改 IP 地址、MAC 地址等数据包的字段后,有什么方法可以创建 pcap 格式的输出文件? 谁能帮帮我?
先谢谢你了 Ftm.E
【问题讨论】:
标签: header output pcap pcap.net anonymize
我在 c# 中使用 Pcap.net 库来更改和匿名化数据包文件。我已经从离线 pcap 文件中读取了数据包,并且我已经更改了其中的一些字段。 我的问题是,在更改 IP 地址、MAC 地址等数据包的字段后,有什么方法可以创建 pcap 格式的输出文件? 谁能帮帮我?
先谢谢你了 Ftm.E
【问题讨论】:
标签: header output pcap pcap.net anonymize
是的。
您应该关注Pcap.Net user guide section "Saving packets to a dump file"。
来自那里的代码 sn-p:
// 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);
}
}
【讨论】: