Showing posts with label nc. Show all posts
Showing posts with label nc. Show all posts

Linux: How to scan remote host for open ports ?

Linux : How to find a remote port is opened or not ?

Helllo Team,

If you are trying to findout whether a remote server port is opened or closed, then there are so many ways. Here In this article I am posting on same using telnet and nc commands.

Using telnet

Telnet usually holds prompt, so to avoid that, we are using echo in front of the command.

> $ echo | telnet xxxxxx 22
Trying xxxxxx...
Connected to xxxxx.
Escape character is '^]'.
Connection closed by foreign host.

Using nc

with nc command, its direct.

> $ nc -z -v -u xxxxx 22
Connection to xxxx port 22 [udp/ssh] succeeded!

# -z: Just perform scans without sending any data to the respective service running on the given port.
# -v : Verbose
# -u: UDP packets, without this it will be default tcp.

Hope it helps. Thanks

See Open Ports in a Linux PC ( Localhost/Remote Machine)

I am writing a small post that will help you just to see what ports are open in  a particular remote/local machine.

we are going to use tool name as nc.

To install it , open your terminal and type as

 # yum install nc



                              After installing , you can use it with

nc -zv xxx.xxx.xxx.xxx <Port>

                                           for example:

nc -zv 192.168.1.100 80

                                          if you want to do that for 2-3 ports

nc -zv 192.168.1.100 80 8009

                                            if you want to do scanning for range of ports

nc -zv 192,168.1.100 80-8080


hope it will help you.

THANK YOU