X-Git-Url: http://git.ipfire.org/?a=blobdiff_plain;f=html%2Fcgi-bin%2Flogs.cgi%2Ffirewalllog.dat;h=361bf0432740e7b74b1395f1470fdca0e6efbcbd;hb=07e42be9783ddfe2c6e49d98676fcdb7f2dfecd7;hp=3857f7d8e8ed6f231805eef80b9925655e64dc01;hpb=986e08d996eadd906ecbe6c9ac8ad48aa78bd854;p=ipfire-2.x.git
diff --git a/html/cgi-bin/logs.cgi/firewalllog.dat b/html/cgi-bin/logs.cgi/firewalllog.dat
index 3857f7d8e8..361bf04327 100644
--- a/html/cgi-bin/logs.cgi/firewalllog.dat
+++ b/html/cgi-bin/logs.cgi/firewalllog.dat
@@ -9,11 +9,10 @@
# $Id: firewalllog.dat,v 1.4.2.18 2005/08/23 12:01:50 eoberlander Exp $
#
# July 28, 2003 - Darren Critchley - darren@kdi.ca
-# - added source mac adapter to layout
+# - added source mac adapter to layout
#
use strict;
-use Geo::IP::PurePerl;
use Getopt::Std;
# enable only the following on debugging purpose
@@ -21,9 +20,15 @@ use Getopt::Std;
#use CGI::Carp 'fatalsToBrowser';
require '/var/ipfire/general-functions.pl';
+require "${General::swroot}/location-functions.pl";
require "${General::swroot}/lang.pl";
require "${General::swroot}/header.pl";
+my %color = ();
+my %mainsettings = ();
+&General::readhash("${General::swroot}/main/settings", \%mainsettings);
+&General::readhash("/srv/web/ipfire/html/themes/".$mainsettings{'THEME'}."/include/colors.txt", \%color);
+
use POSIX();
#workaround to suppress a warning when a variable is used only once
@@ -74,41 +79,41 @@ if (!($cgiparams{'MONTH'} =~ /^(0|1|2|3|4|5|6|7|8|9|10|11)$/) ||
}
elsif($cgiparams{'ACTION'} eq '>>')
{
- my @temp_then=();
- my @temp_now = localtime(time);
- $temp_now[4] = $cgiparams{'MONTH'};
- $temp_now[3] = $cgiparams{'DAY'};
+ my @temp_then=();
+ my @temp_now = localtime(time);
+ $temp_now[4] = $cgiparams{'MONTH'};
+ $temp_now[3] = $cgiparams{'DAY'};
if ($cgiparams{'DAY'}) {
- @temp_then = localtime(POSIX::mktime(@temp_now) + 86400);
- ## Retrieve the same time on the next day +
- ## 86400 seconds in a day
+ @temp_then = localtime(POSIX::mktime(@temp_now) + 86400);
+ ## Retrieve the same time on the next day +
+ ## 86400 seconds in a day
} else {
- $temp_now[3] = 1;
- $temp_now[4] = ($temp_now[4]+1) %12;
- @temp_then = localtime(POSIX::mktime(@temp_now) );
- $temp_then[3] = 0;
+ $temp_now[3] = 1;
+ $temp_now[4] = ($temp_now[4]+1) %12;
+ @temp_then = localtime(POSIX::mktime(@temp_now) );
+ $temp_then[3] = 0;
}
- $cgiparams{'MONTH'} = $temp_then[4];
- $cgiparams{'DAY'} = $temp_then[3];
+ $cgiparams{'MONTH'} = $temp_then[4];
+ $cgiparams{'DAY'} = $temp_then[3];
}
elsif($cgiparams{'ACTION'} eq '<<')
{
- my @temp_then=();
- my @temp_now = localtime(time);
- $temp_now[4] = $cgiparams{'MONTH'};
- $temp_now[3] = $cgiparams{'DAY'};
+ my @temp_then=();
+ my @temp_now = localtime(time);
+ $temp_now[4] = $cgiparams{'MONTH'};
+ $temp_now[3] = $cgiparams{'DAY'};
if ($cgiparams{'DAY'}) {
- @temp_then = localtime(POSIX::mktime(@temp_now) - 86400);
- ## Retrieve the same time on the next day -
- ## 86400 seconds in a day
+ @temp_then = localtime(POSIX::mktime(@temp_now) - 86400);
+ ## Retrieve the same time on the next day -
+ ## 86400 seconds in a day
} else {
- $temp_now[3] = 1;
- $temp_now[4] = ($temp_now[4]-1) %12;
- @temp_then = localtime(POSIX::mktime(@temp_now) );
- $temp_then[3] = 0;
+ $temp_now[3] = 1;
+ $temp_now[4] = ($temp_now[4]-1) %12;
+ @temp_then = localtime(POSIX::mktime(@temp_now) );
+ $temp_then[3] = 0;
}
- $cgiparams{'MONTH'} = $temp_then[4];
- $cgiparams{'DAY'} = $temp_then[3];
+ $cgiparams{'MONTH'} = $temp_then[4];
+ $cgiparams{'DAY'} = $temp_then[3];
}
# Find in which file.gz is the log. Can be calculated because WEEKLY ROTATING of access.log
@@ -116,82 +121,82 @@ my $gzindex;
my $date = $cgiparams{'DAY'} == 0 ? '' : $cgiparams{'DAY'} <= 9 ? "0$cgiparams{'DAY'}" : "$cgiparams{'DAY'}";
{
- my $xday;
-
- # Calculate time. If future date, calculate for past year !!!
- if (( $cgiparams{'MONTH'} eq $now[4]) && ($cgiparams{'DAY'} > $now[3]) ||
- ( $cgiparams{'MONTH'} > $now[4] ) ) {
- $xday = POSIX::mktime( 0, 0, 0, $cgiparams{'DAY'}, $cgiparams{'MONTH'}, $year - 1901 );
- $date = "$longmonths[$cgiparams{'MONTH'}] $date, ". int($year-1);
- } else {
- $xday = POSIX::mktime( 0, 0, 0, $cgiparams{'DAY'}, $cgiparams{'MONTH'}, $year - 1900 );
- $date = "$longmonths[$cgiparams{'MONTH'}] $date, $year";
- }
-
- # calculate end of active week (saturday 23H59)
- my @then = ();
- @then = localtime(time());
- my $sunday = POSIX::mktime( 0, 0, 0, @then[3], @then[4], @then[5]);
- $sunday += (6-$then[6]) * 86400;
-
- # Convert delta in second to full weeks
+ my $xday;
+
+ # Calculate time. If future date, calculate for past year !!!
+ if (( $cgiparams{'MONTH'} eq $now[4]) && ($cgiparams{'DAY'} > $now[3]) ||
+ ( $cgiparams{'MONTH'} > $now[4] ) ) {
+ $xday = POSIX::mktime( 0, 0, 0, $cgiparams{'DAY'}, $cgiparams{'MONTH'}, $year - 1901 );
+ $date = "$longmonths[$cgiparams{'MONTH'}] $date, ". int($year-1);
+ } else {
+ $xday = POSIX::mktime( 0, 0, 0, $cgiparams{'DAY'}, $cgiparams{'MONTH'}, $year - 1900 );
+ $date = "$longmonths[$cgiparams{'MONTH'}] $date, $year";
+ }
+
+ # calculate end of active week (saturday 23H59)
+ my @then = ();
+ @then = localtime(time());
+ my $sunday = POSIX::mktime( 0, 0, 0, @then[3], @then[4], @then[5]);
+ $sunday += (6-$then[6]) * 86400;
+
+ # Convert delta in second to full weeks
$gzindex = int (($sunday-$xday)/604800 );
}
-
+
my $monthstr = $shortmonths[$cgiparams{'MONTH'}];
my $daystr = $cgiparams{'DAY'} == 0 ? '..' : $cgiparams{'DAY'} <= 9 ? " $cgiparams{'DAY'}" : "$cgiparams{'DAY'}";
-
+
my $lines = 0;
my @log=();
my $loop = 1;
my $filestr = 0;
-my $lastdatetime; # for debug
+my $lastdatetime; # for debug
my $search_for_end = 0;
-
+
while ($gzindex >=0 && $loop) {
- # calculate file name
- if ($gzindex == 0) {
- $filestr = "/var/log/messages";
- } else {
- $filestr = "/var/log/messages.$gzindex";
- $filestr = "$filestr.gz" if -f "$filestr.gz";
- }
+ # calculate file name
+ if ($gzindex == 0) {
+ $filestr = "/var/log/messages";
+ } else {
+ $filestr = "/var/log/messages.$gzindex";
+ $filestr = "$filestr.gz" if -f "$filestr.gz";
+ }
# now read file if existing
if (open (FILE,($filestr =~ /.gz$/ ? "gzip -dc $filestr |" : $filestr))) {
- #&General::log("reading $filestr");
- READ:while (
$Lang::tr{'time'} | -$Lang::tr{'chain'} | -$Lang::tr{'iface'} | -$Lang::tr{'proto'} | -$Lang::tr{'source'} | -Flag | -$Lang::tr{'src port'} | -$Lang::tr{'mac address'} | -$Lang::tr{'destination'} | -$Lang::tr{'dst port'} | +$Lang::tr{'time'} | +$Lang::tr{'chain'} | +$Lang::tr{'iface'} | +$Lang::tr{'proto'} | +$Lang::tr{'source'} $Lang::tr{'destination'} |
+ $Lang::tr{'src port'} $Lang::tr{'dst port'} |
+ $Lang::tr{'country'} | +$Lang::tr{'mac address'} |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
$comment | -$iface | -$proto | -$srcaddr | -- | $srcport | -$macaddr | -
-
|
- $dstport | -$time | +$chain | +$iface | +$proto | +$srcaddr $dstaddr |
+ $srcport $dstport |
+END
+ ;
+ # Get flag icon for of the country.
+ my $flag_icon = &Location::Functions::get_flag_icon($ccode);
+
+ if ( $flag_icon) {
+ print ""; + } else { + print " | "; + } + + print < |