sharppcap icon indicating copy to clipboard operation
sharppcap copied to clipboard

IP Spoofing

Open FirstBlood12 opened this issue 4 years ago • 4 comments

I want to test how much users my website can handle. so I want to know how can I do IP Spoofing using SharpPcap in C#. I made a client in C# for my website so how can I spoof the source IP so I can test how much users can my website handle?

        `static WebSocket test;`
        `test = new WebSocket("ws://example.com:8080");`
        `test.OnClose += OnClose;`
        `test.OnOpen += OnOpen;`
        `test.OnMessage += OnMessage;`
        `test.Compression = CompressionMethod.Deflate;`
        `test.Connect();`

FirstBlood12 avatar Apr 09 '21 04:04 FirstBlood12

This should be entirely possible to do and I think with sharppcap either using the libpcap or the WinDivert driver. If you can see how it works with those libraries directly you can apply the same approach with sharppcap. I don't know specifically how to do that but someone else may comment here with more info.

chmorgan avatar Apr 14 '21 20:04 chmorgan

@chmorgan you coded SharpPcap and I think you should know how can I do IP Spoofing using SharpPcap, for example I generate random IP in C# and I replace source IP of socket with the random generated IP and I sent the socket to the website and I do this for each connection to my website so each connection will come from different IP. So how I could do this? Can you provide me a example code of doing this?

FirstBlood12 avatar Apr 15 '21 10:04 FirstBlood12

@FirstBlood12 you expect me to know how to implement IP spoofing just because I developed the library? I'm aware of what IP spoofing is but I've yet to implement it. It would be more than a little presumptuous of me to think that I could just guess at how to do it and know as much as you might about the subject.

On the SharpPcap side you can call LibPcapLiveDevice.SendPacket() to send a raw packet.

On the PacketDotNet side you can create an IP packet like https://github.com/chmorgan/packetnet/blob/master/Examples/ConstructingPackets/Main.cs

once you created your packet on the PacketDotNet side you'd turn around and send it via SendPacket() like:

myLiveDevice.SendPacket(myPacket.Bytes);

chmorgan avatar Apr 16 '21 00:04 chmorgan

@chmorgan I want to spoof source IP for websockets not for packets because I am using websocket-sharp, So how I would do IP Address Spoofing for websockets using SharpPcap?

FirstBlood12 avatar Apr 16 '21 09:04 FirstBlood12