示例#1
0
    $ppassc = $_SESSION['_al_new']['ppassc'] = POST('ppassc');
    $descr = $_SESSION['_al_new']['descr'] = POST('descr');
    $display = "display: none;";
    if ($step == 1) {
        if ($error == true) {
            $step = null;
            $display = "display: block;";
            $action_form = "al_newform.php";
        } else {
            $db = new ossim_db();
            $conn = $db->connect();
            if ($back == 1) {
                $res = Agentless::modify_host_data($conn, $ip, $hostname, $user, $pass, $ppass, $descr, 1);
                $info_error = $res !== true ? _("Error Updating Monitorig Host Data") : null;
            } else {
                $res = Agentless::add_host_data($conn, $ip, $hostname, $user, $pass, $ppass, $descr);
                $info_error = $res !== true ? _("Error Adding Monitorig Host Data") : null;
            }
            if (!empty($ip)) {
                $extra = "WHERE ip = '{$ip}'";
                $error_m_entries = null;
                $monitoring_entries = Agentless::get_list_m_entries($conn, $extra);
                if (!is_array($monitoring_entries)) {
                    $error_m_entries = $monitoring_entries;
                    $monitoring_entries = array();
                }
            }
            $db->close($conn);
        }
    }
} else {
示例#2
0
         echo "Ok";
     } else {
         echo "error###" . _("Error to Delete Monitoring Entry");
     }
     break;
 case "modify_monitoring_entry":
     $res = Agentless::modify_monitoring_entry($conn, $type, $frequency, $state, $arguments, $id);
     if ($res !== false) {
         $path = '../pixmaps';
         echo "1###" . "\t<td class='nobborder center' id='al_type_{$id}'>" . get_type($type) . "</td>\r\n\t\t\t\t\t\t<td class='nobborder center' id='al_frequency_{$id}'>{$frequency}</td>\r\n\t\t\t\t\t\t<td class='nobborder center' id='al_state_{$id}'>{$state}</td>\r\n\t\t\t\t\t\t<td class='nobborder left' id='al_arguments_{$id}'>{$arguments}</td>\r\n\t\t\t\t\t\t<td class='center nobborder'>\r\n\t\t\t\t\t\t\t<a onclick=\"add_values('{$id}')\"><img src='{$path}/pencil.png' align='absmiddle' alt='" . _("Modify monitoring entry") . "' title='" . _("Modify monitoring entry") . "'/></a>\r\n\t\t\t\t\t\t\t<a onclick=\"delete_monitoring('{$id}')\" style='margin-right:5px;'><img src='{$path}/delete.gif' align='absmiddle' alt='" . _("Delete monitoring entry") . "' title='" . _("Delete monitoring entry") . "'/></a>\r\n\t\t\t\t\t\t</td>\r\n\t\t\t\t\t";
     } else {
         echo "error###" . _("Error to Modify Monitoring Entry");
     }
     break;
 case "add_host_data":
     $res = Agentless::add_host_data($conn, POST('ip'), POST('hostname'), POST('user'), POST('pass'), POST('ppass'), POST('descr'), 1);
     if ($res == true) {
         echo _("1###Host Sucessfully added");
     } else {
         echo _("error###Error Adding Monitorig Host Data");
     }
     break;
 case "modify_host_data":
     $extra = "WHERE ip = '" . POST('ip') . "'";
     $agentless = array_shift(Agentless::get_list($conn, $extra));
     $status = $agentless->get_status() != 2 ? $agentless->get_status() : 1;
     $res = Agentless::modify_host_data($conn, POST('ip'), POST('hostname'), POST('user'), POST('pass'), POST('ppass'), POST('descr'), $status);
     if ($res == true) {
         echo _("1###Host Sucessfully updated");
     } else {
         echo _("error###Error Updating Monitorig Host Data");
示例#3
0
ossim_valid($field, OSS_ALPHA, OSS_SPACE, OSS_PUNC, OSS_NULLABLE, 'illegal:' . _("Field"));
ossim_valid($page, OSS_DIGIT, 'illegal:' . _("Page"));
ossim_valid($rp, OSS_DIGIT, 'illegal:' . _("Rp"));
if (ossim_error()) {
    die(ossim_error());
}
$start = ($page - 1) * $rp;
$limit = "LIMIT {$start}, {$rp}";
$db = new ossim_db();
$conn = $db->connect();
$error = true;
$ossec_list = Agentless::get_list_ossec($conn);
$agentless_list = Agentless::get_list($conn, "");
foreach ($ossec_list as $k => $v) {
    if (!is_object($agentless_list[$k])) {
        Agentless::add_host_data($conn, $v->get_ip(), $v->get_hostname(), $v->get_user(), $v->get_pass(), $v->get_ppass(), null, $v->get_status());
        $agentless_entry_ossec[$v->get_user() . "@" . $v->get_ip()] = null;
    }
}
if (!empty($agentless_entry_ossec)) {
    $conf_file = file_get_contents($ossec_conf);
    $pattern = '/[\\r?\\n]+\\s*/';
    $conf_file = preg_replace($pattern, "\n", $conf_file);
    $conf_file = explode("\n", trim($conf_file));
    $i = 0;
    $size_cf = count($conf_file);
    while ($i < count($conf_file)) {
        if (preg_match("/<\\s*agentless\\s*>/", $conf_file[$i], $match)) {
            $entry = null;
            for ($j = $i + 1; $j < $size_cf; $j++) {
                $entry[] = $conf_file[$j];