IP spoofing using SharpPcap in C #

I am using SharpPcap platform to build my spoofing program, so I need to change the computer IP of the packet with a different IP in the source address field.

I found an example in the SharpPcap project, but how can I change or change the source packet send address field?

Here is some sample code for sending random packets:

byte[] bytes = GetRandomPacket();

private static byte[] GetRandomPacket()
{
    byte[] packet = new byte[200];
    Random rand = new Random();
    rand.NextBytes( packet );
    return packet;
}

      

- device.SendPacket (bytes);

+2


a source to share


1 answer


Try Pcap.Net .

This is how you create a simple IPv4 packet with specific source and destination addresses and a custom payload in Pcap.Net:



Packet packet =
    PacketBuilder.Build(DateTime.Now,
                        new EthernetLayer
                            {
                                Source = new MacAddress("11:22:33:44:55:66"),
                                Destination = new MacAddress("11:22:33:44:55:67"),
                            },
                        new IpV4Layer
                            {
                                Source = new IpV4Address("1.2.3.4"),
                                Destination = new IpV4Address("1.2.3.5"),
                                Ttl = 64,
                                Identification = 100,
                            },
                        new PayloadLayer
                            {
                                Data = new Datagram(new byte[] {1, 2, 3, 4})
                            });

      

+9


a source







All Articles