0

C# で Pcap.net ライブラリを使用して、パケット フィールドを変更および匿名化しています。既にオフラインの pcap ファイルからパケットを読み取り、その中のいくつかのフィールドを変更しました。私の質問は、IPアドレス、MACアドレスなどのパケットのフィールドを変更した後、pcap形式で出力ファイルを作成する方法はありますか? 誰でも私を助けることができますか?

よろしくお願いします

4

1 に答える 1

0

はい。

Pcap.Net ユーザー ガイドのセクション「パケットをダンプ ファイルに保存する」に従う必要があります。

そこからのコードスニペット:

// 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);
    }
}
于 2015-02-13T10:04:07.580 に答える