Exemplo n.º 1
0
} else {
    $db = new ossim_db();
    $conn = $db->connect();
    $extra = "WHERE ip = '{$ip}'";
    $agentless = array_shift(Agentless::get_list($conn, $extra));
    if (!empty($agentless)) {
        $ip = $agentless->get_ip();
        $hostname = $agentless->get_hostname();
        $user = $agentless->get_user();
        $pass = Util::fake_pass($agentless->get_pass());
        $passc = $pass;
        $ppass = Util::fake_pass($agentless->get_ppass());
        $ppassc = $ppass;
        $descr = $agentless->get_descr();
        $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();
        }
    } else {
        $info_error = _("No agentless host found");
    }
    $db->close($conn);
}
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<title> <?php 
Exemplo n.º 2
0
            $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");
        }
        break;
}
$db->close($conn);
?>


Exemplo n.º 3
0
*
* Otherwise you can read it here: http://www.gnu.org/licenses/gpl-2.0.txt
****************************************************************************/
require_once 'classes/Session.inc';
require_once 'classes/Security.inc';
require_once 'classes/Ossec.inc';
$ip = GET('ip');
$txt_error = null;
ossim_valid($ip, OSS_IP_ADDR, 'illegal:' . _("Ip Address"));
if (ossim_error()) {
    $txt_error = ossim_get_error();
} else {
    $db = new ossim_db();
    $conn = $db->connect();
    $extra = "WHERE ip = '{$ip}'";
    $agentless = array_shift(Agentless::get_list($conn, $extra));
    if (!empty($agentless)) {
        if ($agentless->get_status() == 0) {
            $res = $agentless->change_status($conn, 1);
            $txt_error = $res == true ? null : _("Error to enable Agentless Host");
            $db->close($conn);
        } elseif ($agentless->get_status() == 1) {
            $res = $agentless->change_status($conn, 0);
            $txt_error = $res == true ? null : _("Error to disable Agentless Host");
            $db->close($conn);
        } else {
            if ($agentless->get_status() == 2) {
                header("Location: al_modifyform.php?ip={$ip}");
                exit;
            }
        }
Exemplo n.º 4
0
$agentless_list = array();
$agentless_xml = array();
$agentless_list = Agentless::get_list($conn, "");
if (!empty($agentless_list) && empty($info_error)) {
    foreach ($agentless_list as $k => $v) {
        $ip = $k;
        $extra = "WHERE ip = '{$ip}'";
        $monitoring_entries = Agentless::get_list_m_entries($conn, $extra);
        $user = $v->get_user();
        $host = !empty($ppass) ? "use_su " : "";
        $host .= $user . "@" . $ip;
        $pass = $v->get_pass();
        $ppass = $v->get_ppass();
        $status = $v->get_status();
        if ($status == "1" || $status == "2") {
            $res = Agentless::enable_host($ip, $user, $pass, $ppass);
            if ($res == false) {
                $info_error = _("Error to add Agentless Host");
                @copy($path_tmp2, $path_passlist);
                break;
            }
        }
        if (is_array($monitoring_entries) && $status != 0) {
            foreach ($monitoring_entries as $i => $entry) {
                $arguments = !empty($entry['arguments']) ? "<arguments>" . $entry['arguments'] . "</arguments>" : "";
                $agentless_xml[] = "<agentless>";
                $agentless_xml[] = "<type>" . $entry['id_type'] . "</type>";
                $agentless_xml[] = "<frequency>" . $entry['frequency'] . "</frequency>";
                $agentless_xml[] = "<host>{$host}</host>";
                $agentless_xml[] = "<state>" . $entry['state'] . "</state>";
                $agentless_xml[] = "{$arguments}";
Exemplo n.º 5
0
                            Agentless::add_monitoring_entry($conn, $ip, $type, $frequency, $state, $arguments);
                        }
                    }
                    $entry = null;
                    $i = $j++;
                    break;
                }
            }
        } else {
            $i++;
        }
    }
}
$agentless_list = null;
$extra = !empty($search) ? $search . " ORDER BY {$order} {$limit}" : "ORDER BY {$order} {$limit}";
$agentless_list = Agentless::get_list($conn, $extra);
if (!empty($agentless_list)) {
    $key = array_keys($agentless_list);
    $total = $agentless_list[$key[0]]->get_foundrows();
    if ($total == 0) {
        $total = count($agentless_list);
    }
} else {
    $total = 0;
}
$xml .= "<rows>\n";
$xml .= "<page>{$page}</page>\n";
$xml .= "<total>{$total}</total>\n";
foreach ($agentless_list as $host) {
    $ip = $host->get_ip();
    $hostname = "<a style='font-weight:bold;' href='./al_modifyform.php?ip=" . urlencode($ip) . "'>" . $host->get_hostname() . "</a>" . Host_os::get_os_pixmap($conn, $ip);
Exemplo n.º 6
0
echo gettext("Delete Agentless Host");
?>
 </h1>

<?php 
$txt_error = null;
ossim_valid($ip, OSS_IP_ADDR, 'illegal:' . _("Ip Address"));
if (ossim_error()) {
    $txt_error = ossim_get_error();
} else {
    $db = new ossim_db();
    $conn = $db->connect();
    $res = Agentless::delete_host_ossec($conn, $ip);
    $txt_error = $res == false ? _("Error to delete host from .passlist") : null;
    if ($txt_error == null) {
        $res = Agentless::delete_host_data($conn, $ip);
        $txt_error = $res == false ? _("Error to delete host") : null;
    }
    $db->close($conn);
}
if (!empty($txt_error)) {
    Util::print_error($txt_error);
    Util::make_form("POST", "agentless.php");
} else {
    echo "<p>" . _("Host succesfully deleted") . "</p>";
    echo "<script>document.location.href='agentless.php'</script>";
}
?>
  
</body>
</html>