Esempio n. 1
0
function get_network_status($conn, $data)
{
    $id = $data['id'];
    $location = $data['location'];
    ossim_valid($id, OSS_HEX, 'illegal:' . _("Network ID"));
    ossim_valid($location, OSS_HEX, 'illegal:' . _("Location ID"));
    if (ossim_error()) {
        $info_error = "Error: " . ossim_get_error();
        ossim_clean_error();
        $return['error'] = true;
        $return['msg'] = $info_error;
        return $return;
    }
    //aux variables
    $answ['0'] = 'error';
    $answ['1'] = 'ok';
    $answ['2'] = 'info';
    $types = array('ids', 'vulns', 'passive', 'active', 'netflow');
    //net info
    $net = Asset_net::get_object($conn, $id);
    if ($net != NULL) {
        $cidr = $net->get_ips();
        $data['net_name'] = $net->get_name() . " (" . $cidr . ")";
        $data['net_owner'] = Session::get_entity_name($conn, $net->get_ctx(), true);
        $data['net_descr'] = $net->get_descr();
    } else {
        $data['net_name'] = _('Unknown');
        $data['net_owner'] = _('Unknown');
        $data['net_descr'] = _('Unknown');
    }
    $checks = Locations::get_location_checks($conn, $location);
    foreach ($types as $t_pos => $t) {
        if (strlen($checks) == 5 && $checks[$t_pos] == 0) {
            $data[$t] = 'info';
        } else {
            $options = array("type" => $t, "percent" => false, "network" => $id);
            $var = get_network_visibility($conn, $options);
            $data[$t] = $answ[$var];
        }
    }
    $options = array("type" => 'asset_network', "network" => $id);
    $data['net_devices'] = get_asset_visibility($conn, $options);
    $options = array("type" => 'asset_server', "network" => $id);
    $data['servers'] = get_asset_visibility($conn, $options);
    $return['error'] = false;
    $return['data'] = $data;
    return $return;
}
Esempio n. 2
0
$conn = $db->connect();
$options = array();
$locations = Locations::get_list($conn);
//Global Visibility
$location_percent = get_global_visibility($conn);
//Asset Visibility
$options = array("type" => 'asset_network');
$network_percent = get_asset_visibility($conn, $options);
$options = array("type" => 'asset_server');
$server_percent = get_asset_visibility($conn, $options);
//Network Visibility
$types = array('ids', 'vulns', 'passive', 'active', 'netflow');
foreach ($types as $t) {
    $var = $t . "_percent";
    $options = array("type" => $t, "percent" => true);
    ${$var} = get_network_visibility($conn, $options);
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
	<title> <?php 
echo _("OSSIM Framework");
?>
 </title>
	
	<!--[if lt IE 9]>
		<script type="text/javascript" src="/ossim/js/excanvas.js"></script>
		<script type="text/javascript" src="/ossim/js/html5shiv.js"></script>
	<![endif]-->
	
Esempio n. 3
0
function colorize_nets($conn, $id, $location)
{
    $color = 0;
    $ignored = 0;
    $class = '';
    $checks = Locations::get_location_checks($conn, $location);
    $types = array('ids', 'vulns', 'passive', 'active', 'netflow');
    foreach ($types as $t_pos => $t) {
        if (strlen($checks) == 5 && $checks[$t_pos] == 0) {
            $ignored++;
        } else {
            $options = array("type" => $t, "percent" => false, "network" => $id);
            $var = get_network_visibility($conn, $options);
            if (!$var) {
                $color++;
            }
        }
    }
    $nerror = count($types) - $ignored;
    switch ($color) {
        case 0:
            $class = 'l_success';
            break;
        case $nerror:
            $class = 'l_error';
            break;
        default:
            $class = 'l_warning';
    }
    if ($class == 'l_success') {
        $options = array("type" => 'asset_network', "network" => $id);
        $a_n = get_asset_visibility($conn, $options);
        $options = array("type" => 'asset_server', "network" => $id);
        $a_s = get_asset_visibility($conn, $options);
        $class = $a_n[0] + $a_s[0] < 200 ? 'l_warning' : $class;
    }
    return $class;
}