Telnet to a port on a remote machine without ncat or telnet, or nmap

There are situations where you may be working on Linux based system, and telnet, ncat or nmap does not exist.

In Linux, you can route a test thru the protocol, destination IP address, and destination  port using the “/dev” linux ‘pseudo device’ 

The ‘telnet’ command we are all familiar with is essentially a wrapper for this procedure.

This can be done safely without impact to system operation.

# echo > /dev/tcp/10.10.154.121/10600 && echo "TCP Port 10600 is open"

The same works with UDP

 echo > /dev/udp/10.10.154.121/111 && echo "UDP Port 111 is open"

To test multiple TCP ports via for loop:

# for i in 88 111 135 139 445 464 3268 3269 ; do
echo > /dev/tcp/10.10.154.133/$i && echo "TCP Port $i is open"
done

This entry was posted in Command Line FU, Networking and tagged , , , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *