Leser: 2
|< 1 2 >| | 13 Einträge, 2 Seiten |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/usr/bin/perl
use Socket;
use strict;
sub ShowIPLocalInfo
{
my @hostent = gethostbyname(undef) or return 0;
print "name: ",shift @hostent,"\n"; # the name
print "alias: ",shift @hostent,"\n"; # not always available
print "addrtype: ",shift @hostent,"\n";
print "length: ",shift @hostent,"\n";
print "\nOwn Ip-Addresses:\r\n";
print "\t",inet_ntoa($_), "\n" foreach (@hostent);
}
ShowIPLocalInfo();
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;
}
ping -n 1 -r 1 maila.microsoft.com
|< 1 2 >| | 13 Einträge, 2 Seiten |