"Actions",
'interface' => "Interfaces",
'proto' => "Protocols",
'srcip' => "Source IPs",
'dstip' => "Destination IPs",
'srcport' => "Source Ports",
'dstport' => "Destination Ports");
$summary = array();
foreach (array_keys($fields) as $f) {
$summary[$f] = array();
}
$totals = array();
function cmp($a, $b) {
if ($a == $b) {
return 0;
}
return ($a < $b) ? 1 : -1;
}
function stat_block($summary, $stat, $num) {
global $gotlines, $fields;
uasort($summary[$stat] , 'cmp');
print '
';
print "{$fields[$stat]} data |
";
$k = array_keys($summary[$stat]);
$total = 0;
$numentries = 0;
for ($i=0; $i < $num; $i++) {
if ($k[$i]) {
$total += $summary[$stat][$k[$i]];
$numentries++;
$outstr = $k[$i];
if (is_ipaddr($outstr)) {
$outstr = " {$outstr}";
} elseif (substr_count($outstr, '/') == 1) {
list($proto, $port) = explode('/', $outstr);
$service = getservbyport($port, strtolower($proto));
if ($service)
$outstr .= ": {$service}";
}
print "{$outstr} | {$summary[$stat][$k[$i]]} |
\n";
}
}
$leftover = $gotlines - $total;
if ($leftover > 0) {
print "Other | {$leftover} |
\n";
}
print '
';
}
function pie_block($summary, $stat, $num) {
global $gotlines, $fields;
uasort($summary[$stat] , 'cmp');
$k = array_keys($summary[$stat]);
$total = 0;
$numentries = 0;
print "\n";
print "";
print "{$fields[$stat]} |
";
print "\n";
print " |
";
}
foreach ($filterlog as $fe) {
$specialfields = array('srcport', 'dstport');
foreach (array_keys($fields) as $field) {
if (!in_array($field, $specialfields))
$summary[$field][$fe[$field]]++;
}
/* Handle some special cases */
if ($fe['srcport'])
$summary['srcport'][$fe['proto'].'/'.$fe['srcport']]++;
else
$summary['srcport'][$fe['srcport']]++;
if ($fe['dstport'])
$summary['dstport'][$fe['proto'].'/'.$fe['dstport']]++;
else
$summary['dstport'][$fe['dstport']]++;
}
include("head.inc"); ?>
include("fbegin.inc"); ?>
|
Normal View | Dynamic View | Summary View
|
This is a firewall log summary, of the last lines of the firewall log (Max ).
NOTE: IE8 users must enable compatibility view.
";
stat_block($summary, $field , $entriesperblock);
echo "
";
}
?>
|
|