Signed-off-by: Horace Michael horace.michael@gmx.com --- html/cgi-bin/ipinfo.cgi | 41 +++++++++++++++++++++++++++++++++++++++-- 1 file changed, 39 insertions(+), 2 deletions(-) mode change 100644 => 100755 html/cgi-bin/ipinfo.cgi
diff --git a/html/cgi-bin/ipinfo.cgi b/html/cgi-bin/ipinfo.cgi old mode 100644 new mode 100755 index 8cefe6e853ff..f118c654d403 --- a/html/cgi-bin/ipinfo.cgi +++ b/html/cgi-bin/ipinfo.cgi @@ -22,6 +22,7 @@ use CGI; use IO::Socket; use strict; +use Geo::IP::PurePerl;
# enable only the following on debugging purpose #use warnings; @@ -30,12 +31,16 @@ use strict; require '/var/ipfire/general-functions.pl'; require "${General::swroot}/lang.pl"; require "${General::swroot}/header.pl"; +require "${General::swroot}/geoip-functions.pl";
my %cgiparams=(); +my $s; +my @key;
&Header::showhttpheaders();
&Header::openpage($Lang::tr{'ip info'}, 1, ''); + &Header::openbigbox('100%', 'left'); my @lines=(); my $extraquery=''; @@ -50,6 +55,13 @@ if (&General::validip($addr)) { my $hostname = gethostbyaddr($iaddr, AF_INET); if (!$hostname) { $hostname = $Lang::tr{'lookup failed'}; }
+ # geoip lookup + my $geoaddr = Geo::IP::PurePerl->new(); + my $ccode = $geoaddr->country_code_by_name($addr); + my $fcode = lc($ccode); + # Get flag icon for of the country. + my $flag_icon = &GeoIP::get_flag_icon($ccode); + my $sock = new IO::Socket::INET ( PeerAddr => $whoisname, PeerPort => 43, Proto => 'tcp'); if ($sock) { @@ -80,8 +92,33 @@ if (&General::validip($addr)) { { @lines = ( "$Lang::tr{'unable to contact'} $whoisname" ); } - - &Header::openbox('100%', 'left', $addr . ' (' . $hostname . ') : '.$whoisname); + # include geoip information here + &Header::openbox('100%', 'left', $addr . + ' <a href='/cgi-bin/country.cgi#' . $fcode . ''><img src='' . $flag_icon . '' border='0' align='absmiddle' alt='' .$ccode .'' title='' . $ccode . ''></a> + (' . $hostname . ') : '. $whoisname . + '; + + <form method='post' action='http://www.ipvoid.com/scan/' . $addr . '/' target=_blank> + IP Reputational info: + <a href='http://www.ipvoid.com/scan/' . $addr . '/' target=_blank>IpVoid + <input type='image' title=IPVoid src='/images/ipvoid.ico'> + </a>; + <a href='https://www.virustotal.com/en/ip-address/' . $addr . '/information' target=_blank>VirusTotal + <img src='/images/virustotal.ico' title=VirusTotal border='0' /> + </a>; + <a href='http://whois.domaintools.com/' . $addr . '' target=_blank>DomainTools + <img src='/images/domaintools.ico' title=DomainTools border='0' /> + </a>; + <a href='http://multirbl.valli.org/lookup/' . $addr . '.html' target=_blank>MultiRBL + <img src='/images/rbl.jpg' title=MultiRBL border='0' /> + </a> + </form> + + ' + + + ); + print "<pre>\n"; foreach my $line (@lines) { print &Header::cleanhtml($line,"y");