0
# Start reading from the wordlist
while read domain; do
     # making words lower case
     mydom=$(echo "$domain$ext" | tr '[:upper:]' '[:lower:]')
     # Getting Expiration from the whois
     check=$(whois $mydom | egrep -i "Expiration | Expire on | Expiry")

     # If there is no expiration date the domain is free
     if [ -z "$check" ]
     then
          echo -e "\n\n$i: $mydom: FREE!\n"
          echo "$mydom: FREE!" >> results.txt
          found=$[ $found + 1 ]
     fi

     echo -en "\rCurrent: $i"
     i=$[ $i + 1 ]
done < $file1

I use a while loop and I read a domain name at each line of this file. Then I perform a whois on the domain name, and if the domain is free I note it to a file.

My problem is that sometimes the whois gets stuck on a long timeout. How could I add a time limit to the whois command, like 60 seconds, so that if there is a timeout or anything that could prevent the loop from proceeding, the program would stop it and continue with another iteration?

John Kugelman
  • 330,190
  • 66
  • 504
  • 555
Renato
  • 65
  • 6

0 Answers0