Port scanner

Please support our C# advertiser: Intel Parallel Studio Home
Reply

Join Date: Jun 2007
Posts: 3
Reputation: xruxru is an unknown quantity at this point 
Solved Threads: 0
xruxru xruxru is offline Offline
Newbie Poster

Port scanner

 
0
  #1
Jun 25th, 2007
Hi
I need to build port scanner.
Could somebody help me?
How should I start?

Thanks
Reply With Quote Quick reply to this message  
Join Date: Apr 2004
Posts: 759
Reputation: Killer_Typo will become famous soon enough Killer_Typo will become famous soon enough 
Solved Threads: 35
Killer_Typo's Avatar
Killer_Typo Killer_Typo is offline Offline
Master Poster

Re: Port scanner

 
0
  #2
Jun 26th, 2007
What have you written so far?

try writing some pseudo code first

you will want an IP

and a specific range of ports to check.

you will need a method for sending a ping to them and a method for listening for a response (three part handshake for networking peeps)

you should start by writing something that can ping a local address, or even just something that can connect to a local machine to get the feel for how networking works.
Dont forget to spread the reputation to those that deserve!
Reply With Quote Quick reply to this message  
Join Date: Jun 2007
Posts: 3
Reputation: xruxru is an unknown quantity at this point 
Solved Threads: 0
xruxru xruxru is offline Offline
Newbie Poster

Re: Port scanner

 
0
  #3
Jun 26th, 2007
Could You give me a little example(C#), so i`ll try to continue
Thanks
Reply With Quote Quick reply to this message  
Join Date: Apr 2004
Posts: 759
Reputation: Killer_Typo will become famous soon enough Killer_Typo will become famous soon enough 
Solved Threads: 35
Killer_Typo's Avatar
Killer_Typo Killer_Typo is offline Offline
Master Poster

Re: Port scanner

 
0
  #4
Jun 26th, 2007
Originally Posted by xruxru View Post
Could You give me a little example(C#), so i`ll try to continue
Thanks
you should really try to gain an understanding of what you are trying to do.

in about 30 seconds of google searching i was able to find examples of what you need to do.

hint an IP with a PORT is called a socket

so look up C# and sockets.
Dont forget to spread the reputation to those that deserve!
Reply With Quote Quick reply to this message  
Join Date: Jun 2007
Posts: 3
Reputation: xruxru is an unknown quantity at this point 
Solved Threads: 0
xruxru xruxru is offline Offline
Newbie Poster

Re: Port scanner

 
0
  #5
Jun 26th, 2007
Ok
I`ll try to ask accurate question:
I need to implement few type of scanning:
- TCP connect()
- TCP SYN scan
- TCP FIN scan
- TCP XMAS scan
- TCP NULL scan

I already did something:

public static void connect1(string host, int startPort, int finishPort)
{

IPAddress[] IPs = Dns.GetHostAddresses(host);
Socket s = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
Console.WriteLine("Establishing Connection to {0}", host);

for (int curPort = startPort; curPort <= finishPort; curPort++)
{

try
{
s.Connect(IPs[0], curPort);
Console.WriteLine("Port {0} : opened", curPort);
}
catch
{
Console.WriteLine("Port {0} : blocked", curPort);
}
}

It`s working, but I don`t know which type is it, and how to continue
with other types
Thanks
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the C# Forum
Thread Tools Search this Thread



Tag cloud for C#
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC