fix: update any IP fields using inet6_ntop() #5207

This commit is contained in:
Mickael Marchand
2016-12-30 00:50:22 +01:00
committed by Neil Lathwood
parent c257332ef8
commit 8352a3a000
2 changed files with 12 additions and 2 deletions

View File

@ -185,6 +185,13 @@ function RunFollowUp()
$alert['query'] = GenSQL($alert['rule']);
}
$chk = dbFetchRows($alert['query'], array($alert['device_id']));
//make sure we can json_encode all the datas later
$cnt = count($chk);
for ($i = 0; $i < $cnt; $i++) {
if (isset($chk[$i]['ip'])) {
$chk[$i]['ip'] = inet6_ntop($chk[$i]['ip']);
}
}
$o = sizeof($alert['details']['rule']);
$n = sizeof($chk);
$ret = 'Alert #'.$alert['id'];

View File

@ -171,8 +171,11 @@ function RunRules($device)
}
$sql = $rule['query'];
$qry = dbFetchRows($sql, array($device));
if (isset($qry[0]['ip'])) {
$qry[0]['ip'] = inet6_ntop($qry[0]['ip']);
$cnt = count($qry);
for ($i = 0; $i < $cnt; $i++) {
if (isset($qry[$i]['ip'])) {
$qry[$i]['ip'] = inet6_ntop($qry[$i]['ip']);
}
}
$s = sizeof($qry);
if ($s == 0 && $inv === false) {