connect to TCP port using bash only

The device /dev/tcp// may be used to access the TCP stack

here is an example using redirects to connect to a specific service

exec 7<>/dev/tcp/www.google.com/80; cat <&5 & cat >&5; exec 5>&-

exec is used to redirect to a new file descriptor 7 whereas the cat redirects descriptor 7 to STDOUT. And finally the descriptor is cleaned up with the last exec.

Checking a remote port with just cat
cat < /dev/tcp//

Leave a Reply