function get_assets_visibility($conn) { //Networks Devices $options = array("type" => 'asset_network'); $_networks = get_asset_visibility($conn, $options); $data['network']['count'] = $_networks[1]; $data['network']['total'] = $_networks[2]; $data['network']['percent'] = $_networks[0]; //Servers Devices $options = array("type" => 'asset_server'); $_servers = get_asset_visibility($conn, $options); $data['server']['count'] = $_servers[1]; $data['server']['total'] = $_servers[2]; $data['server']['percent'] = $_servers[0]; $return['error'] = false; $return['data'] = $data; return $return; }
require_once 'av_init.php'; require_once 'deploy_common.php'; //Checking perms check_deploy_perms(); /* connect to db */ $db = new ossim_db(TRUE); $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>
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; }