mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-31 01:35:36 +02:00
Added filter by ip requesting network matrix datas
Former-commit-id: 20a88fe66f9bcb2c39a9121b46e7204ed006470d
This commit is contained in:
parent
c95b057c14
commit
d62b7f0d79
@ -24,26 +24,35 @@
|
|||||||
/**
|
/**
|
||||||
* Get the tnetwok_matrix summatory data.
|
* Get the tnetwok_matrix summatory data.
|
||||||
*
|
*
|
||||||
* @param integer $top Number of hosts to show.
|
* @param integer $top Number of hosts to show.
|
||||||
* @param boolean $talker Talker (true) or listetener (false).
|
* @param boolean $talker Talker (true) or listetener (false).
|
||||||
* @param integer $start Utimestamp of start time.
|
* @param integer $start Utimestamp of start time.
|
||||||
* @param integer $end Utimestamp of end time.
|
* @param integer $end Utimestamp of end time.
|
||||||
|
* @param string $ip_filter Ip to filter.
|
||||||
*
|
*
|
||||||
* @return array With requested data.
|
* @return array With requested data.
|
||||||
*/
|
*/
|
||||||
function network_matrix_get_top($top, $talker, $start, $end)
|
function network_matrix_get_top($top, $talker, $start, $end, $ip_filter='')
|
||||||
{
|
{
|
||||||
$field_to_group = ($talker === true) ? 'source' : 'destination';
|
$field_to_group = ($talker === true) ? 'source' : 'destination';
|
||||||
|
$filter_sql = '';
|
||||||
|
if (!empty($ip_filter)) {
|
||||||
|
$filter_field = ($talker === true) ? 'destination' : 'source';
|
||||||
|
$filter_sql = sprintf('AND %s="%s"', $filter_field, $ip_filter);
|
||||||
|
}
|
||||||
|
|
||||||
$sql = sprintf(
|
$sql = sprintf(
|
||||||
'SELECT SUM(bytes) sum_bytes, SUM(pkts) sum_pkts, %s host
|
'SELECT SUM(bytes) sum_bytes, SUM(pkts) sum_pkts, %s host
|
||||||
FROM tnetwork_matrix
|
FROM tnetwork_matrix
|
||||||
WHERE utimestamp > %d AND utimestamp < %d
|
WHERE utimestamp > %d AND utimestamp < %d
|
||||||
|
%s
|
||||||
GROUP BY %s
|
GROUP BY %s
|
||||||
ORDER BY sum_bytes DESC
|
ORDER BY sum_bytes DESC
|
||||||
LIMIT %d',
|
LIMIT %d',
|
||||||
$field_to_group,
|
$field_to_group,
|
||||||
$start,
|
$start,
|
||||||
$end,
|
$end,
|
||||||
|
$filter_sql,
|
||||||
$field_to_group,
|
$field_to_group,
|
||||||
$top
|
$top
|
||||||
);
|
);
|
||||||
|
@ -134,12 +134,14 @@ if ($is_network) {
|
|||||||
$top,
|
$top,
|
||||||
$action === 'talkers',
|
$action === 'talkers',
|
||||||
$utimestamp_lower,
|
$utimestamp_lower,
|
||||||
$utimestamp_greater
|
$utimestamp_greater,
|
||||||
|
''
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
unset($table);
|
unset($table);
|
||||||
$table = new stdClass();
|
$table = new stdClass();
|
||||||
|
$table->styleTable = 'width: 100%';
|
||||||
// Print the header.
|
// Print the header.
|
||||||
$table->head = [];
|
$table->head = [];
|
||||||
$table->head[] = __('IP');
|
$table->head[] = __('IP');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user