Added simple table on network explorer

Former-commit-id: 9f2cdc58d7fc1f0375e6945c087aafbd521bacc9
This commit is contained in:
fermin831 2019-03-04 17:03:10 +01:00
parent 32f14e8fe4
commit c95b057c14
2 changed files with 49 additions and 2 deletions

View File

@ -20,6 +20,18 @@
global $config; global $config;
check_login();
// ACL Check.
if (! check_acl($config['id_user'], 0, 'AR')) {
db_pandora_audit(
'ACL Violation',
'Trying to access Network explorer'
);
include 'general/noaccess.php';
exit;
}
$action = get_parameter('action', 'listeners'); $action = get_parameter('action', 'listeners');
$is_network = true; $is_network = true;

View File

@ -24,7 +24,7 @@ check_login();
if (! check_acl($config['id_user'], 0, 'AR')) { if (! check_acl($config['id_user'], 0, 'AR')) {
db_pandora_audit( db_pandora_audit(
'ACL Violation', 'ACL Violation',
'Trying to access Network report (Grouped)' 'Trying to access Network report.'
); );
include 'general/noaccess.php'; include 'general/noaccess.php';
exit; exit;
@ -46,7 +46,7 @@ if (!$is_period) {
$period = ($utimestamp_greater - $utimestamp_lower); $period = ($utimestamp_greater - $utimestamp_lower);
} }
$top = get_parameter('top', 10); $top = (int) get_parameter('top', 10);
$style_end = ($is_period) ? 'display: none;' : ''; $style_end = ($is_period) ? 'display: none;' : '';
$style_period = ($is_period) ? '' : 'display: none;'; $style_period = ($is_period) ? '' : 'display: none;';
@ -127,6 +127,41 @@ echo '<form method="post">';
html_print_table($table); html_print_table($table);
echo '</form>'; echo '</form>';
// Print the data.
$data = [];
if ($is_network) {
$data = network_matrix_get_top(
$top,
$action === 'talkers',
$utimestamp_lower,
$utimestamp_greater
);
}
unset($table);
$table = new stdClass();
// Print the header.
$table->head = [];
$table->head[] = __('IP');
if (!$is_network) {
$table->head[] = __('Flows');
}
$table->head[] = __('Packets');
$table->head[] = __('Bytes');
// Print the data.
$table->data = [];
foreach ($data as $item) {
$table->data[] = [
$item['host'],
$item['sum_bytes'],
$item['sum_pkts'],
];
}
html_print_table($table);
?> ?>
<script> <script>
// Configure jQuery timepickers. // Configure jQuery timepickers.