0
votes

I am using Pcap.net library in c# to change and anonymize packet fileds.i have already read packets from an offline pcap file and i have changed some fields in it. my question is there is any way to create output file in a pcap format after change the fieds of packets like ip address,mac address and ...? could anyone help me?

Thank you beforehand Ftm.E

1

1 Answers

0
votes

Yes.

You should follow the Pcap.Net user guide section "Saving packets to a dump file".

A code snippet from there:

// 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);
    }
}