Guest User

Untitled

a guest
Jul 20th, 2018
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1. #!/bin/sh
  2. # "Cute" domain search -- < oogali AT gmail.com >
  3. #
  4. # Example:
  5. # [oogali@illusion ~]$ ./cute-domain-search am 2
  6. # IL.AM IS AVAILABLE
  7. # LE.AM IS AVAILABLE
  8. # LY.AM IS AVAILABLE
  9. # OG.AM IS AVAILABLE
  10. # OL.AM IS AVAILABLE
  11. # QT.AM IS AVAILABLE
  12. # ST.AM IS AVAILABLE
  13. # TI.AM IS AVAILABLE
  14. #
  15. # And yes, it pains me that the documentation is more lines than the
  16. # actual script itself
  17.  
  18. if [ $# -ne 2 ]; then
  19. echo "$0 <tld> <# of letters>"
  20. exit 1
  21. fi
  22.  
  23. tld=${1}
  24. letters=${2}
  25.  
  26. rs=`dig ${tld} @a.root-servers.net ns +noadditional +noquestion +nostats +nocomments | grep "^${tld}" | awk '{ print $5 }' | head -1`
  27. for domain in `egrep "^[A-Za-z]{${letters}}${tld}\$" /usr/share/dict/words | tr '[A-Z]' '[a-z]' | sort | uniq | sed "s/${tld}\$//"` ; do
  28. dig ${domain}.${tld} ns @${rs} | grep -q 'NXDOMAIN' && echo "${domain}.${tld} is available" | tr '[a-z]' '[A-Z]'
  29. done
Add Comment
Please, Sign In to add comment