Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Script to compare IANA vs current definitions

  • Loading branch information...
commit 755e2882d3641f4207ef9aa6e55bdd85ecabde1b 1 parent 44c9921
@weppos authored
Showing with 30 additions and 0 deletions.
  1. +30 −0 utils/compare-whois.rb
View
30 utils/compare-whois.rb
@@ -0,0 +1,30 @@
+#!/usr/bin/env ruby -wKU
+
+$:.unshift(File.expand_path("../../lib", __FILE__))
+
+require 'whois'
+
+IANAWHOIS_DIR = "~/Code/ianawhois"
+
+servers = {}
+definitions = Whois::Server.definitions(:tld).inject({}) do |hash, item|
+ hash.merge(item[0] => item[1])
+end
+
+Dir.glob("#{File.expand_path(IANAWHOIS_DIR)}/*").each do |entry|
+ basename = File.basename(entry)
+ next unless basename =~ /^[A-Z]+$/
+ content = File.read(entry)
+ server = content =~ /^whois:\s+(.+)\n$/ && $1
+ servers[".#{basename.downcase}"] = server
+end
+
+diffs = []
+servers.each do |host, server|
+ iana, whois = server, definitions[host]
+ if iana != whois
+ diffs << "#{host}: #{whois.inspect} -> #{iana.inspect}"
+ end
+end
+
+puts diffs.join("\n")
Please sign in to comment.
Something went wrong with that request. Please try again.