예제 #1
0
    $ttargets[$target]['snames'] = $snames;
    // target name
    $ttargets[$target]['name'] = $name;
    // sensors permissions
    $ttargets[$target]['sensors_perms'] = $sperm;
    // sensors permissions
    $ttargets[$target]['vuln_scanner'] = $vs;
    // Nmap status
    $ttargets[$target]['nmap_scan'] = $snmap;
    // Load
    $ttargets[$target]['load'] = $load;
}
// group targets by group and sensors
$result = array();
foreach ($ttargets as $target => $target_data) {
    if (Av_sensor::is_in_db($conn, $target_data['sensor']) == TRUE) {
        if (!empty($target_data['hostgroup_id'])) {
            $result_key = $target_data['hostgroup_id'] . '#hostgroup#' . $target_data['sensor'];
            $result[$result_key]['name'] = Asset_group::get_name_by_id($conn, $target_data['hostgroup_id']);
        } else {
            if (!empty($target_data['netgroup_id'])) {
                $result_key = $target_data['netgroup_id'] . '#netgroup#' . $target_data['sensor'];
                $result[$result_key]['name'] = Net_group::get_name_by_id($conn, $target_data['netgroup_id']);
            } else {
                $result_key = $target . '#' . $target_data['sensor'];
                $result[$result_key]['name'] = $target_data['name'];
            }
        }
        $result[$result_key]['ips'][] = $target;
        $result[$result_key]['sensor'] = $target_data['sensor'];
        $result[$result_key]['sperm'] = empty($result[$result_key]['sperm']) || $result[$result_key]['sperm'] == 1 ? $target_data['sperm'] : $result[$result_key]['sperm'];