Hi
i'm writing a bash script to scan a port of an IP and then prompt me to either scan another or exit, (basic i know but i have no scripting or programming knowlegde and i'm learning)
i cant seem to get the script to prompt me to scan again or quit. can anyone tell me where i have gone wrong. below is my script.
#!/bin/bash
hpinger()
{
echo enter IP address
read ip_address
echo enter port
read port
hping $ip_address -c 1 -S -p $port >hpingscan
}
hpinger
grep "flags=SA" /home/bash/bin/hpingscan > /dev/null 2>&1
if [ "$?" -eq 0 ]; then
clear
echo "port open"
exit
else
echo "port closed"
fi
sleep 2
echo "1. another scan"
echo "2. Exit"
echo "Enter your choice: "
read choice
case $choice in
1) hpinger # call hpinger() function
;;
2) exit # exit
esac
Thanks for any help
Thatch