Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
executable file 99 lines (70 sloc) 2.57 KB
#!/usr/bin/env ruby
# encoding: UTF-8
$LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + '/lib')
require 'pp'
require 'domain-profiler'
require 'rubygems'
require 'gchart'
require 'erb'
def fullname(name)
Name.new.full(name)
end
class Array
def lookup(host)
self.map{|name| Name.new.simplify(name,host) }.uniq
end
end
if ARGV.length != 2
print "Usage: ./profile-godaddy [file containing one domain per line] 'name of company grouping'\n"
exit
end
filename = ARGV[0]
file = File.new(filename)
hosts = {}
list_name = ARGV[1] ? ARGV[1] : 'REPLACE ME'
max_domain_length = 0
file.map {|host|
if match_data = host.match(/^#List:(.*)/)
list_name = match_data[1]
end
next if host.match(/^#/)
host.chomp!
profile = DomainProfiler.new(host)
if(host.length > max_domain_length)
max_domain_length = host.length
end
registrar = profile.whois.registrar.lookup(host)
dns_host = profile.dns.ns.map{|record| Name.new.shorten(record.answer) }.lookup(host)
ssl_issuer = profile.ssl.ca.lookup(host)
out = {}
out[:registrar] = (registrar[0] == :godaddy) ? 4 : 0
out[:dns_host] = (dns_host[0] == :godaddy) ? 2 : 0
out[:ssl_issuer] = (ssl_issuer[0] == :godaddy) ? 1 : 0
out[:sort_key] = out[:registrar] + out[:dns_host] + out[:ssl_issuer]
hosts[host] = out
}
print "This is a list of all %s companies that appear to do business with \nGoDaddy.\n" % [list_name]
puts <<PREAMBLE_END
In addition to showing which domains were registered through GoDaddy, this list
also shows domains that use GoDaddy's DNS service or use SSL certificates
purchased from GoDaddy.
Since it's easier to stop doing business with GoDaddy if your DNS is hosted
elsewhere, I've sorted this list according to the relative ease of moving away
from GoDaddy: The closer a domain is to the top of this list, the easier it
should be for the owners of that domain to stop doing business with GoDaddy.
---
Corrections to this list are welcome.
I prefer pull-requests on GitHub, you can also contact me on Twitter (@jf).
The code I used to generate this list is here:
https://github.com/jpf/domain-profiler
---
PREAMBLE_END
# Turn the list of host data into a hash of type data
hosts.sort_by{ |hostname,data| data[:sort_key].to_s + hostname }.each do |hostname,data|
next unless data[:sort_key] > 0
puts "%s %s %s %s" % [hostname.ljust(max_domain_length,' '),
(data[:registrar] > 0) ? 'REGISTRAR' : ' ',
(data[:dns_host] > 0) ? 'DNS' : ' ',
(data[:ssl_issuer] > 0) ? 'SSL' : ' '
]
end