function getMultiArrayData($array, $field1, $field2, $globalVar) { foreach ($array as $key => $value) { if (is_array($value)) { getMultiArrayData($value, $field1, $field2, $globalVar); } else { if ($key == $field1 && $key != "sort") { $GLOBALS[$globalVar][$GLOBALS['arrayPosition']][0] = $value; $GLOBALS[$globalVar][$GLOBALS['arrayPosition']][1] = $array[$field2]; $GLOBALS['arrayPosition']++; } } } }
} } $counter++; $lastWindowTitle = $windowTitle; $lastTimeStamp = $timeStamp; } } } } else { logToFile($configFile['log_file'], "[INFO] - Alerter index not found, continue with all data matching ..."); foreach ($GLOBALS['agentList'] as $agentID) { $typedWords = extractTypedWordsFromAgentID($agentID, $ESindex); if ($typedWords['hits']['total'] == 0) { continue; } else { getMultiArrayData($typedWords, "typedWord", "applicationTitle", "sourceTimestamp", $agentID . "_typedWords"); $arrayOfWordsAndWindows = $GLOBALS[$agentID . "_typedWords"]; $lastWindowTitle = null; $lastTimeStamp = null; $stringOfWords = null; $counter = 0; foreach ($arrayOfWordsAndWindows as $key => $value) { $windowTitle = $value[1]; $timeStamp = $value[2]; if ($windowTitle == $lastWindowTitle) { $stringOfWords = $stringOfWords . " " . $value[0]; } else { if ($counter == 0) { $stringOfWords = $value[0]; } else { parseFraudTrianglePhrases($agentID, $sockLT, $fraudTriangleTerms, $stringOfWords, $lastWindowTitle, $lastTimeStamp, "matchesGlobalCount", $configFile, $jsonFT);