Quote:
#!/bin/bash
if [ $# -ne 3 ]
then
echo "Usage: $(basename $0) <host/ip> <start port> <end port>"
exit 1
fi
for port in $(seq $2 $3)
do
nc -z $1 $port && echo "$port on $1 is open"
done
I want to extend this script.
This must also be able to show me that a port is already assigned to a service but not running now
there must be three different messages
port 8949 is open but not listening
port 8959 is open
port 8999 hasn't been assigned to any service.
I know that using telnet we can do but how can I use the telnet command( this must be done using set timeout)
Thanks,
Charan