Script to check numerous ports / servers (Solaris native)

Hi

I'd like to check that a bunch of firewall rules have been applied and, therefore, want to write a script that basically does the following:

telnet serverA port1
telnet serverA port2
telnet serverB port1
telnet serverB port2

I would just compile the list in excel and run it as a script and pipe the output to a file, but telnet makes me hit the ^] keys to get out of a connection.

This is a work server running Solaris 10 and I don't have the option of running any non-native Solaris utilities.

I'm a bit of a noob with this stuff, so any help would be very much appreciated.

Thanks

Jibb :slight_smile:

for host in host1 host2
do
    for port in 20 22 80
    do
         echo "--- $host : $port ---"
         telnet $host $port < /dev/null
    done
done
1 Like

Wow! You rock! Thanks so much for this. I've just tried it and everything works perfectly :slight_smile: