# getip.pl # (c) 2005 Christoph Bussenius # This Perl script is in the public domain use strict; use warnings; my $route = `ping -nRc1 maila.microsoft.com` or die "hey, pinging problems"; $route =~ s/.*?RR://s; while ($route =~ m{(\d+\.\d+\.\d+\.\d+)}g) { my $ip=$1; next if $ip =~ /^10\./; next if $ip =~ /^192\.168\./; next if $ip =~ /^172\.(\d+)\./ and $1 < 32 and $1 >= 16; next if $ip =~ /^127\./; print "My IP is $ip\n"; last; }