function host_get_network_data($ip, $groups, $networks)
{
    // search in groups
    $groups_belong['groups'] = array();
    $groups_belong['nets'] = array();
    foreach ($groups as $group_name => $g_data) {
        foreach ($g_data['nets'] as $net_name => $n_data) {
            $address = $n_data['address'];
            if (!strpos($address, "/")) {
                // tvvcox: i've detected some wrong network addresses, catch them with that
                //echo "<font color='red'>"._("Invalid network address for")." $net_name: $address</font><br>";
                continue;
            }
            if (Asset_host::is_ip_in_nets($ip, $address)) {
                if (!$n_data['has_perms'] && !check_sensor_perms($ip, 'host')) {
                    continue;
                }
                $groups_belong['groups'][$group_name]++;
                $groups_belong['nets'][$net_name] = $n_data;
            }
        }
    }
    // search in nets
    foreach ($networks as $net_name => $n_data) {
        $address = $n_data['address'];
        if ($address != "" && Asset_host::is_ip_in_nets($ip, $address)) {
            if (!$n_data['has_perms'] && !check_sensor_perms($ip, 'host')) {
                continue;
            }
            $groups_belong['nets'][$net_name] = $n_data;
        }
    }
    return $groups_belong;
}
예제 #2
0
    <?php 
/*
 * Hosts
 */
/*
 * If click on a net, only show hosts of this net
 */
if (GET('net')) {
    $_net_aux = Asset_net::get_object($conn, $net_id);
    if (is_object($_net_aux)) {
        $ips = $_net_aux->get_ips();
        print "<h1>{$ips}</h1>";
        if ($ip_list = Asset_host_qualification::get_list($conn)) {
            foreach ($ip_list as $host_qualification) {
                if (Asset_host::is_ip_in_nets($host_qualification->get_host_ip(), $ips)) {
                    $ip_stats[] = new Asset_host_qualification($host_qualification->get_host_ip(), $host_qualification->get_compromise(), $host_qualification->get_attack());
                }
            }
        }
    }
} else {
    $ip_stats = Asset_host_qualification::get_list($conn, '', 'ORDER BY compromise + attack DESC');
}
//if (count($ip_stats) > 0) {
$max_level = max(Ossim_db::max_val($conn, 'compromise', 'host_qualification'), Ossim_db::max_val($conn, 'attack', 'host_qualification'));
?>

    <tr><td colspan="3"><br/></td></tr>
    <tr>
        <th align="center" colspan="3">