]> git.ipfire.org Git - ipfire-2.x.git/blobdiff - html/cgi-bin/ipinfo.cgi
Großes Update:
[ipfire-2.x.git] / html / cgi-bin / ipinfo.cgi
index 38e90b08e559bc2474b3645a963c3fde7213a273..258fff323ff0e9be34bce70e3daec568d669a0ea 100644 (file)
-#!/usr/bin/perl\r
-#\r
-# SmoothWall CGIs\r
-#\r
-# This code is distributed under the terms of the GPL\r
-#\r
-# (c) The SmoothWall Team\r
-#\r
-# (c) 2002 Josh Grubman <jg@false.net> - Multiple registry IP lookup code\r
-#\r
-# $Id: ipinfo.cgi,v 1.4.2.3 2005/02/22 22:21:56 gespinasse Exp $\r
-#\r
-\r
-use IO::Socket;\r
-use strict;\r
-\r
-# enable only the following on debugging purpose\r
-#use warnings;\r
-#use CGI::Carp 'fatalsToBrowser';\r
-\r
-require 'CONFIG_ROOT/general-functions.pl';\r
-require "${General::swroot}/lang.pl";\r
-require "${General::swroot}/header.pl";\r
-\r
-my %cgiparams=();\r
-\r
-&Header::showhttpheaders();\r
-\r
-&Header::getcgihash(\%cgiparams);\r
-\r
-$ENV{'QUERY_STRING'} =~s/&//g;\r
-my @addrs = split(/ip=/,$ENV{'QUERY_STRING'});\r
-\r
-my %whois_servers = ("RIPE"=>"whois.ripe.net","APNIC"=>"whois.apnic.net","LACNIC"=>"whois.lacnic.net");\r
-\r
-&Header::openpage($Lang::tr{'ip info'}, 1, '');\r
-\r
-&Header::openbigbox('100%', 'left');\r
-my @lines=();\r
-my $extraquery='';\r
-foreach my $addr (@addrs) {\r
-next if $addr eq "";\r
-       $extraquery='';\r
-       @lines=();\r
-       my $whoisname = "whois.arin.net";\r
-       my $iaddr = inet_aton($addr);\r
-       my $hostname = gethostbyaddr($iaddr, AF_INET);\r
-       if (!$hostname) { $hostname = $Lang::tr{'lookup failed'}; }\r
-\r
-       my $sock = new IO::Socket::INET ( PeerAddr => $whoisname, PeerPort => 43, Proto => 'tcp');\r
-       if ($sock)\r
-       {\r
-               print $sock "$addr\n";\r
-               while (<$sock>) {\r
-                       $extraquery = $1 if (/NetType:    Allocated to (\S+)\s+/);\r
-                       push(@lines,$_);\r
-               }\r
-               close($sock);\r
-               if ($extraquery) {\r
-                       undef (@lines);\r
-                       $whoisname = $whois_servers{$extraquery};\r
-                       my $sock = new IO::Socket::INET ( PeerAddr => $whoisname, PeerPort => 43, Proto => 'tcp');\r
-                       if ($sock)\r
-                       {\r
-                               print $sock "$addr\n";\r
-                               while (<$sock>) {\r
-                                       push(@lines,$_);\r
-                               }\r
-                       }\r
-                       else\r
-                       {\r
-                               @lines = ( "$Lang::tr{'unable to contact'} $whoisname" );\r
-                       }\r
-               }\r
-       }\r
-       else\r
-       {\r
-               @lines = ( "$Lang::tr{'unable to contact'} $whoisname" );\r
-       }\r
-\r
-       &Header::openbox('100%', 'left', $addr . ' (' . $hostname . ') : '.$whoisname);\r
-       print "<pre>\n";\r
-       foreach my $line (@lines) {\r
-               print &Header::cleanhtml($line,"y");\r
-       }\r
-       print "</pre>\n";\r
-       &Header::closebox();\r
-}\r
-\r
-print <<END\r
-<div align='center'>\r
-<table width='80%'>\r
-<tr>\r
-       <td align='center'><a href='$ENV{'HTTP_REFERER'}'>$Lang::tr{'back'}</a></td>\r
-</tr>\r
-</table>\r
-</div>\r
-END\r
-;\r
-\r
-&Header::closebigbox();\r
-\r
-&Header::closepage();\r
+#!/usr/bin/perl
+#
+# SmoothWall CGIs
+#
+# This code is distributed under the terms of the GPL
+#
+# (c) The SmoothWall Team
+#
+# (c) 2002 Josh Grubman <jg@false.net> - Multiple registry IP lookup code
+#
+# $Id: ipinfo.cgi,v 1.4.2.3 2005/02/22 22:21:56 gespinasse Exp $
+#
+
+use IO::Socket;
+use strict;
+
+# enable only the following on debugging purpose
+#use warnings;
+#use CGI::Carp 'fatalsToBrowser';
+
+require 'CONFIG_ROOT/general-functions.pl';
+require "${General::swroot}/lang.pl";
+require "${General::swroot}/header.pl";
+
+my %cgiparams=();
+
+&Header::showhttpheaders();
+
+&Header::getcgihash(\%cgiparams);
+
+$ENV{'QUERY_STRING'} =~s/&//g;
+my @addrs = split(/ip=/,$ENV{'QUERY_STRING'});
+
+my %whois_servers = ("RIPE"=>"whois.ripe.net","APNIC"=>"whois.apnic.net","LACNIC"=>"whois.lacnic.net");
+
+&Header::openpage($Lang::tr{'ip info'}, 1, '');
+
+&Header::openbigbox('100%', 'left');
+my @lines=();
+my $extraquery='';
+foreach my $addr (@addrs) {
+next if $addr eq "";
+       $extraquery='';
+       @lines=();
+       my $whoisname = "whois.arin.net";
+       my $iaddr = inet_aton($addr);
+       my $hostname = gethostbyaddr($iaddr, AF_INET);
+       if (!$hostname) { $hostname = $Lang::tr{'lookup failed'}; }
+
+       my $sock = new IO::Socket::INET ( PeerAddr => $whoisname, PeerPort => 43, Proto => 'tcp');
+       if ($sock)
+       {
+               print $sock "$addr\n";
+               while (<$sock>) {
+                       $extraquery = $1 if (/NetType:    Allocated to (\S+)\s+/);
+                       push(@lines,$_);
+               }
+               close($sock);
+               if ($extraquery) {
+                       undef (@lines);
+                       $whoisname = $whois_servers{$extraquery};
+                       my $sock = new IO::Socket::INET ( PeerAddr => $whoisname, PeerPort => 43, Proto => 'tcp');
+                       if ($sock)
+                       {
+                               print $sock "$addr\n";
+                               while (<$sock>) {
+                                       push(@lines,$_);
+                               }
+                       }
+                       else
+                       {
+                               @lines = ( "$Lang::tr{'unable to contact'} $whoisname" );
+                       }
+               }
+       }
+       else
+       {
+               @lines = ( "$Lang::tr{'unable to contact'} $whoisname" );
+       }
+
+       &Header::openbox('100%', 'left', $addr . ' (' . $hostname . ') : '.$whoisname);
+       print "<pre>\n";
+       foreach my $line (@lines) {
+               print &Header::cleanhtml($line,"y");
+       }
+       print "</pre>\n";
+       &Header::closebox();
+}
+
+print <<END
+<div align='center'>
+<table width='80%'>
+<tr>
+       <td align='center'><a href='$ENV{'HTTP_REFERER'}'>$Lang::tr{'back'}</a></td>
+</tr>
+</table>
+</div>
+END
+;
+
+&Header::closebigbox();
+
+&Header::closepage();