コード例 #1
0
ファイル: modifyhostgroup.php プロジェクト: jhbsz/ossimTest
 if ($error == true) {
     $txt_error = "<div>" . _("We Found the following errors") . ":</div><div style='padding:10px;'>" . implode("<br/>", $message_error) . "</div>";
     Util::print_error($txt_error);
     Util::make_form("POST", "newhostgroupform.php?" . $get_param);
     die;
 }
 $db = new ossim_db();
 $conn = $db->connect();
 /*
 NESSUS - DEPRECATED
         Host_group_scan::delete($conn, $hgname, 3001, 0);
         Host_group_scan::insert($conn, $hgname, 3001, 0);
 */
 Host_group_scan::delete($conn, $hgname, 3001, 0);
 if (Host_group_scan::in_host_group_scan($conn, ${$hgname}, 2007)) {
     $hosts_list = Host_group_reference::get_list($conn, $hgname, "2007");
     foreach ($hosts_list as $host) {
         $hostip[] = $host->get_host_ip();
     }
     foreach ($hostip as $host) {
         $flag = false;
         foreach ($hosts as $h) {
             if (strcmp($h, $host) == 0) {
                 $flag = true;
                 break;
             }
         }
         if ($flag == false) {
             if (Host_group_scan::can_delete_host_from_nagios($conn, $host, $hgname)) {
                 $q = new NagiosAdm();
                 $q->delHost(new NagiosHost($host, $host, ""));
コード例 #2
0
ファイル: gethostgroup.php プロジェクト: jhbsz/ossimTest
$nessus_action = GET('nessus_action');
$host_group_name = GET('host_group_name');
ossim_valid($nessus_action, OSS_ALPHA, OSS_NULLABLE, 'illegal:' . _("Nessus action"));
ossim_valid($page, OSS_DIGIT, OSS_NULLABLE, 'illegal:' . _("page"));
ossim_valid($rp, OSS_DIGIT, OSS_NULLABLE, 'illegal:' . _("rp"));
ossim_valid($search, OSS_TEXT, OSS_NULLABLE, 'illegal:' . _("search"));
ossim_valid($field, OSS_ALPHA, OSS_SPACE, OSS_PUNC, OSS_NULLABLE, 'illegal:' . _("field"));
ossim_valid($nagios_action, OSS_ALPHA, OSS_NULLABLE, 'illegal:' . _("Nagios action"));
ossim_valid($host_group_name, OSS_ALPHA, OSS_PUNC, OSS_SPACE, OSS_NULLABLE, 'illegal:' . _("Host group name"));
ossim_valid($order, OSS_ALPHA, OSS_PUNC, OSS_SPACE, OSS_NULLABLE, 'illegal:' . _("Order"));
if (ossim_error()) {
    die(ossim_error());
}
$db = new ossim_db();
$conn = $db->connect();
$hosts_list = Host_group_reference::get_list($conn, $host_group_name);
$iter = 0;
foreach ($hosts_list as $host) {
    $hosts[$iter++] = $host->host_ip;
}
if (!empty($nessus_action) and !empty($host_group_name)) {
    if ($nessus_action == "toggle") {
        $nessus_action = ($scan_list = Host_group_scan::get_list($conn, "WHERE host_group_name = '{$host_group_name}' AND plugin_id = 3001")) ? "disable" : "enable";
    }
    if ($nessus_action == "enable") {
        Host_group::enable_nessus($conn, $host_group_name);
    } elseif ($nessus_action = "disable") {
        Host_group::disable_nessus($conn, $host_group_name);
    }
    //$db->close($conn);
}