gettext("Actions"),
'interface' => gettext("Interfaces"),
'proto' => gettext("Protocols"),
'srcip' => gettext("Source IPs"),
'dstip' => gettext("Destination IPs"),
'srcport' => gettext("Source Ports"),
'dstport' => gettext("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 $g, $gotlines, $fields;
uasort($summary[$stat] , 'cmp');
print "
";
print "{$fields[$stat]} ".gettext("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]]} |
";
}
}
$leftover = $gotlines - $total;
if ($leftover > 0) {
print "Other | {$leftover} |
";
}
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\n";
print "";
print "{$fields[$stat]} |
";
print " |
";
print "
\n";
}
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"); ?>
|
|
=gettext("NOTE: IE8 users must enable compatibility view.")?>
";
stat_block($summary, $field , $entriesperblock);
echo "
";
}
?>
|
|