if [[ $(timeout 3 nc -zv 172.31.3.2 88) = *open* ]];then
echo "Port Open"
else
echo "Port Closed"
fi
I am trying to check if a port is open then it printing out port open if it is open.
I am using netcat to do that.
It should return something like: [172.31.3.2] 88 (kerberos) open.
I am trying to check for that open string in the output, then if it says that it will return port open
For some reason it just keeps returning this:
[172.31.3.2] 88 (kerberos) open
Port Closed