views:

313

answers:

2

Hi!

I'm trying to create an application to craft packets to be able to debug some gateways here, and to experiment with TCP DoS situations. Nevertheless this should be very easy, I didn't find a way to implement this for a Windows application.

I started using Impacket from Core Security in Python on a Unix box, but I want to avoid this for now. First of all Impacket doesn't work for Windows, and it doesn't seem to do exactly what I want.

Does anyone know how to get a simple raw-socket like behavior in Windows? I know that there're no Raw sockets any more. But is there something similar? Any C# library I can use... I didn't find anything jet.

Thanks ;)

A: 

Try to use libpcap (winpcap), it can work under the tcp/ip stack, just on raw packet level.

Yossarian
+1  A: 

There's not a lot to creating the socket.

using System.Net.Sockets;
Socket rawSocket = new Socket(AddressFamily.InterNetwork, SocketType.Raw, ProtocolType.Raw);

or if it's custom TCP packets you're after:

Socket rawSocket = new Socket(AddressFamily.InterNetwork, SocketType.Raw, ProtocolType.IP);

If you're planning on sending IP or higher layer packets that's not exposed by the .Net framework. However IP and TCP packets are pretty simple to put together and if you're testing malformed packets you'll most likely need to customise the packets anyway.

sipwiz