Skip to content

Instantly share code, notes, and snippets.

@jetpks
Created December 13, 2012 10:47
Show Gist options
  • Save jetpks/4275668 to your computer and use it in GitHub Desktop.
Save jetpks/4275668 to your computer and use it in GitHub Desktop.
Find available three letter .io domains from list of any sized words in a file called ./wordlist.
#!/usr/bin/env ruby
require 'whois'
def load_words
three_letter_words = []
File.open('./wordlist', 'r') do |infile|
while (line = infile.gets)
next if (line == nil or line.chomp.length > 3)
three_letter_words.push(line.chomp)
end
end
return three_letter_words
end
def query_and_report(domain, client=Whois::Client.new)
if client.query(domain).available?
puts "Available: #{domain}"
File.open('./three_available', 'a') do |out|
out.write("#{domain}\n")
end
end
end
def wait(rstart, rend)
sleep(rand(rstart..rend))
end
c = Whois::Client.new
load_words.each do |word|
query_and_report("#{word}.io",c)
wait(1,3)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment