Domain Name Checker

slac3dork slac3dork is offline Offline Aug 1st, 2009, 10:22 am |
0
A simple domain name checker. This script use service from who.is
Usage:
ruby domainchecker.rb <domain_name>
Quick reply to this message  
Ruby Syntax
  1. #!/usr/bin/ruby
  2. #
  3. # This script is available under the GPLv3 License.
  4. # USE COMPLETELY ON YOUR OWN RISK.
  5. # written by slac3dork & tested on Linux
  6. # http://snippet.c0de.me
  7.  
  8. require 'open-uri'
  9.  
  10. if ARGV.size < 1
  11. puts '[-] Usage ./domainchecker.rb <domain_name>'
  12. exit 1
  13. end
  14.  
  15. puts '-----------------------------------------------'
  16. puts '[+] Domain Checker tool'
  17. puts '[+] domainchecker.rb'
  18. puts '[+] Coded by slac3dork'
  19. puts "-----------------------------------------------\n\n"
  20.  
  21. begin
  22. domain_name = ARGV[0]
  23. open("http://www.who.is/whois/#{domain_name}") {|page|
  24. page.each_line {|line|
  25. if (line =~ /Invalid Domain or IP/)
  26. puts '[-] ERROR! Please check your domain name'
  27. exit 1
  28. end
  29.  
  30. if (line =~ /Registry Whois Information/)
  31. puts "[-] #{domain_name} is not available"
  32. end
  33.  
  34. if (line =~ /Available for Registration/)
  35. puts "[+] #{line.slice(/([a-z]+[\.]{1}[a-z]{2,})( is Available for Registration)/)}"
  36. end
  37.  
  38. if (line =~ /./)
  39. avail_domain = line.slice(/domain=[a-z]+[\.]{1}[a-z]{2,}/).slice(/[a-z]+[\.]{1}[a-z]{2,}/)
  40. puts "[+] Available Domain: #{avail_domain}"
  41. end
  42. }
  43. }
  44. rescue
  45. puts '[-] Error while executing Domain Checker script. Check you internet connection'
  46. end

Message:


Similar Threads
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC