mirror of
https://github.com/vincentmli/bpfire.git
synced 2026-04-09 18:45:54 +02:00
logs.cgi/*: Use new location lookup method.
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
This commit is contained in:
@@ -24,6 +24,9 @@ require "${General::swroot}/geoip-functions.pl";
|
||||
require "${General::swroot}/lang.pl";
|
||||
require "${General::swroot}/header.pl";
|
||||
|
||||
# Libloc database handle.
|
||||
my $libloc_db_handle = &GeoIP::init();
|
||||
|
||||
my %color = ();
|
||||
my %mainsettings = ();
|
||||
&General::readhash("${General::swroot}/main/settings", \%mainsettings);
|
||||
@@ -351,7 +354,7 @@ foreach $_ (@log)
|
||||
$srcport=$1 if $packet =~ /SPT=(\d+)/;
|
||||
$dstport=$1 if $packet =~ /DPT=(\d+)/;
|
||||
|
||||
my $ccode = &GeoIP::lookup($srcaddr);
|
||||
my $ccode = &GeoIP::lookup_country_code($libloc_db_handle, $srcaddr);
|
||||
|
||||
my $servi = uc(getservbyport($srcport, lc($proto)));
|
||||
if ($servi ne '' && $srcport < 1024) {
|
||||
|
||||
@@ -22,6 +22,9 @@ require "${General::swroot}/geoip-functions.pl";
|
||||
require "${General::swroot}/lang.pl";
|
||||
require "${General::swroot}/header.pl";
|
||||
|
||||
# Libloc database handle.
|
||||
my $libloc_db_handle = &GeoIP::init();
|
||||
|
||||
use POSIX();
|
||||
|
||||
my %cgiparams=();
|
||||
@@ -308,7 +311,7 @@ foreach $_ (@log)
|
||||
# Traffic from red
|
||||
if($srcaddr ne '') {
|
||||
# srcaddr is set
|
||||
my $ccode = &GeoIP::lookup($srcaddr);
|
||||
my $ccode = &GeoIP::lookup_country_code($libloc_db_handle, $srcaddr);
|
||||
if ($ccode eq '') {
|
||||
$ccode = 'unknown';
|
||||
}
|
||||
|
||||
@@ -22,6 +22,9 @@ require "${General::swroot}/geoip-functions.pl";
|
||||
require "${General::swroot}/lang.pl";
|
||||
require "${General::swroot}/header.pl";
|
||||
|
||||
# Libloc database handle.
|
||||
my $libloc_db_handle = &GeoIP::init();
|
||||
|
||||
use POSIX();
|
||||
|
||||
my %cgiparams=();
|
||||
@@ -435,7 +438,7 @@ for($s=0;$s<$lines;$s++)
|
||||
$col="bgcolor='$color{\"color$colorIndex\"}'";
|
||||
print "<tr>";
|
||||
|
||||
my $ccode = &GeoIP::lookup($key[$s]);
|
||||
my $ccode = &GeoIP::lookup_country_code($libloc_db_handle, $key[$s]);
|
||||
|
||||
$color++;
|
||||
print "<td align='center' $col><form method='post' action='showrequestfromip.dat'><input type='hidden' name='MONTH' value='$cgiparams{'MONTH'}'> <input type='hidden' name='DAY' value='$cgiparams{'DAY'}'> <input type='hidden' name='ip' value='$key[$s]'> <input type='submit' value='$Lang::tr{'details'}'></form></td>";
|
||||
|
||||
@@ -19,6 +19,9 @@ require "${General::swroot}/geoip-functions.pl";
|
||||
require "${General::swroot}/lang.pl";
|
||||
require "${General::swroot}/header.pl";
|
||||
|
||||
# Libloc database handle.
|
||||
my $libloc_db_handle = &GeoIP::init();
|
||||
|
||||
use POSIX();
|
||||
|
||||
#workaround to suppress a warning when a variable is used only once
|
||||
@@ -178,7 +181,7 @@ if (!$skip)
|
||||
}
|
||||
elsif($srcaddr ne '') {
|
||||
# or srcaddr matches country code
|
||||
my $ccode = &GeoIP::lookup($srcaddr);
|
||||
my $ccode = &GeoIP::lookup_country_code($libloc_db_handle, $srcaddr);
|
||||
if($ccode eq uc($country)){
|
||||
$log[$lines] = $_;
|
||||
$lines++;
|
||||
|
||||
Reference in New Issue
Block a user