Thread eigene IP (12 answers)
Opened by Strazke at 2005-09-08 18:41

betterworld
 2005-09-09 02:41
#38477 #38477
User since
2003-08-21
2614 articles
ModeratorIn

user image
OK, ich habe hier die ultimative Loesung zu dem Problem:
Code: (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# 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;
}


edit: hmm. funktioniert nicht auf FreeBSD ohne Router... aber sonst immer, ich hab's getestet ;-)\n\n

<!--EDIT|betterworld|1126219691-->

View full thread eigene IP