├── README └── whoozr.rb /README: -------------------------------------------------------------------------------- 1 | Usage: 2 | | xargs whoozr.rb 3 | 4 | Output: (e.g.) 5 | streptococc.us is available 6 | 7 | Flaws: (notice I saved this for last) 8 | It's hardcoded for the extensions to try. 9 | It needs a Gemfile to make loading the whois gem brainless. 10 | It should have a command line option to specify the list of TLDs to check. 11 | It should spawn N threads to speed up the search. 12 | It needs tests? 13 | -------------------------------------------------------------------------------- /whoozr.rb: -------------------------------------------------------------------------------- 1 | require 'rubygems' 2 | require 'whois' 3 | 4 | c = Whois::Client.new 5 | 6 | ARGV.each do |dom| 7 | check = String.new(dom) 8 | if !(i = check.index(/me$/)).nil? then 9 | check = check.insert(i, '.') 10 | end 11 | if !(i = check.index(/ag$/)).nil? then 12 | check = check.insert(i, '.') 13 | end 14 | if !(i = check.index(/org$/)).nil? then 15 | check = check.insert(i, '.') 16 | end 17 | if !(i = check.index(/us$/)).nil? then 18 | check = check.insert(i, '.') 19 | end 20 | if check.index('.') && c.query(check).available? then 21 | puts check + " is available" 22 | end 23 | end 24 | --------------------------------------------------------------------------------