Exemple #1
0
}
$db = new ossim_db();
$conn = $db->connect();
// get the groups members
foreach ($assets_groups as $asset_id => $asset_type) {
    if ($asset_type == 'hostgroup' && Asset_group::is_in_db($conn, $asset_id)) {
        $host_group = Asset_group::get_object($conn, $asset_id);
        list($host_list, $total) = $host_group->get_hosts($conn);
        foreach ($host_list as $host_id => $host_data) {
            $host_ips = explode(',', $host_data['ips']);
            foreach ($host_ips as $host_ip) {
                $targets[$host_id . '#' . $host_ip] = array('hostgroup_id' => $asset_id);
            }
        }
    } else {
        if ($asset_type == 'netgroup' && Net_group::is_in_db($conn, $asset_id)) {
            $net_list = Net_group::get_networks($conn, $asset_id);
            foreach ($net_list as $net) {
                $net_id = $net->get_net_id();
                $net_cidrs = Asset_net::get_ips_by_id($conn, $net_id);
                $cidrs = explode(',', $net_cidrs);
                foreach ($cidrs as $cidr) {
                    $targets[$net_id . '#' . $cidr] = array('netgroup_id' => $asset_id);
                }
            }
        }
    }
}
$tsensors = explode(',', Session::allowedSensors());
$sensor_ids = array();
$conn->SetFetchMode(ADODB_FETCH_BOTH);