Skip to content

Instantly share code, notes, and snippets.

@rkuhn
Last active August 29, 2015 14:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rkuhn/dd6312ca1d2aacd9cfc3 to your computer and use it in GitHub Desktop.
Save rkuhn/dd6312ca1d2aacd9cfc3 to your computer and use it in GitHub Desktop.
rk:~ rkuhn$ tracert.pl youtube.com
traceroute: Warning: youtube.com has multiple addresses; using 173.194.113.136
traceroute to youtube.com (173.194.113.136), 64 hops max, 52 byte packets
1 fritz.box (192.168.178.1 [PRIVATE-ADDRESS-CBLK-RFC1918-IANA-RESERVED]) 0.933 ms 0.772 ms 0.707 ms
2 213.191.89.55 (213.191.89.55 [HANSENET]) 25.085 ms 25.208 ms 25.241 ms
3 62.53.12.0 (62.53.12.0 [DE-MEDIAWAYS-970527]) 25.232 ms 25.375 ms 26.425 ms
4 ge8-0.br50.fra.de.hansenet.net (62.109.70.21 [DE-HANSENET-20010803]) 25.899 ms 25.569 ms 40.448 ms
5 de-cix10.net.google.com (80.81.192.108 [DE-CIX-FRA-IXP]) 26.053 ms 25.781 ms 25.564 ms
6 209.85.240.64 (209.85.240.64 [GOOGLE]) 34.697 ms 26.763 ms
209.85.241.110 (209.85.241.110 [GOOGLE]) 26.022 ms
7 72.14.234.235 (72.14.234.235 [GOOGLE]) 26.135 ms
72.14.234.231 (72.14.234.231 [GOOGLE]) 25.715 ms
209.85.251.248 (209.85.251.248 [GOOGLE]) 26.847 ms
8 209.85.242.187 (209.85.242.187 [GOOGLE]) 44.542 ms
209.85.240.223 (209.85.240.223 [GOOGLE]) 33.857 ms
209.85.242.187 (209.85.242.187 [GOOGLE]) 33.671 ms
9 72.14.233.166 (72.14.233.166 [GOOGLE]) 33.886 ms 33.394 ms 33.396 ms
10 72.14.235.215 (72.14.235.215 [GOOGLE]) 34.320 ms 34.208 ms 34.016 ms
11 ham02s11-in-f8.1e100.net (173.194.113.136 [GOOGLE]) 33.960 ms 33.900 ms 33.606 ms
#!/usr/bin/perl
use strict;
use warnings;
open my $proc, "traceroute $ARGV[0]|" or die "cannot start `traceroute`: $!\n";
while (<$proc>) {
next unless my ($ip) = /\((\d+\.\d+\.\d+\.\d+)\)/;
my $whois = `whois $ip | grep -i netname: | tail -1`;
chomp $whois;
$whois =~ s/^netname:\s+//i;
s/\($ip/\($ip [$whois]/;
} continue {
print;
}
@rkuhn
Copy link
Author

rkuhn commented Jul 23, 2014

Any use of this code occurs at your own risk! (and it has only been tested on OS X 10.9)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment