From bbcb32acca3a6113931e7eebfef6a0884ee522bb Mon Sep 17 00:00:00 2001 From: Michael Horace Date: Thu, 3 Nov 2016 13:41:15 +0100 Subject: [PATCH] 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 --- html/cgi-bin/ipinfo.cgi | 40 +++++++++++++++++++++++++++++++- html/html/images/ipvoid.ico | Bin 0 -> 1150 bytes html/html/images/rbl.jpg | Bin 0 -> 556 bytes html/html/images/virustotal.ico | Bin 0 -> 1150 bytes langs/en/cgi-bin/en.pl | 1 + 5 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 html/html/images/ipvoid.ico create mode 100644 html/html/images/rbl.jpg create mode 100644 html/html/images/virustotal.ico 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 0000000000000000000000000000000000000000..ca188341ca19d87adc9c81c05870359eafa406bb
GIT binary patch
literal 1150
zc-ozl%}Z2a6vm&l)R`$7kaQQ5NNDCqi-wSls6=Sv!bQuL1x2g=jFu9TS`Jy7ijzes
zL=%Qq4)*akOhlxM-o>NvEOj3~n9-+5mJ3
zrIhh}|uQmH0<_0WkJzgRj8i~$x#0&FxsOhNY5Tp9f=)Ze0Hz2R|#5W>w
zgy^|Qyiz>9OEf2mfe}XMSLpw1K`d4YSQfV5WR1UO{hFUrte&R6EB-+|SN^3~t`Zan
ztZMxz_D{<%*xckFJ?1?a*4yBidRCp)xQ@F4ueE+0`@QntS-%<#+4R-_H+AQQJ<@d>dZ@tQIN)XwrMA5GOO&sqgS`HKQ>c<>&3nJPt_WR{;DbC09
z%W8ff=rucfi9^kPtvTkdi%pwleE&}A{(Z7}@A&?f%V^*B6aN3l?s&cR2y+8I+AQ?^
z3~1J)dVW4DUeoh)c36F%alf;lxP6b<_~ZU>M#t%iBFcWqqZi}*^PMdiG?MZE*X
WIKO|&*w#C^tvdBlLfwb<7k>e2H(vVy

literal 0
Hc-jL100001

diff --git a/html/html/images/rbl.jpg b/html/html/images/rbl.jpg
new file mode 100644
index 0000000000000000000000000000000000000000..b52d2536572147389a57354a08aacef4df3dff9f
GIT binary patch
literal 556
zc-s4a~;k+`^QRlZ%U&n^%&LPtsIH
zPQ?^EFhk|)m}){Op!oj-41ydC5)2Z|j7khlf{e_9jQ@`S`HT$AKsO=*RyKAHpp2FP
z10ypt6ALRVOoEY#S&)H+RY;MI-7rvCDY0>(h@(^CM35`Ors>K!{bB106Iy%8XYSvI
zHP4Uk@O|JEs?W@D)@n=dRgudDyRv3%%zal25});NcYf9psq|Z6
zUwExHtM5O9#)Z30?{w#QPiK^xn78Gv?ehIwHG{+^WC_YVU$jB|ReS-5bB%pU+ihNk
aOHLD5oc8O_T&n53_h@9L_5RKOZvp`9kf8|x

literal 0
Hc-jL100001

diff --git a/html/html/images/virustotal.ico b/html/html/images/virustotal.ico
new file mode 100644
index 0000000000000000000000000000000000000000..a4f6311b8b51d41f96afdf52e022141aa456858f
GIT binary patch
literal 1150
zc-o~?Nl#Nz7`?TH8iz;|LyRjEW8%iJGP+RW#*Og@5H`jbhqy6rRVLdK+C{q}Ku9&F
zfJ($_CBy`xh+>2e4+t#m-aB&tNk?kEpi~OT&$b`Mx3?$(p1ZKPM!|_zfdD1@P9A95`VgB110%@kctmLcr!;xiL%uIC}u
zQN+&`#20yW2jHwf3Xl0Z^}mhJCqMJl<|=7f=!|?H-^hDuua)8Fs|rM>J|dlraZYZV
z8yb6wDf2bbR#BYdz5V;FhpXj0;(;GXr`M6qN%unJMkYUCys3=hsi>~vof>z?Pi=($
z+{;{!YsCD6m@r+UoD}>%@}BL?R_xJ1;wy+>%X7_Sl02TMHDkSt;m1@@l}x%v+P}=E
zL51ngN(8>>ur$;RkLfZ3y^pA8?TAkI;Ma&5Udt_v8cxF|YE=_zq<_Wd1%Jy!Vp
zb%@W~u<*SJOSTtS7TRdmR{s5oIi-?OtOf1#9kya|$V6yCg!VJp6xJ3;u^O<0{ipo~
D044HO

literal 0
Hc-jL100001

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:',
-- 
2.39.5