views:

625

answers:

4

hi does anyone knows of any .net library or resources that will assist me to implement a tcp port scanner? thanks

+5  A: 

For simple one, that will just try to connect to each port and report success / failure, without any "tricks", like sending only ACK packets etc. - you won't need anything else than System.Net and System.Net.Sockets, create socket, try connecting to a host, check if you have succeeded. For better performance, you can create more sockets, and use asynchronous approach (BeginConnect/EndConnect).

Ravadre
+1  A: 

I found some example codes.

http://www.geekpedia.com/tutorial142_Creating-a-Port-Scanner-with-Csharp.html

http://www.dijksterhuis.org/building-a-simple-portscanner-in-c/

WinPcap is a network monitoring and packet capturing tool but it might be also useful because it is another way to get an idea about network transmissions. But it may not suit to your requirement.

Chathuranga Chandrasekara
A: 

You can use Pcap.Net to create and send raw packets.

You can also capture packets using this framework.

It includes a packet interpretation and creation framework so it should be pretty easy to create the packets you need to scan the ports and to parse the packets returned.

brickner