Skip to content
This repository
Fetching contributors…

Cannot retrieve contributors at this time

executable file 22 lines (17 sloc) 0.5 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
#!/usr/bin/env ruby -wKU

$:.unshift(File.expand_path("../../lib", __FILE__))

require "fileutils"
require "whois"

d = ARGV.shift || raise("Missing domain")
n = ARGV.shift || raise("Missing file name")

r = Whois.query(d)

if r.parts.size == 1
  r.parts.each do |part|
    p = File.expand_path("../../test/testcases/responses/#{part.host}", __FILE__)
    FileUtils.mkdir_p(p)
    File.open("#{p}/#{n}", "w+") { |f| f.write(part.body) }
    puts "Saved #{p}/#{n}"
  end
else
  raise("Multipart")
end
Something went wrong with that request. Please try again.