Skip to content

Instantly share code, notes, and snippets.

@sbuys
Created October 6, 2010 03:20
Show Gist options
  • Save sbuys/612750 to your computer and use it in GitHub Desktop.
Save sbuys/612750 to your computer and use it in GitHub Desktop.
require 'open3'
#Array of top 25 US sites by Alexa rank (daily visits & pageviews)
destinations = %w{ google.com facebook.com yahoo.com youtube.com amazon.com wikipedia.org twitter.com ebay.com craigslist.org blogspot.com live.com msn.com go.com bing.com aol.com linkedin.com espn.go.com myspace.com cnn.com wordpress.com netflix.com paypal.com imdb.com flickr.com microsoft.com }
destinations.each do |destination|
puts "\nTracing: #{destination}"
cmd_string = "traceroute -m 25 -w 1 #{destination}" #25 hops, 1s timeout
stdin, stdout, stderr = Open3.popen3(cmd_string)
stdout.each_with_index do |line, index|
puts line
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment