Esempio n. 1
0
        $nt->show();
        Util::make_form("POST", "modifyserverform.php?id={$id}");
        exit;
    }
    try {
        $db = new ossim_db();
        $conn = $db->connect();
        if (!isset($resend_alarms)) {
            $resend_alarms = 0;
        }
        if (!isset($resend_events)) {
            $resend_events = 0;
        }
        Server::update($conn, $id, $sname, $ip, $port, $descr, $correlate, $cross_correlate, $store, $rep, $qualify, $resend_alarms, $resend_events, $sign, $sem, $sim, $alarm_to_syslog, $remoteadmin, $remotepass, $remoteurl, $setssh, $fwrd_server);
        Util::resend_asset_dump('servers');
        Util::memcacheFlush();
    } catch (Exception $e) {
        $db->close();
        $config_nt = array('content' => $e->getMessage(), 'options' => array('type' => 'nf_error', 'cancel_button' => FALSE), 'style' => 'width: 80%; margin: 20px auto; text-align: left;');
        $nt = new Notification('nt_1', $config_nt);
        $nt->show();
        Util::make_form("POST", "modifyserverform.php?id={$id}");
        exit;
    }
    $db->close();
    ?>

        <script type='text/javascript'>
            if (!parent.is_lightbox_loaded(window.name))
            {
                document.location.href="server.php?msg=updated";
Esempio n. 2
0
        unset($_SESSION["server"]);
    } else {
        $_server = intval($_GET["server"]);
        if ($_server > 0) {
            // Query DB server
            $dbo = new ossim_db();
            $conn = $dbo->connect();
            list($db_server) = Databases::get_list($conn, 'WHERE id = ' . $_server);
            $dbo->close();
            unset($dbo);
            if (is_object($db_server)) {
                $_SESSION["server"] = array($db_server->get_ip(), $db_server->get_port(), $db_server->get_user(), $db_server->get_pass(), $db_server->get_name());
            }
        }
    }
    Util::memcacheFlush(false);
}
if (is_array($_SESSION['server']) && $_SESSION["server"][0] != '') {
    // Change connect variables
    $alert_host = $_SESSION['server'][0];
    $alert_port = $_SESSION['server'][1];
    $alert_user = $_SESSION['server'][2];
    $alert_password = $_SESSION['server'][3];
    $alert_ext_dbname = $_SESSION['server'][4];
    $alert_dbname = preg_match("/\\_restore/", $alert_ext_dbname) ? $alert_ext_dbname : 'alienvault_siem';
    $db_connect_method = DB_PCONNECT;
    $dbo = new ossim_db();
    error_reporting(E_ERROR | E_PARSE);
    // Try to connect
    try {
        $dbo->enable_cache();
Esempio n. 3
0
 function baseCacheFlush()
 {
     //$this->DB->CacheFlush();
     require_once "classes/Util.inc";
     Util::memcacheFlush();
 }
Esempio n. 4
0
function modify_device_host($conn, $data)
{
    $id = $data['id'];
    $type = $data['type'];
    $subtype = $data['subtype'];
    ossim_valid($id, OSS_HEX, 'illegal:' . _("Host ID"));
    ossim_valid($type, OSS_DIGIT, OSS_NULLABLE, 'illegal:' . _("Device Type"));
    ossim_valid($subtype, OSS_DIGIT, OSS_NULLABLE, 'illegal:' . _("Device Subtype"));
    if (ossim_error()) {
        $info_error = "Error: " . ossim_get_error();
        ossim_clean_error();
        $return['error'] = true;
        $return['msg'] = $info_error;
        return $return;
    }
    if (empty($type)) {
        $sql = "DELETE FROM host_types WHERE host_id = UNHEX(?)";
        $params = array($id);
    } else {
        $sql = "DELETE FROM host_types WHERE host_id = UNHEX(?)";
        $params = array($id);
        $conn->Execute($sql, $params);
        $sql = "REPLACE INTO host_types (host_id, type, subtype) VALUES (UNHEX(?), ?, ?)";
        $params = array($id, $type, $subtype);
    }
    if ($conn->Execute($sql, $params) === false) {
        $return['error'] = true;
        $return['msg'] = $conn->ErrorMsg();
    } else {
        Util::memcacheFlush(false);
        $return['error'] = false;
        $return['data'] = _('Device Property Modified Successfully');
    }
    return $return;
}
Esempio n. 5
0
function check_bg_tasks($conn)
{
    $user = Session::get_session_user();
    $config = new User_config($conn);
    //Getting the pid of the operation running in background
    $pid = $config->get($user, 'background_task', 'simple', "alarm");
    $bg = FALSE;
    //If the pid is not empty, then we check if the process is still running
    if ($pid != '') {
        //Launching a ps with the pid stored
        $process_state = Util::execute_command('ps ?', array(intval($pid)), 'array');
        $bg = count($process_state) >= 2;
        //If the count is >= 2 then there is a process running
        //If the process is not running any longer, then we delete the pid from db
        if (!$bg) {
            $config->set($user, 'background_task', '', 'simple', 'alarm');
        }
    }
    $return['error'] = FALSE;
    $return['msg'] = '';
    $return['bg'] = $bg;
    Util::memcacheFlush(FALSE);
    return $return;
}
Esempio n. 6
0
function release_group($conn, $data)
{
    $group_id = $data['group_id'];
    //Validating parameters
    ossim_valid($group_id, OSS_INPUT, 'illegal:' . _("Alarm Group ID"));
    if (ossim_error()) {
        $info_error = "Error: " . ossim_get_error();
        ossim_clean_error();
        $return['error'] = TRUE;
        $return['msg'] = $info_error;
        return $return;
    }
    $user = Session::get_session_user();
    Alarm_groups::release_group($conn, $group_id, $user);
    Util::memcacheFlush(FALSE);
    $return['error'] = FALSE;
    $return['data'] = '';
    return $return;
}