Signed-off-by: Horace Michael <horace.michael(a)gmx.com> --- html/cgi-bin/ipinfo.cgi | 45 +++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 41 insertions(+), 4 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..8bcad8662107 --- a/html/cgi-bin/ipinfo.cgi +++ b/html/cgi-bin/ipinfo.cgi @@ -22,20 +22,25 @@ use CGI; use IO::Socket; use strict; +use Geo::IP::PurePerl; # enable only the following on debugging purpose -#use warnings; -#use CGI::Carp 'fatalsToBrowser'; +use warnings; +use CGI::Carp 'fatalsToBrowser'; 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"); -- 2.7.4