function explore_from($node, &$visited) { if (isset($visited[$node])) { return; } $visited[$node] = true; $edges = get_targets($node); foreach ($edges as $target) { explore_from($target, $visited); } }
$rs->MoveNext(); } // load group assets $sql = "SELECT hex(hi.host_id) as id, INET6_NTOA(hi.ip) as ip FROM user_component_filter uf, host h, host_ip hi, host_group_reference hgr WHERE h.id=hi.host_id AND uf.session_id=? AND uf.asset_id=hgr.host_group_id AND hgr.host_id=hi.host_id AND uf.asset_type='group' {$host_perms_where}"; $params = array(session_id()); $rs = $conn->Execute($sql, $params); if (!$rs) { Av_exception::throw_error(Av_exception::DB_ERROR, $conn->ErrorMsg()); } while (!$rs->EOF) { $asset_list[] = array('id' => $rs->fields['id'], 'ip' => $rs->fields['ip']); $rs->MoveNext(); } } } $select_targets = get_targets($conn, $targets_list); } // Schedule data $daysMap = array('Su' => array('text' => _('Sunday'), 'number' => '0'), 'Mo' => array('text' => _('Monday'), 'number' => '1'), 'Tu' => array('text' => _('Tuesday'), 'number' => '2'), 'We' => array('text' => _('Wednesday'), 'number' => '3'), 'Th' => array('text' => _('Thursday'), 'number' => '4'), 'Fr' => array('text' => _('Friday'), 'number' => '5'), 'Sa' => array('text' => _('Saturday'), 'number' => '6')); $nweekday = array('1' => array('text' => _('First'), 'selected' => 'selected="selected"'), '2' => array('text' => _('Second')), '3' => array('text' => _('Third')), '4' => array('text' => _('Fourth')), '5' => array('text' => _('Fifth')), '6' => array('text' => _('Sixth')), '7' => array('text' => _('Seventh')), '8' => array('text' => _('Eighth')), '9' => array('text' => _('Ninth')), '10' => array('text' => _('Tenth'))); $s_methods = array('N' => array('name' => _('Immediately')), 'O' => array('name' => _('Run Once')), 'D' => array('name' => _('Daily')), 'W' => array('name' => _('Day of the Week')), 'M' => array('name' => _('Day of the Month')), 'NW' => array('name' => _('N<sup>th</sup> week of the month'))); // date to fill the form // default values $nextscan = gmdate('Y-m-d H:i:s w', gmdate('U') + 3600 * $tz); preg_match('/(\\d+)\\-(\\d+)\\-(\\d+)\\s(\\d+):(\\d+):(\\d+)\\s(\\d)/', $nextscan, $found); $current_year = $found[1]; $selected_year = $found[1]; $current_month = $found[2]; $selected_month = $found[2]; $current_day = ltrim($found[3], '0'); $selected_day = ltrim($found[3], '0');
$users_to_assign[$u_key]['selected'] = $u_key == $database['username'] ? 'selected="selected"' : ''; } foreach ($entities_to_assign as $e_key => $e_value) { $entities_to_assign[$e_key]['selected'] = $e_key == $database['username'] ? 'selected="selected"' : ''; } $email_notification['no'] = intval($database['meth_Wfile']) == 0 ? 'checked="checked"' : ''; $email_notification['yes'] = intval($database['meth_Wfile']) == 1 ? 'checked="checked"' : ''; preg_match('/(.*)\\|(.*)/', $database['credentials'], $found); foreach ($ssh_arr as $cred_id => $cred_data) { $ssh_arr[$cred_id]['selected'] = $cred_id == $found[1] ? 'selected="selected"' : ''; } foreach ($smb_arr as $cred_id => $cred_data) { $smb_arr[$cred_id]['selected'] = $cred_id == $found[2] ? 'selected="selected"' : ''; } // targets $select_targets = get_targets($conn, $database['meth_TARGET']); } else { if ($action == 'delete_scan') { $query = 'SELECT username, name, id, scan_SERVER, report_id, status FROM vuln_jobs WHERE id=?'; $params = array($job_id); $result = $conn->execute($query, $params); $username = $result->fields['username']; $job_name = $result->fields['name']; $kill_id = $result->fields['id']; $nserver_id = $result->fields['scan_SERVER']; $report_id = $result->fields['report_id']; $can_i_delete = FALSE; if (Session::am_i_admin() || Session::get_session_user() == $username) { $can_i_delete = TRUE; } else { if (Session::is_pro() && Acl::am_i_proadmin()) {
$action = POST("action"); $data = POST("data"); ossim_valid($action, OSS_DIGIT, 'illegal:' . _("Action")); if (ossim_error()) { die(ossim_error()); } if ($action != '' && isset($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') { switch ($action) { case 1: $response = get_policy_groups($conn, $data); break; case 2: $response = get_policy_actions($conn, $data); break; case 3: $response = get_targets($conn, $data); break; case 4: $response = get_plugin_groups($conn, $data); break; case 5: $response = get_categories($conn, $data); break; case 6: $response = get_subcategories($conn, $data); break; default: $response['error'] = TRUE; $response['msg'] = 'Wrong Option Chosen'; } echo json_encode($response);