Permalink
Browse files

initial commit

  • Loading branch information...
0 parents commit a80be182a65244ac84e820ccdedb08ea0cef05a4 @neophiliac neophiliac committed Nov 24, 2010
Showing with 35 additions and 0 deletions.
  1. +12 −0 README
  2. +23 −0 whoozr.rb
12 README
@@ -0,0 +1,12 @@
+Usage:
+<stream of words> | xargs whoozr.rb
+
+Output: (e.g.)
+streptococc.us is available
+
+Flaws: (notice I saved this for last)
+It's hardcoded for the extensions to try.
+It needs a Gemfile to make loading the whois gem brainless.
+It should have a command line option to specify the list of TLDs to check.
+It should spawn N threads to speed up the search.
+It needs tests?
@@ -0,0 +1,23 @@
+require 'rubygems'
+require 'whois'
+
+c = Whois::Client.new
+
+ARGV.each do |dom|
+ check = String.new(dom)
+ if !(i = check.index(/me$/)).nil? then
+ check = check.insert(i, '.')
+ end
+ if !(i = check.index(/ag$/)).nil? then
+ check = check.insert(i, '.')
+ end
+ if !(i = check.index(/org$/)).nil? then
+ check = check.insert(i, '.')
+ end
+ if !(i = check.index(/us$/)).nil? then
+ check = check.insert(i, '.')
+ end
+ if check.index('.') && c.query(check).available? then
+ puts check + " is available"
+ end
+end

0 comments on commit a80be18

Please sign in to comment.