X-Git-Url: http://git.ipfire.org/?p=people%2Fteissler%2Fipfire-2.x.git;a=blobdiff_plain;f=html%2Fcgi-bin%2Fipinfo.cgi;h=71098a2529f8ed1c1e71cee3cfef06f4c91200b0;hp=fbf652244f4091b3e5c27f2a93dbce9db221f02a;hb=3b2ad4a1bddd2185da6bd500be39ee19694399a7;hpb=986e08d996eadd906ecbe6c9ac8ad48aa78bd854 diff --git a/html/cgi-bin/ipinfo.cgi b/html/cgi-bin/ipinfo.cgi index fbf652244..71098a252 100644 --- a/html/cgi-bin/ipinfo.cgi +++ b/html/cgi-bin/ipinfo.cgi @@ -1,15 +1,23 @@ #!/usr/bin/perl -# -# SmoothWall CGIs -# -# This code is distributed under the terms of the GPL -# -# (c) The SmoothWall Team -# -# (c) 2002 Josh Grubman - Multiple registry IP lookup code -# -# $Id: ipinfo.cgi,v 1.4.2.3 2005/02/22 22:21:56 gespinasse Exp $ -# +############################################################################### +# # +# IPFire.org - A linux based firewall # +# Copyright (C) 2010 IPFire Team # +# # +# This program is free software: you can redistribute it and/or modify # +# it under the terms of the GNU General Public License as published by # +# the Free Software Foundation, either version 3 of the License, or # +# (at your option) any later version. # +# # +# This program is distributed in the hope that it will be useful, # +# but WITHOUT ANY WARRANTY; without even the implied warranty of # +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # +# GNU General Public License for more details. # +# # +# You should have received a copy of the GNU General Public License # +# along with this program. If not, see . # +# # +############################################################################### use IO::Socket; use strict; @@ -31,8 +39,6 @@ my %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'); @@ -50,15 +56,15 @@ next if $addr eq ""; my $sock = new IO::Socket::INET ( PeerAddr => $whoisname, PeerPort => 43, Proto => 'tcp'); if ($sock) { - print $sock "$addr\n"; + print $sock "n $addr\n"; while (<$sock>) { - $extraquery = $1 if (/NetType: Allocated to (\S+)\s+/); + $extraquery = $1 if (/ReferralServer: whois:\/\/(\S+)\s+/); push(@lines,$_); } close($sock); if ($extraquery) { undef (@lines); - $whoisname = $whois_servers{$extraquery}; + $whoisname = $extraquery; my $sock = new IO::Socket::INET ( PeerAddr => $whoisname, PeerPort => 43, Proto => 'tcp'); if ($sock) {