944,120 Members | Top Members by Rank

Ad:
  • C# Discussion Thread
  • Unsolved
  • Views: 11679
  • C# RSS
Jun 25th, 2007
0

Port scanner

Expand Post »
Hi
I need to build port scanner.
Could somebody help me?
How should I start?

Thanks
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
xruxru is offline Offline
3 posts
since Jun 2007
Jun 26th, 2007
0

Re: Port scanner

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.
Reputation Points: 152
Solved Threads: 39
Master Poster
Killer_Typo is offline Offline
778 posts
since Apr 2004
Jun 26th, 2007
0

Re: Port scanner

Could You give me a little example(C#), so i`ll try to continue
Thanks
Reputation Points: 10
Solved Threads: 0
Newbie Poster
xruxru is offline Offline
3 posts
since Jun 2007
Jun 26th, 2007
0

Re: Port scanner

Click to Expand / Collapse  Quote originally posted by xruxru ...
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.
Reputation Points: 152
Solved Threads: 39
Master Poster
Killer_Typo is offline Offline
778 posts
since Apr 2004
Jun 26th, 2007
0

Re: Port scanner

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
Reputation Points: 10
Solved Threads: 0
Newbie Poster
xruxru is offline Offline
3 posts
since Jun 2007

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C# Forum Timeline: Numbers only textbox
Next Thread in C# Forum Timeline: C# IE Toolbar talking to C++ BHO





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC