Esempio n. 1
0
    $asset->load_from_db($conn);
} else {
    //Set IP address and CTX for a new asset (Right menu from SIEM, Alarms, ...)
    if (!empty($ctx) && !empty($ips)) {
        $asset->set_ctx($ctx);
        $ext_ips[$_ip] = array('ip' => $ips[0], 'mac' => NULL);
        $asset->set_ips($ext_ips);
    }
}
/*
echo '<pre>';
    print_r($asset);
echo '</pre>';
*/
//Getting asset data
$id = $asset->get_id();
$name = $asset->get_name();
$_ips = $asset->get_ips();
$ips = $_ips->get_ips();
$ips = array_keys($ips);
$descr = html_entity_decode($asset->get_descr(), ENT_QUOTES, 'UTF-8');
$fqdns = $asset->get_fqdns();
$external = $asset->get_external();
$location = $asset->get_location();
$asset_value = $asset->get_asset_value();
$os_data = $asset->get_os();
$os = $os_data['value'];
$model = $asset->get_model();
//CTX name
$ctx_name = empty($ctx) ? _('None') : Session::get_entity_name($conn, $ctx);
$ctx_name = Util::utf8_encode2($ctx_name);
Esempio n. 2
0
    $can_i_modify_ips = Asset_host::can_i_modify_ips($conn, $id);
} else {
    //New host
    $id = Util::uuid();
    $host = new Asset_host($conn, $id);
    if (isset($_aux_ctx) && isset($_aux_ip)) {
        $host->set_ctx($_aux_ctx);
        $ext_ips[$_aux_ip] = array('ip' => $_aux_ip, 'mac' => NULL);
        $host->set_ips($ext_ips);
    }
    $can_i_modify_ips = TRUE;
}
//All sensors
list($all_sensors, $s_total) = Av_sensor::get_list($conn, '', FALSE, TRUE);
//Getting host data
$id = $host->get_id();
$name = $host->get_name();
//CTX
$ctx = $host->get_ctx();
$ctx_name = empty($ctx) ? _('None') : Session::get_entity_name($conn, $ctx);
$is_ext_ctx = FALSE;
$context_type = 'local';
$ext_ctxs = Session::get_external_ctxs($conn);
if (!empty($ext_ctxs[$ctx])) {
    $is_ext_ctx = TRUE;
    $context_type = 'remote';
}
$descr = $host->get_descr();
$icon = $host->get_html_icon();
$fqdns = $host->get_fqdns();
$external = $host->get_external();