Exemplo n.º 1
0
function get_pulse_detail()
{
    $data = POST('data');
    ossim_valid($data['pulse_id'], OSS_HEX, 'illegal: Pulse ID');
    if (ossim_error()) {
        return array();
    }
    $otx = new Otx();
    $pulse = $otx->get_pulse_detail($data['pulse_id']);
    //Converting indicator hash to array to use it in the datatables.
    $pulse['indicators'] = array_values($pulse['indicators']);
    return $pulse;
}
Exemplo n.º 2
0
function change_account_contribution()
{
    $data = POST('data');
    $contribute = intval($data['status']);
    $otx = new Otx();
    if ($contribute) {
        $otx->enable_contribution();
        $msg = _('You are now contributing to OTX.');
    } else {
        $otx->disable_contribution();
        $msg = _('You are not contributing to OTX anymore.');
    }
    return array('msg' => $msg);
}
Exemplo n.º 3
0
} else {
    $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";
Exemplo n.º 4
0
function get_otx_info()
{
    $otx = new Otx();
    $otx->load();
    return array('token' => $otx->get_token(), 'username' => $otx->get_username(), 'user_id' => $otx->get_user_id(), 'contributing' => $otx->is_contributing(), 'key_version' => $otx->get_key_version(), 'latest_update' => $otx->get_latest_update());
}
Exemplo n.º 5
0
*                       handler
* - user_session_function : function to invoke in the custom session
*                           implementation that will register the session handler
*                           functions
*/
$use_user_session = 0;
$user_session_path = '';
$user_session_function = '';
/**
 * This option is used to set if BASE will use colored results
 * based on the priority of alerts
 * 0 : no
 * 1 : yes
 */
$colored_alerts = 0;
// Red, yellow, orange, gray, white, blue
$priority_colors = array('FF0000', 'FFFF00', 'FF9900', '999999', 'FFFFFF', '006600');
$Geo_IPfree_file_ascii = "/usr/share/ossim/www/forensics/ips-ascii.txt";
$otx_pulse_url = Otx::OTX_URL . "pulse/__PULSEID__" . Otx::get_anchor();
$otx_detail_url = AV_MAIN_PATH . "/otx/views/view_my_pulses.php?type=event&id=__EVENTID__";
$otx_unknown = _('No information available. You are no longer subscribed to this pulse.');
$otx_plugin_id = 1701;
$gmaps_url = "https://maps.google.com/maps/@__LAT__,__LONG__,10z";
/*
The below line should not be changed!
*/
$BASE_path = '/usr/share/ossim/www/forensics/';
// _BASE_INC is a variable set to prevent direct access to certain include files....
define("_BASE_INC", 1);
// Include for languages
require "{$BASE_path}/languages/{$BASE_Language}.lang.php";
Exemplo n.º 6
0
function get_trend_pulses()
{
    session_write_close();
    $params = array('range' => 7);
    $graph = array();
    $otx = new Otx();
    $trend = $otx->get_events_from_all_pulses($params);
    if (is_array($trend) && count($trend) > 0) {
        $legend = build_legend(7);
        foreach ($legend as $l) {
            $graph[] = array('date' => $l, 'value' => intval($trend[$l]['value']));
        }
    }
    return $graph;
}
Exemplo n.º 7
0
                        {"mDataProp": "value",       "bSortable": true,  "sClass": "left"},
                        {"mDataProp": "activity",    "bSortable": true,  "sClass": "left"},
                        {"mDataProp": "reliability", "bSortable": true,  "sClass": "left"},
                        {"mDataProp": "priority",    "bSortable": true,  "sClass": "left"},
                        {"mDataProp": null,          "bSortable": false, "sClass": "center", "sWidth": "30px"},
                    ],
                    oLanguage : __dt_lg,
                    "fnRowCallback" : function(nRow, aData)
                    {
                        var cell = $('td:last-child', nRow).empty();
                        var url  = __rep_url.replace('XXXX', aData.value);
                        
                        $('<a/>', 
                        {
                            "href"  : url + '<?php 
echo Otx::get_anchor();
?>
',
                            "target": "_blank",
                            "html"  : '<img src="/ossim/pixmaps/show_details.png" height="16px"/>'
                        }).appendTo(cell);
                    }                  
                });
            }

            this.init();
            
        });
        

        return __pulse_object;
Exemplo n.º 8
0
function get_otx_user($data)
{
    $response = array();
    $token = $data['token'];
    /* VALIDATION */
    ossim_valid($token, OSS_ALPHA, 'illegal:' . _("OTX auth-token"));
    check_ossim_error();
    /* The try-catch check is done when the function is called in the main */
    try {
        $otx = new Otx();
        $otx->register_token($token);
        $response['error'] = FALSE;
        $response['msg'] = $otx->get_username();
    } catch (Exception $e) {
        $response['error'] = TRUE;
        $response['msg'] = $e->getMessage();
    }
    return $response;
}
Exemplo n.º 9
0
$assets_filters = array();
$assets_filters = get_asset_filters($conn, $winfo['asset']);
//Variables to store the chart information
$data = array();
//The widget's data itself.
$label = array();
//Widget's label such as legend in charts, titles in tag clouds, etc...
$links = array();
//Links of each element of the widget.
/*
*
*	The code below is copied from /panel and will have to be adapted to the new DB structutre of the 4.0 version, that's why it is not commented.
*
*/
session_write_close();
$otx = new Otx();
$otx->load();
$c1 = $otx->get_token();
$c2 = $c1 && $otx->get_key_version() < 2;
if (!$c1 || $c2) {
    $_GET['error_type'] = !$c1 ? 'token' : 'old_key';
    require '../draw/otx_unregistered.php';
    die;
}
//Now the widget's data will be calculated depending of the widget's type.
switch ($type) {
    case "top":
        $limit = $chart_info['top'] > 0 ? $chart_info['top'] : 5;
        $range = $chart_info['range'] > 0 ? $chart_info['range'] : 14;
        $params = array('top' => $limit, 'range' => $range);
        $range = $range * 86400;
Exemplo n.º 10
0
function GetPulseName($pulse_id)
{
    if (!isset($_SESSION['_pulse_names'])) {
        $_SESSION['_pulse_names'] = array();
    }
    if ($_SESSION['_pulse_names'][$pulse_id] != '') {
        return $_SESSION['_pulse_names'][$pulse_id];
    }
    global $otx_unknown;
    $name = $otx_unknown;
    if (empty($pulse_id)) {
        return $name;
    }
    try {
        $otx = new Otx();
        $pulse = $otx->get_pulse_detail(strtolower($pulse_id), TRUE);
        if (!empty($pulse['name'])) {
            $name = Util::htmlentities(trim($pulse['name']), ENT_NOQUOTES);
        }
    } catch (Exception $e) {
    }
    $_SESSION['_pulse_names'][$pulse_id] = $name;
    return $name;
}
Exemplo n.º 11
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);
Exemplo n.º 12
0
$parameters['ds_name'] = "ds_name=" . urlencode($ds_name);
$parameters['beep'] = "beep=" . $beep;
$parameters['host_id'] = "host_id=" . $host_id;
$parameters['net_id'] = "net_id=" . $net_id;
$parameters['ctx'] = "ctx=" . $ctx;
$parameters['otx_activity'] = "otx_activity=" . $otx_activity;
$parameters['pulse_id'] = "pulse_id=" . $pulse_id;
$params_alarm = implode("&", $parameters);
$refresh_url = "alarm_console.php?" . $params_alarm;
//Autocompleted
$autocomplete_keys = array('hosts');
$hosts_str = Autocomplete::get_autocomplete($conn, $autocomplete_keys);
$pulse_name = '';
if ($pulse_id) {
    try {
        $otx = new Otx();
        $_p_data = $otx->get_pulse_detail($pulse_id, TRUE);
        $pulse_name = $_p_data['name'];
    } catch (Exception $e) {
    }
}
//Cleaning the stats
unset($_SESSION["_alarm_stats"]);
//New alarm time flag for new beep alarm.
$_SESSION['_alarm_last_refresh_time'] = gmdate("U");
$refresh_time_secs = 300;
$alarm_url = Alarm::get_alarm_path();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>