]> git.ipfire.org Git - people/stevee/ipfire-2.x.git/commitdiff
ipinfo.cgi: Add flag icon and IP reputational URL's.
authorMichael Horace <horace.michael@gmx.com>
Thu, 3 Nov 2016 12:41:15 +0000 (13:41 +0100)
committerStefan Schantl <stefan.schantl@ipfire.org>
Thu, 3 Nov 2016 13:06:53 +0000 (14:06 +0100)
* 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 <horace.michael@gmx.com>
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
html/cgi-bin/ipinfo.cgi
html/html/images/ipvoid.ico [new file with mode: 0644]
html/html/images/rbl.jpg [new file with mode: 0644]
html/html/images/virustotal.ico [new file with mode: 0644]
langs/en/cgi-bin/en.pl

index 8cefe6e853ffc74f82dddfb7c2ecfbfbb9e2862c..f9a2805a741b8dc3731238d8954329949452cefe 100644 (file)
@@ -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 .
+               ' <img src=\'' . $flag_icon . '\' border=\'0\' align=\'absmiddle\' alt=\'' .$cname .'\' title=\'' . $cname . '\'>
+               (' . $hostname . ') : '. $whoisname . '
+       ');
+
+       print<<END;
+
+       <table width="50%" border="0">
+               <tr>
+                       <td class="base" width="30%"><b>$Lang::tr{'ip reputational info'}</b></td>
+                       <td class="base" width="20%" align="center">
+                               <a href="http://www.ipvoid.com/scan/$addr" target="_blank">
+                                       <img src="/images/ipvoid.ico" title="IpVoid" border="0"> IPVoid
+                               </a>
+                       </td>
+                       <td class="base" width="20%" align="center">
+                               <a href="https://www.virustotal.com/en/ip-address/$addr/information" target="_blank">
+                                       <img src="/images/virustotal.ico" title="VirusTotal" border="0" /> VirusTotal
+                               </a>
+                       </td>
+                       <td class="base" width="20%" align="center">
+                               <a href="http://multirbl.valli.org/lookup/$addr.html" target="_blank">
+                                       <img src="/images/rbl.jpg" title="MultiRBL" border="0" /> MultiRBL
+                               </a>
+                       </td>
+               </tr>
+       </table>
+       <br><br>
+END
 
-       &Header::openbox('100%', 'left', $addr . ' (' . $hostname . ') : '.$whoisname);
        print "<pre>\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 (file)
index 0000000..ca18834
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 (file)
index 0000000..b52d253
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 (file)
index 0000000..a4f6311
Binary files /dev/null and b/html/html/images/virustotal.ico differ
index 0e5b46d348df33568d53c7ae81cda67447dbdf04..7b66066d8df3e1bde45dd8f588bd4c2c86d338cc 100644 (file)
 '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:',