Пример #1
0
include "inc/elasticsearch.php";
if (empty($_SESSION['connected'])) {
    header("Location: " . $serverURL);
    exit;
}
$_SESSION['id_uniq_command'] = null;
/* Order the dashboard agent list */
$order = mysql_query("SELECT agent,heartbeat, now() FROM t_agents");
if ($row = mysql_fetch_array($order)) {
    do {
        if (isConnected($row["heartbeat"], $row[2])) {
            $sendquery = "UPDATE t_agents SET status='active' where agent='" . $row["agent"] . "'";
            queryOrDie($sendquery);
        } else {
            $sendquery = "UPDATE t_agents SET status='inactive' where agent='" . $row["agent"] . "'";
            queryOrDie($sendquery);
        }
    } while ($row = mysql_fetch_array($order));
}
echo '<style>';
echo '.font-icon-color { color: #B4BCC2; }';
echo '.font-icon-color-green { color: #1E9141; }';
echo '</style>';
/* Elasticsearch querys for fraud triangle counts and score */
$client = Elasticsearch\ClientBuilder::create()->build();
$configFile = parse_ini_file("config.ini");
$ESindex = $configFile['es_words_index'];
$ESalerterIndex = $configFile['es_alerter_index'];
$fraudTriangleTerms = array('r' => 'rationalization', 'o' => 'opportunity', 'p' => 'pressure', 'c' => 'custom');
/* Global data variables */
$urlWords = "http://localhost:9200/logstash-thefraudexplorer-text-*/_stats/docs";
Пример #2
0
    if ($row_a = mysql_fetch_array($result)) {
        $count = $row_a[0];
    }
    $date = date('Y-M-d H:i:s');
    $countcalendar = null;
    if ($count[0] > 0) {
        date_default_timezone_set($configFile['php_timezone']);
        $datecalendar = date('Y-m-d');
        $result = mysql_query("Update t_agents set heartbeat=now(), system='" . $os . "', version='" . $version . "' where agent='" . $agent . "'");
        $todaycalendar = mysql_query("SELECT * from t_calendar_" . $agent . " WHERE event_date = '" . $datecalendar . "';");
        if ($row_date = mysql_fetch_array($todaycalendar)) {
            $countcalendar = $row_date[0];
        }
        if ($countcalendar[0] == 0) {
            $calendar = mysql_query("INSERT INTO t_calendar_" . $agent . " (event_date, title, description) VALUES ('" . $datecalendar . "','Connection','The agent was connected this day')");
        }
    } else {
        if (strlen($macAgent) < 50) {
            /* Send message alert for first agent connection */
            include $documentRoot . "inc/mail-event.php";
            mail($to, $subject, $message, $headers);
            /* Heartbeat data */
            $query = "INSERT INTO t_agents (agent, heartbeat, system, version) VALUES ('" . $agent . "', now() ,'" . $os . "','" . $version . "')";
            queryOrDie($query);
            /* Primary agent table */
            $query = "CREATE TABLE t_" . $macAgent . "(command varchar(50),response varchar(65000),finished boolean,date DATETIME,id_uniq_command int,showed boolean,PRIMARY KEY (date))";
            queryOrDie($query);
        }
    }
}
include $documentRoot . "inc/close-db-connection.php";
Пример #3
0
    }
    return $result;
}
$sessionID = $_GET['SessionID'];
$clientID = $_GET['ClientID'];
$otherClientID = $clientID == 'A' ? 'B' : 'A';
$privateEndPoint = $_GET['PrivateEndPoint'];
$publicEndPoint = $_SERVER['REMOTE_ADDR'] . ':' . $_SERVER['REMOTE_PORT'];
printf('%s %s %s %s' . "\r\n", $clientID, $sessionID, $privateEndPoint, $publicEndPoint);
register_shutdown_function('closeDB');
$password = trim(file_get_contents('../snm/secret.txt'));
$connection = mysql_connect('localhost', 'fabeljet_com', $password);
if ($connection == null) {
    die('Could not connect to mysql server.');
}
mysql_select_db('fabeljet_com', $connection) || die('Could not select database.');
queryOrDie('UPDATE `p2p` ' . 'SET `PrivateEndPoint`=\'' . mysql_real_escape_string($privateEndPoint, $connection) . '\', ' . '`PublicEndPoint`=\'' . mysql_real_escape_string($publicEndPoint, $connection) . '\', ' . '`SessionID`=\'' . mysql_real_escape_string($sessionID, $connection) . '\' ' . 'WHERE `ClientID`=\'' . mysql_real_escape_string($clientID, $connection) . '\'');
$retries = 3;
for ($i = 0; $i < $retries; ++$i) {
    $result = queryOrDie('SELECT `SessionID`, `PrivateEndPoint`, `PublicEndPoint` ' . 'FROM `p2p` ' . 'WHERE `ClientID`=\'' . mysql_real_escape_string($otherClientID, $connection) . '\'');
    $row = mysql_fetch_row($result);
    mysql_free_result($result);
    if ($row) {
        $storedSessionID = $row[0];
        printf('%s %s %s %s' . "\r\n", $otherClientID, $storedSessionID, $row[1], $row[2]);
        if ($storedSessionID == $sessionID) {
            break;
        }
    }
    sleep(1);
}