1

On Dubian, I can do the following using netcat (aka nc, ncat):

michael@pi1:~ $ nc -zv 10.120.11.1 20 21 22 23 24
nc: connect to 10.120.11.1 port 20 (tcp) failed: Connection refused
Connection to 10.120.11.1 21 port [tcp/ftp] succeeded!
Connection to 10.120.11.1 22 port [tcp/ssh] succeeded!
Connection to 10.120.11.1 23 port [tcp/telnet] succeeded!
nc: connect to 10.120.11.1 port 24 (tcp) failed: Connection refused
michael@pi1:~ $

man nc on Dubian shows the following:

 -z      Specifies that nc should just scan for listening daemons, without sending any data to them.  It is an error to use this option in conjunction with the -l option.

On Centos7, I didn't originally have nc, so added using sudo yum install nmap-ncat.x86_64.

But, the -z flag is not supported.

[michael@box1 ~]$ nc -zv 10.255.255.1 22
nc: invalid option -- 'z'
Ncat: Try `--help' or man(1) ncat for more information, usage options and help. QUITTING.
[michael@box1 ~]$
user1032531
  • 1,877
  • 6
  • 29
  • 35
  • 1
    You also could use `nmap 10.120.11.1 -p 20,21,22,23,24`. – Thomas Jul 29 '17 at 14:20
  • @Thomas Thanks Thomas. Yes, seems to be a bit of a duplicate, but no really good answers. `nmap` didn't seem to work. Replies with `nmap 10.120.11.1 -p 22 Starting Nmap 6.40 ( http://nmap.org ) at 2017-07-29 14:29 UTC Note: Host seems down. If it is really up, but blocking our ping probes, try -Pn Nmap done: 1 IP address (0 hosts up) scanned in 3.03 seconds` – user1032531 Jul 29 '17 at 14:30

1 Answers1

2

Yea, I found that out as well that nc didn't support -z. I wonder why they dropped it. You could install an older version of ncat, or just use nmap.

Nmap nmap -sT -p <port>

Kyle H
  • 158
  • 7