From: Michael Horace Date: Thu, 3 Nov 2016 12:41:15 +0000 (+0100) Subject: ipinfo.cgi: Add flag icon and IP reputational URL's. X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=bbcb32acca3a6113931e7eebfef6a0884ee522bb;p=people%2Fstevee%2Fipfire-2.x.git ipinfo.cgi: Add flag icon and IP reputational URL's. * Use the GeoIP backend to obtain the country code of the given IP-address and to display the flag icon and country name, when moving the mouse pointer over the flag icon. * Add various URL (IPVoid, Virustotal and MultiRBL) for gaining reputational informations for the given IP-address. Signed-off-by: Michael Horace Signed-off-by: Stefan Schantl --- diff --git a/html/cgi-bin/ipinfo.cgi b/html/cgi-bin/ipinfo.cgi index 8cefe6e853..f9a2805a74 100644 --- a/html/cgi-bin/ipinfo.cgi +++ b/html/cgi-bin/ipinfo.cgi @@ -30,6 +30,7 @@ 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=(); @@ -50,6 +51,15 @@ if (&General::validip($addr)) { my $hostname = gethostbyaddr($iaddr, AF_INET); if (!$hostname) { $hostname = $Lang::tr{'lookup failed'}; } + # Obtain the country code for the given IP-address. + my $ccode = &GeoIP::get_ccode_by_address($addr); + + # Get full country name. + my $cname = &GeoIP::get_full_country_name($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 +90,36 @@ if (&General::validip($addr)) { { @lines = ( "$Lang::tr{'unable to contact'} $whoisname" ); } + &Header::openbox('100%', 'left', $addr . + ' \'' + (' . $hostname . ') : '. $whoisname . ' + '); + + print< + + $Lang::tr{'ip reputational info'} + + + IPVoid + + + + + VirusTotal + + + + + MultiRBL + + + + +

+END - &Header::openbox('100%', 'left', $addr . ' (' . $hostname . ') : '.$whoisname); print "
\n";
 	foreach my $line (@lines) {
 		print &Header::cleanhtml($line,"y");
diff --git a/html/html/images/ipvoid.ico b/html/html/images/ipvoid.ico
new file mode 100644
index 0000000000..ca188341ca
Binary files /dev/null and b/html/html/images/ipvoid.ico differ
diff --git a/html/html/images/rbl.jpg b/html/html/images/rbl.jpg
new file mode 100644
index 0000000000..b52d253657
Binary files /dev/null and b/html/html/images/rbl.jpg differ
diff --git a/html/html/images/virustotal.ico b/html/html/images/virustotal.ico
new file mode 100644
index 0000000000..a4f6311b8b
Binary files /dev/null and b/html/html/images/virustotal.ico differ
diff --git a/langs/en/cgi-bin/en.pl b/langs/en/cgi-bin/en.pl
index 0e5b46d348..7b66066d8d 100644
--- a/langs/en/cgi-bin/en.pl
+++ b/langs/en/cgi-bin/en.pl
@@ -1403,6 +1403,7 @@
 'ip alias changed' => 'External IP alias changed',
 'ip alias removed' => 'External IP alias removed',
 'ip info' => 'IP Information',
+'ip reputational info' => 'IP Reputational Info:',
 'ipfire has now rebooted' => 'IPFire is rebooting now.',
 'ipfire has now shutdown' => 'IPFire is shutting down now.',
 'ipfire side' => 'IPFire side:',