From mboxrd@z Thu Jan 1 00:00:00 1970 From: Peter =?utf-8?q?M=C3=BCller?= To: development@lists.ipfire.org Subject: [PATCH] display rDNS and GeoIP information for used nameservers Date: Mon, 06 Nov 2017 19:09:19 +0100 Message-ID: <20171106190919.2f0f434f.peter.mueller@link38.eu> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============3215858211456241125==" List-Id: --===============3215858211456241125== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Display rDNS/PTR record and GeoIP information for used nameservers on the netexternal.cgi WebUI page. These information might be useful for debugging. Thanks to Matthias Fischer for style improvements. Signed-off-by: Peter M=C3=BCller --- html/cgi-bin/netexternal.cgi | 25 +++++++++++++++++++++++++ langs/de/cgi-bin/de.pl | 1 + langs/en/cgi-bin/en.pl | 1 + 3 files changed, 27 insertions(+) diff --git a/html/cgi-bin/netexternal.cgi b/html/cgi-bin/netexternal.cgi index 299612d4c..cd2223ac6 100644 --- a/html/cgi-bin/netexternal.cgi +++ b/html/cgi-bin/netexternal.cgi @@ -25,9 +25,13 @@ use strict; #use warnings; #use CGI::Carp 'fatalsToBrowser'; =20 +use IO::Socket; +use Geo::IP::PurePerl; + require '/var/ipfire/general-functions.pl'; require "${General::swroot}/lang.pl"; require "${General::swroot}/header.pl"; +require "${General::swroot}/geoip-functions.pl"; require "${General::swroot}/graphs.pl"; =20 my %color =3D (); @@ -99,6 +103,12 @@ if ( $querry[0] ne~ ""){ $Lang::tr{'nameserver'} + $Lang::tr{'flag'} + + + $Lang::tr{'rdns'} + + $Lang::tr{'status'} @@ -138,10 +148,25 @@ END } =20 my $table_colour =3D ($id++ % 2) ? $color{'color22'} : $color{'color20'}; + =09 + my $iaddr =3D inet_aton($nameserver); + my $rdns =3D gethostbyaddr($iaddr, AF_INET); + if (!$rdns) { $rdns =3D $Lang::tr{'lookup failed'}; } + + my $gi =3D Geo::IP::PurePerl->new(); + my $ccode =3D $gi->country_code_by_name($nameserver); + my $fcode =3D lc($ccode); + my $flag_icon =3D &GeoIP::get_flag_icon($fcode); =20 print < $nameserver + + 3D"$ccode" + + + $rdns + $message diff --git a/langs/de/cgi-bin/de.pl b/langs/de/cgi-bin/de.pl index af96a6445..4cf866a3a 100644 --- a/langs/de/cgi-bin/de.pl +++ b/langs/de/cgi-bin/de.pl @@ -1951,6 +1951,7 @@ 'quick playlist' =3D> 'Quick Playlist', 'ram' =3D> 'RAM-Speicher', 'random number generator daemon' =3D> 'Random Number Generator Daemon', +'rdns' =3D> 'rDNS', 'read bytes' =3D> 'Gelesene Bytes', 'read list' =3D> 'Liste der Leseberechtigten', 'real address' =3D> 'Reale Addresse', diff --git a/langs/en/cgi-bin/en.pl b/langs/en/cgi-bin/en.pl index 7e4f95ccf..946aba873 100644 --- a/langs/en/cgi-bin/en.pl +++ b/langs/en/cgi-bin/en.pl @@ -1989,6 +1989,7 @@ 'quick playlist' =3D> 'Quick Playlist', 'ram' =3D> 'RAM', 'random number generator daemon' =3D> 'Random Number Generator Daemon', +'rdns' =3D> 'rDNS', 'read bytes' =3D> 'Read Bytes', 'read list' =3D> 'list with readonly hosts', 'real address' =3D> 'Real Address', --=20 2.13.6 --===============3215858211456241125==--