add GeoIP and rDNS information to used nameservers

Add GeoIP and rDNS information to DNS nameserver list at netexternal.cgi

Use newly implemented GeoIP function in /var/ipfire/geoip-functions.pl

Signed-off-by: Peter Müller <peter.mueller@link38.eu>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
This commit is contained in:
Peter Müller
2017-11-15 22:49:00 +01:00
committed by Michael Tremer
parent 2aec53386a
commit 297110d460
11 changed files with 39 additions and 1 deletions

View File

@@ -25,9 +25,12 @@ use strict;
#use warnings;
#use CGI::Carp 'fatalsToBrowser';
use IO::Socket;
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";
my %color = ();
@@ -98,6 +101,12 @@ if ( $querry[0] ne~ ""){
<th align="center">
<strong>$Lang::tr{'nameserver'}</strong>
</th>
<th align="center">
<strong>$Lang::tr{'country'}</strong>
</th>
<th align="center">
<strong>$Lang::tr{'rdns'}</strong>
</th>
<th align="center">
<strong>$Lang::tr{'status'}</strong>
</th>
@@ -139,9 +148,25 @@ END
my $table_colour = ($id++ % 2) ? $color{'color22'} : $color{'color20'};
# collect more information about name server (rDNS, GeoIP country code)
my $ccode = &GeoIP::lookup($nameserver);
my $flag_icon = &GeoIP::get_flag_icon($ccode);
my $iaddr = inet_aton($nameserver);
my $rdns = gethostbyaddr($iaddr, AF_INET);
if (!$rdns) { $rdns = $Lang::tr{'lookup failed'}; }
print <<END;
<tr bgcolor="$table_colour">
<td>$nameserver</td>
<td>
$nameserver
</td>
<td align="center">
<a href='country.cgi#$ccode'><img src="$flag_icon" border="0" alt="$ccode" title="$ccode" /></a>
</td>
<td align="center">
$rdns
</td>
<td bgcolor="$bgcolour" align="center">
<font color="$colour"><strong>$message</strong></font>
</td>