Import::sUtils("ClassUtil.php"); Import::sUtils("GenFun.php"); Import::sUtils("MarkUp.php"); Import::sUtils("ThrowError.php"); //----------------------------------------------------------------------------- if (GlobalMas::$loginCHK) { Import::services("Account_v0.php"); } //----------------------------------------------------------------------------- //init var //----------------------------------------------------------------------------- $chk = array("bool" => true); //----------------------------------------------------------------------------- //$_REQUEST = (isset($_GET["service"])) ? $_GET : $_POST; //----------------------------------------------------------------------------- indexExist($_REQUEST, array('service', 'functionName')); /////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////// //imports /////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////// preg_match("/{(.*?)}/", $_REQUEST['service'], $match); $classPath = sizeof($match) == 0 ? Import::services() . $_REQUEST['service'] : MarkUp::go($_REQUEST['service']); //---------------------------------------------------------- //if (!file_exists($classPath)) die($classPath." does not exist!!!!"); //---------------------------------------------------------- if (!isset($_REQUEST['service'])) { fail_CHK("service is not set!!"); } else { if (!FileFolder::file_exists($classPath)) { fail_CHK("service (" . $classPath . ") does not exist!!");
//----------------------------------------------------------------------------- $chk = array("bool" => true); //----------------------------------------------------------------------------- require_once Import::$uber_src_path . "server/werm/utils/SetPublicProp.php"; //----------------------------------------------------------------------------- if (Constants::$loginCHK) { require Import::$uber_src_path . "server/werm/services/Account_v0.php"; } //----------------------------------------------------------------------------- if (Constants::$loginCHK && isset($_COOKIE["user"])) { Constants::$loggedIN = Account_v0::getUserSession($_COOKIE["user"]); } //----------------------------------------------------------------------------- $_OBJ = isset($_GET["service"]) ? $_GET : $_POST; //----------------------------------------------------------------------------- indexExist($_OBJ, array('service', 'functionName')); /////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////// //imports /////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////// constExist("Constants", array("HOST", "PASS", "USER")); //---------------------------------------------------------- require_once Import::$uber_src_path . "server/werm/utils/GenFun.php"; //---------------------------------------------------------- $classPath = GenFun::constCHK($_OBJ['service']); //---------------------------------------------------------- $class = explode(".", $classPath); //---------------------------------------------------------- if ($class[1] != "php") { die("service does not end with '.php'");
/* Global variables */ $sockLT = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP); $client = Elasticsearch\ClientBuilder::create()->build(); $GLOBALS['matchesGlobalCount'] = 0; $startTime = microtime(true); $ESindex = $configFile['es_words_index']; $fistTimeIndex = true; $AgentParams = ['index' => $ESindex, 'type' => 'TextEvent', 'body' => ['size' => 0, 'aggs' => ['agents' => ['terms' => ['field' => 'agentId.raw']]]]]; $allAgentList = $client->search($AgentParams); $fraudTriangleTerms = array('rationalization' => '0 1 0', 'opportunity' => '0 0 1', 'pressure' => '1 0 0'); $jsonFT = json_decode(file_get_contents($configFile['fta_text_rule_spanish']), true); /* Unique agentID List */ $GLOBALS['arrayPosition'] = 0; getArrayData($allAgentList, "key", "agentList"); /* Start the loop for each agent */ if (indexExist($configFile['es_alerter_status_index'], $configFile)) { $firstTimeIndex = false; logToFile($configFile['log_file'], "[INFO] - The alerter index already exist, continue with data range matching ..."); $endDate = extractEndDateFromAlerter($configFile['es_alerter_status_index'], "AlertStatus"); $GLOBALS['arrayPosition'] = 0; getArrayData($endDate, "endTime", 'lastAlertDate'); logToFile($configFile['log_file'], "[INFO] - Checking events from last date: " . $GLOBALS['lastAlertDate'][0] . " ..."); foreach ($GLOBALS['agentList'] as $agentID) { $typedWords = extractTypedWordsFromAgentIDWithDate($agentID, $ESindex, $GLOBALS['lastAlertDate'][0], $GLOBALS['currentTime']); if ($typedWords['hits']['total'] == 0) { continue; } else { getMultiArrayData($typedWords, "typedWord", "applicationTitle", "sourceTimestamp", $agentID . "_typedWords"); $arrayOfWordsAndWindows = $GLOBALS[$agentID . "_typedWords"]; $lastWindowTitle = null; $lastTimeStamp = null;