Esempio n. 1
0
function GetPulses()
{
    $pulses = array();
    try {
        $otx = new Otx();
        list($total, $p_list) = $otx->get_pulse_list(array('page' => 0, 'page_rows' => -1));
        foreach ($p_list as $pulse) {
            array_walk_recursive($pulse['tags'], 'Util::htmlentities');
            $pulse['id'] = strtoupper(preg_replace("/[^a-fA-F0-9]/", '', $pulse['id']));
            $pulses[$pulse['id']] = array("name" => Util::htmlentities(trim($pulse['name']), ENT_NOQUOTES), "desc" => Util::htmlentities(trim($pulse['description'])), "tags" => $pulse['tags']);
        }
        asort($pulses);
    } catch (Exception $e) {
    }
    unset($p_list);
    return $pulses;
}
    $conn = $db->connect();
}
if ($type == 'event') {
    $unique_pulses = Siem::get_unique_pulses($conn);
} else {
    if ($type == 'alarm') {
        $unique_pulses = Alarm::get_unique_pulses($conn);
    } else {
        $unique_pulses = array();
    }
}
$pulses = array();
if (count($unique_pulses) > 0) {
    try {
        $otx = new Otx();
        list($total, $p_list) = $otx->get_pulse_list(array('page' => 0, 'page_rows' => -1));
        foreach ($p_list as $p) {
            $p_id = Util::uuid_format_nc($p['id']);
            $p_name = trim($p['name']);
            if ($unique_pulses[$p_id]) {
                if (!$search || preg_match('/' . preg_quote($search, '/') . '/i', $p_name)) {
                    $pulses[$p_id] = $p_name;
                }
            }
        }
        // Sort and Top $max pulses
        asort($pulses);
        $pulses = array_slice($pulses, 0, $max);
        foreach ($pulses as $id => $name) {
            echo "{$id}###{$name}\n";
        }
Esempio n. 3
0
Session::logcheck_ajax("dashboard-menu", "IPReputation");
session_write_close();
$maxrows = POST('iDisplayLength') != '' ? POST('iDisplayLength') : 10;
$from = POST('iDisplayStart') != '' ? POST('iDisplayStart') : 0;
$sec = POST('sEcho');
ossim_valid($maxrows, OSS_DIGIT, 'illegal: iDisplayLength');
ossim_valid($from, OSS_DIGIT, 'illegal: iDisplayStart');
ossim_valid($sec, OSS_DIGIT, 'illegal: sEcho');
if (ossim_error()) {
    Util::response_bad_request(ossim_get_error_clean());
}
$total = 0;
$list = array();
try {
    $filters = array('page' => $from, 'page_rows' => 10);
    $otx = new Otx();
    list($total, $p_list) = $otx->get_pulse_list($filters);
    if ($total > 0 && is_array($p_list)) {
        foreach ($p_list as $p) {
            $list[] = array($p);
        }
    }
} catch (Exception $e) {
    Util::response_bad_request($e->getMessage());
}
// datatables response json
$response['sEcho'] = intval($sec);
$response['iTotalRecords'] = $total;
$response['iTotalDisplayRecords'] = $total;
$response['aaData'] = $list;
echo json_encode($response);