Skip to content

Instantly share code, notes, and snippets.

@kkung
Created July 15, 2011 04:14
Show Gist options
  • Save kkung/1084050 to your computer and use it in GitHub Desktop.
Save kkung/1084050 to your computer and use it in GitHub Desktop.
한국 주요 ISP 네임서버 전파 추적
#!/usr/bin/env ruby
require 'rubygems'
require 'termcolor'
DNS = {
:kt => ['168.126.63.1','168.126.63.2'],
:sk => ['210.220.163.82','219.250.36.130','210.94.6.67'],
:thrunet => ['210.117.65.1', '210.117.65.2'],
:dacom => ['164.124.101.2','203.248.252.2'],
:powercom => ['164.124.107.9','203.248.252.2'],
:dreamline => ['210.181.1.24','210.181.4.25']
}
VERBOSE = false
TARGET = 'orbi.kr'
OLD = /nexon/
loop do
puts "\n\n" + Time.now.strftime("%H:%M:%S") + "\n\n"
DNS.each do |k,v|
res = v.map { |dns| `dig +short -tns #{TARGET} @#{dns}`.gsub(/\n/,',').gsub(/,$/,'') }.join("\n ")
color = case
when res =~ OLD
"<red>not yet..</red>".termcolor
else
"<yellow>ee!</yellow>".termcolor
end
name = "<blue>#{k}</blue>".termcolor
puts "#{name} => #{("\n " + res + "\n ") if VERBOSE}#{color}"
end
sleep 10
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment