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

Thanks

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.

Could You give me a little example(C#), so i`ll try to continue
Thanks

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.

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.