scan tcp and udp open ports using netcat

September 3rd, 2006 mysurface Posted in Admin, nc | Hits: 59372 | 6 Comments »

Netcat is a very powerful tools to setup a TCP/UDP connections and listens deamon. I am here to show you how to perform port scanning method. Port scanning is like a knife, you can use it to help you tear up something you couldn’t open by hand and you can use it to perform murder. A lots of “hacker” likes to use port scanner to detect an open port of its target, so that he can perform the art of hacking towards its target. My intention is not to show you how can you do that, port scanner can be use to investigate your network, certain ports have to be open in order to allow certain applications to function correctly.

To scan for a TCP port 22,  let say your target IP is 219.90.25.252

nc -z 219.90.25.252 22

To scan for a UDP port 22

nc -zu 219.90.25.252 22

To scan a range of UDP port 13252-13258

nc -zu 219.90.25.252 13252-13258

In order to get more information, you can add v, for more verbose, add another v

nc -vvzu 219.90.25.252 13252-13258

6 Responses to “scan tcp and udp open ports using netcat”

  1. UDP tests will always show as “open”. The -uz argument is useless.

  2. can use nc to tranfer data ?

  3. Yes, see the Data Transfer section of http://linux.die.net/man/1/nc

  4. Jim, No, UDP scanning is not “useless”, but you need to do some additional research on UDP scanning to understand what is happening

  5. This is a very helpfull page :) What would you recommend a bash script running multiple nc threads or nmap for scanning a list of ips for a port state open/closed? What would be faster?

  6. what kind of research, be more specific if you want to help.
    UDP scan with netcan is useless for too.It always shows udp ports as open.

Leave a Reply