How to check open ports on a remote server without netcat or nmap linux command
In the work of sysadmin, we can sometimes want to check open ports on our remote server. But if we are on a machine where can not install nmap or we don't have the possibility to install a tool which can help us to check open ports, what could we do?
We can check it with bash using
/dev/tcp
or /dev/udp
to open a TCP or UDP connection to the associated socket. The command behavior is:$ echo > /dev/tcp/$host/$port
we can associate a message to display if the port is opened
$ echo > /etc/tcp/8.8.8.8/53 && echo "OPEN PORT" OPEN PORT $ echo > /dev/tcp/8.8.8.8/80 && echo "GOOD" || echo "NOT OPEN" -bash: connect: Connection timed out -bash: /dev/tcp/8.8.8.8/80: Connection timed out NOT OPEN
0 Comments
Post a Comment