Hi Guys,
I am looking for a script with a nested loop. My script reads a list of IP addresses and runs the nmap command against each IP in the file. Said file is then used to probe which version of ssh is on that system.
IP file looks like this:
192.168.1.1
192.168.1.150
and port info file is like this:
"22" "tcp" "open" "openssh 4.7p1" "ubuntu"
"22" "tcp" "open" "openssh 4.3" "suse"
So far I have
while read ip_address
do
echo "Scanning $ip_address"
while read portinfo
service=`cat $portinfo | awk '{ print $3 }'
if [ "$portinfo" = openssh 4.7p1"
then
echo "Vulnerable SSH version found
fi
done < $ip_address.ports
done < iplist.txt
I can't seem to make this work at all, and keep seeing syntax error near line done < $ip_address.ports
Both the iplist.txt and $ip_address.ports files are already created. I have omitted this code as it is simply an nmap scan with some grepping
I know this is something very basic messing the script up, but I cannot see what.
Thanks,
Robert