function load_layout($name_layout, $category = 'policy') { $db = new ossim_db(); $conn = $db->connect(); $config = new User_config($conn); $login = Session::get_session_user(); $data = $config->get($login, $name_layout, 'php', $category); return $data == null ? array() : $data; }
if ($pro) { if ($trial_days <= 0) { if (file_exists('/usr/share/ossim/www/session/trial/index.php')) { header("Location: /ossim/session/trial/index.php"); exit; } } } if (Session::am_i_admin() && Welcome_wizard::run_welcome_wizard()) { header('Location: /ossim/wizard/'); } if ($pro && ($trial_days == 7 || $trial_days == 2)) { $db = new ossim_db(); $conn = $db->connect(); $user = Session::get_session_user(); $config = new User_config($conn); $popup = $config->get($user, 'popup', 'simple', "trial"); if ($trial_days == 7) { if ($popup != '7days') { $flag_trial_popup = TRUE; $config->set($user, 'popup', '7days', 'simple', 'trial'); } } elseif ($trial_days == 2) { if ($popup != '2days') { $flag_trial_popup = TRUE; $config->set($user, 'popup', '2days', 'simple', 'trial'); } } $db->close(); } /* Track usage information */
$ossim_link = $conf->get_conf("ossim_link", FALSE); $login_location = $ossim_link . '/session/login.php'; header("Location: {$login_location}"); exit; } require_once "classes/Util.inc"; // Timezone correction $tz = Util::get_timezone(); $timetz = gmdate("U") + 3600 * $tz; // time to generate dates with timezone correction // Custom Views require_once 'classes/User_config.inc'; $login = Session::get_session_user(); $db_aux = new ossim_db(); $conn_aux = $db_aux->connect(); $config = new User_config($conn_aux); $_SESSION['views'] = $config->get($login, 'custom_views', 'php', "siem"); // First save of default view (important!) if ($_SESSION['views']['default'] == "") { $_SESSION['views']['default']['cols'] = array('SIGNATURE', 'DATE', 'IP_PORTSRC', 'IP_PORTDST', 'ASSET', 'PRIORITY', 'RELIABILITY', 'RISK', 'IP_PROTO'); $session_data = $_SESSION; foreach ($_SESSION as $k => $v) { if (preg_match("/^(_|alarms_|back_list|current_cview|views|ports_cache|acid_|report_|graph_radar|siem_event|deletetask|mdspw).*/", $k)) { unset($session_data[$k]); } } $_SESSION['views']['default']['data'] = $session_data; $config->set($login, 'custom_views', $_SESSION['views'], 'php', 'siem'); } if ($_GET["search_str"] == "search term") { unset($_GET["search_str"]);
header("Location: {$login_location}"); exit; } // Timezone correction $tz = Util::get_timezone(); $timetz = gmdate("U") + 3600 * $tz; // time to generate dates with timezone correction // IDM Mode? $idm_enabled = $conf->get_conf("enable_idm", FALSE) == 1 && Session::is_pro() ? true : false; $cloud_instance = $conf->get_conf("cloud_instance", FALSE) == 1 && Session::is_pro() ? true : false; $_SESSION['_idm'] = $idm_enabled; // Custom Views $login = Session::get_session_user(); $db_aux = new ossim_db(); $conn_aux = $db_aux->connect(); $config = new User_config($conn_aux); $_SESSION['views'] = $config->get($login, 'custom_views', 'php', "siem"); $default_view = $config->get($login, 'custom_view_default', 'php', "siem") != "" ? $config->get($login, 'custom_view_default', 'php', "siem") : ($idm_enabled ? 'IDM' : 'default'); // First create default views if not exists (important!) $session_data = $_SESSION; foreach ($_SESSION as $k => $v) { if (preg_match("/^(_|alarms_|back_list|current_cview|views|ports_cache|acid_|report_|graph_radar|siem_event|siem_current_query|siem_current_query_graph|deletetask|mdspw).*/", $k)) { unset($session_data[$k]); } } // Default if ($_SESSION['views']['default'] == "" || count($_SESSION['views']['default']['cols']) == 9) { $_SESSION['views']['default']['cols'] = array('SIGNATURE', 'DATE', 'SENSOR', 'IP_PORTSRC', 'IP_PORTDST', 'ASSET', 'RISK'); //$_SESSION['views']['default']['cols'] = array('SIGNATURE','DATE','IP_PORTSRC','IP_PORTDST','ASSET','PRIORITY','RELIABILITY','RISK','IP_PROTO'); //$_SESSION['views']['Detail']['data'] = $session_data; $config->set($login, 'custom_views', $_SESSION['views'], 'php', 'siem');
<?php /***************************************************************************** * * License: * * Copyright (c) 2003-2006 ossim.net * Copyright (c) 2007-2009 AlienVault * All rights reserved. * * This package is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; version 2 dated June, 1991. * You may not use, modify or distribute this program under any other version * of the GNU General Public License. * * This package is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this package; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, * MA 02110-1301 USA * * * On Debian GNU/Linux systems, the complete text of the GNU General * Public License can be found in `/usr/share/common-licenses/GPL-2'. * * Otherwise you can read it here: http://www.gnu.org/licenses/gpl-2.0.txt
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, * MA 02110-1301 USA * * * On Debian GNU/Linux systems, the complete text of the GNU General * Public License can be found in `/usr/share/common-licenses/GPL-2'. * * Otherwise you can read it here: http://www.gnu.org/licenses/gpl-2.0.txt * */ require_once 'av_init.php'; Session::logcheck("analysis-menu", "EventsForensics"); $login = Session::get_session_user(); $db = new ossim_db(true); $conn = $db->connect(); $config = new User_config($conn); // Only set default if (GET('set_default') != "" && GET('name') != "") { $name = GET('name'); ossim_valid($name, OSS_NULLABLE, OSS_ALPHA, OSS_SPACE, OSS_PUNC, "Invalid: name"); if (ossim_error()) { die(ossim_error()); } $config->set($login, 'custom_view_default', $name, 'php', 'siem'); exit; } // Normal Save $session_data = $_SESSION; foreach ($_SESSION as $k => $v) { if (preg_match("/^(_|alarms_|back_list|current_cview|views|ports_cache|acid_|report_|graph_radar|siem_event|siem_current_query|siem_current_query_graph|deletetask).*/", $k)) { unset($session_data[$k]);
* Otherwise you can read it here: http://www.gnu.org/licenses/gpl-2.0.txt * */ require_once 'av_init.php'; $db_path = '/usr/share/ossim/www/dashboard'; set_include_path(get_include_path() . PATH_SEPARATOR . $db_path); //Checking if we have permissions to go through this section Session::logcheck("dashboard-menu", "ControlPanelExecutive"); list($db, $conn) = Ossim_db::get_conn_db(); $login = Session::get_session_user(); $pro = Session::is_pro(); /* Getting the default tab */ if (!empty($_SESSION['default_tab'])) { $default_tab = $_SESSION['default_tab']; } else { $config_aux = new User_config($conn); $default_tab = $config_aux->get($login, 'panel_default', 'simple', "main"); $default_tab = $default_tab > 0 ? $default_tab : 1; //We save the default tab in session $_SESSION['default_tab'] = $default_tab; } /* Getting the current panel */ $panel_id = $default_tab; if (GET('panel_id') != "") { $panel_id = GET('panel_id'); } elseif ($_SESSION['_db_panel_selected'] != "") { $panel_id = $_SESSION['_db_panel_selected']; } $edit = 0; if (GET('edit') != "") { $edit = GET('edit');
ossim_valid(GET('del_export'), OSS_DIGIT, OSS_ALPHA, OSS_NULLABLE, '=', 'illegal:' . _("del_export")); if (ossim_error()) { die(ossim_error()); } $config = parse_ini_file("everything.ini"); if ($config["debug"] == 1) { if ($config["debug_log"] == "") { $config["debug_log"] = "/var/log/ossim/sem.log"; } //$handle = fopen($config["debug_log"], "a+"); //fputs($handle,"============================== INDEX.php ".date("Y-m-d H:i:s")." ==============================\n"); //fclose($handle); } $uniqueid = uniqid(rand(), true); // Filters $uconfig = new User_config($conn_aux); $_SESSION['logger_filters'] = $uconfig->get(Session::get_session_user(), 'logger_filters', 'php', "logger"); if ($_SESSION['logger_filters']['default'] == "") { $_SESSION['logger_filters']['default']['start_aaa'] = $param_start; $_SESSION['logger_filters']['default']['end_aaa'] = $param_end; $_SESSION['logger_filters']['default']['query'] = ""; $uconfig->set(Session::get_session_user(), 'logger_filters', $_SESSION['logger_filters'], 'php', 'logger'); } // Exports $exports = array(); if (is_dir($config["searches_dir"])) { $find_str = $config["searches_dir"] . Session::get_session_user(); $cmd = "ls -t '{$find_str}'*/results.txt"; $res = explode("\n", `{$cmd}`); foreach ($res as $line) { if (preg_match("/{$user}\\_(\\d\\d\\d\\d\\-\\d\\d\\-\\d\\d \\d\\d\\:\\d\\d\\:\\d\\d)\\_(\\d\\d\\d\\d\\-\\d\\d\\-\\d\\d \\d\\d\\:\\d\\d\\:\\d\\d)\\_(none|date|date\\_desc)\\_(.*)\\/results\\.txt/", $line, $found)) {
* Otherwise you can read it here: http://www.gnu.org/licenses/gpl-2.0.txt ****************************************************************************/ /** * Class and Function List: * Function list: * Classes list: */ require_once 'classes/Event_viewer.inc'; require_once 'classes/User_config.inc'; require_once 'classes/Plugingroup.inc'; require_once 'classes/Session.inc'; require_once 'ossim_db.inc'; Session::logcheck("MenuEvents", "EventsViewer"); $db = new ossim_db(); $conn = $db->connect(); $config = new User_config($conn); $login = Session::get_session_user(); $groups_config = $config->get($login, 'event_viewer', 'php'); $date_to = GET('date_to') ? GET('date_to') : date('Y-m-d'); $date_from = GET('date_from') ? GET('date_from') : date('Y-m-d'); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <title><?php echo _("OSSIM Framework"); ?> </title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/> <META HTTP-EQUIV="Pragma" CONTENT="no-cache"> <link rel="stylesheet" type="text/css" href="../style/style.css"/>
$my_users = $_SESSION['_user_vision']['user']; } $delete_perms = $my_users[$user] == 2 ? TRUE : FALSE; } } if ($delete_perms == FALSE) { $data['data'] = _('Permission error') . ' - ' . _('Only admin can do that'); echo json_encode($data); exit; } if ($loguser == $user) { $data['data'] = _('Permission error') . ' - ' . _('A user can not remove himself'); echo json_encode($data); exit; } //Remove associated PDF report $uuid = Session::get_secure_id($user); $url = "/usr/share/ossim/www/tmp/scheduler/{$uuid}"; if (is_dir($url) && !empty($uuid)) { Util::execute_command('rm -r ?', array($url)); } //Deleting user's tabs User_config::delete_panels($conn, $user); //Deleting the user Session::delete_user($conn, $user); Util::memcacheFlush(); $db->close(); $data['status'] = 'OK'; $data['data'] = _('User removed successfully'); echo json_encode($data); exit;
for (var i=0;i<items.length;i++) { if (items[i].name.match("user") && items[i].checked == true) if (str == "") str = str+items[i].value; else str = str+','+items[i].value; } return str; } </script> </head> <body> <table width="100%"> <form name="fperms" method="POST"> <tr><th>Select users for document permissions</th></tr> <?php $user_perms = new User_config($conn); if (GET('user') != "") { $perms = $user_perms->get(GET('user'), "user_docs", 'php', "knowledgedb"); if ($perms == "") { $perms = array("admin" => 1, GET('user') => 1); } } else { $perms = array("admin" => 1); } $i = 1; foreach ($users as $user) { ?> <tr><td class="left"><input type="checkbox" name="user<?php echo $i; ?> " value="<?php
* - move_column() * - save_column_opts() * - draw_columns() * Classes list: */ require_once 'classes/Security.inc'; require_once 'classes/Session.inc'; require_once 'classes/Plugingroup.inc'; require_once 'classes/User_config.inc'; require_once 'classes/Event_viewer.inc'; require_once 'classes/Xajax.inc'; require_once 'ossim_db.inc'; Session::logcheck("MenuEvents", "EventsViewer"); $db = new ossim_db(); $conn = $db->connect(); $config = new User_config($conn); $login = Session::get_session_user(); $xajax = new xajax(); $xajax->registerFunction("draw_columns"); $xajax->registerFunction("draw_error"); $xajax->registerFunction("add_column"); $xajax->registerFunction("delete_column"); $xajax->registerFunction("move_column"); $xajax->registerFunction("save_column_opts"); $xajax->registerFunction("save"); $xajax->registerFunction("end_configuration"); function draw_error($error) { global $config, $login; $resp = new xajaxResponse(); //return xajax_debug($error, $resp);
$error->display("PASSWORD_ALPHANUM"); } elseif (POST("insert")) { require_once 'ossim_acl.inc'; require_once 'classes/Session.inc'; require_once 'classes/Net.inc'; $perms = array(); foreach ($ACL_MAIN_MENU as $menus) { foreach ($menus as $key => $menu) { if (POST($key) == "on") { $perms[$key] = true; } else { $perms[$key] = false; } } } User_config::copy_panel($conn, "admin", $user); $nets = ""; $nets_selected = POST("nets"); if (is_array($nets_selected)) { foreach ($nets_selected as $index => $net_name) { ossim_valid($net_name, OSS_ALPHA, OSS_PUNC, OSS_NULLABLE, 'illegal:' . _("net{$i}")); if (ossim_error()) { die(ossim_error()); } if ($net_list_aux = Net::get_list($conn, "name = '{$net_name}'")) { foreach ($net_list_aux as $net) { if ($nets == "") { $nets = $net->get_ips(); } else { $nets .= "," . $net->get_ips(); }
* On Debian GNU/Linux systems, the complete text of the GNU General * Public License can be found in `/usr/share/common-licenses/GPL-2'. * * Otherwise you can read it here: http://www.gnu.org/licenses/gpl-2.0.txt ****************************************************************************/ ini_set('session.bug_compat_warn', 'off'); require_once 'classes/Session.inc'; Session::logcheck("MenuPolicy", "5DSearch"); require_once 'classes/User_config.inc'; require_once 'classes/Util.inc'; require_once 'ossim_db.inc'; require_once 'ossim_conf.inc'; include "functions.php"; $db = new ossim_db(); $conn = $db->connect(); $config = new User_config($conn); $user = Session::get_session_user(); // Read config file with filters rules $rules = get_rulesconfig(); ossim_valid(GET('num'), OSS_DIGIT, OSS_NULLABLE, 'illegal:' . _("num")); ossim_valid(GET('operator'), "and", "or", OSS_NULLABLE, 'illegal:' . _("operator")); ossim_valid(GET('descr'), OSS_ALPHA, OSS_SPACE, OSS_DIGIT, OSS_NULLABLE, 'illegal:' . _("Description")); if (ossim_error()) { exit; } if (GET('inv_do') == "export") { $inv_session = array(); for ($i = 1; $i <= GET('num'); $i++) { $type = null; $subtype = null; $match = null;
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; }
$config_nt = array('content' => _("Invalid report type"), 'options' => array('type' => 'nf_error', 'cancel_button' => FALSE), 'style' => 'margin: 20px auto; width: 80%; text-align: center;'); $nt = new Notification('nt_1', $config_nt); $nt->show(); exit; } $addr_type = intval(GET('addr_type')); $type = array("33" => "Events", "38" => "Sensors", "36" => "Unique_Events", "46" => "Unique_Plugins", "40" => "Unique_Addresses", "42" => "Source_Port", "44" => "Destination_Port", "37" => "Unique_IP_links", "48" => "Unique_Country_Events"); $tz = Util::get_timezone(); $current_cols_titles = array("SIGNATURE" => _("Signature"), "ENTITY" => _("Context"), "DATE" => _("Date") . " " . Util::timezone($tz), "IP_PORTSRC" => _("Source"), "IP_PORTDST" => _("Destination"), "SENSOR" => _("Sensor"), "OTX" => _("OTX"), "IP_SRC" => _("Src IP"), "IP_DST" => _("Dst IP"), "IP_SRC_FQDN" => _("Src IP FQDN"), "IP_DST_FQDN" => _("Dst IP FQDN"), "PORT_SRC" => _("Src Port"), "PORT_DST" => _("Dst Port"), "ASSET" => _("Asset S->D"), "PRIORITY" => _("Prio"), "RELIABILITY" => _("Rel"), "RISK" => _("Risk"), "IP_PROTO" => _("L4-proto"), "USERDATA1" => _("Userdata1"), "USERDATA2" => _("Userdata2"), "USERDATA3" => _("Userdata3"), "USERDATA4" => _("Userdata4"), "USERDATA5" => _("Userdata5"), "USERDATA6" => _("Userdata6"), "USERDATA7" => _("Userdata7"), "USERDATA8" => _("Userdata8"), "USERDATA9" => _("Userdata9"), "USERNAME" => _("Username"), "FILENAME" => _("Filename"), "PASSWORD" => _("Password"), "PAYLOAD" => _("Payload"), "PLUGIN_ID" => _("Data Source ID"), "PLUGIN_SID" => _("Event Type ID"), "PLUGIN_DESC" => _("Data Source Description"), "PLUGIN_NAME" => _("Data Source Name"), "PLUGIN_SOURCE_TYPE" => _("Source Type"), "PLUGIN_SID_CATEGORY" => _("Category"), "PLUGIN_SID_SUBCATEGORY" => _("SubCategory"), 'SRC_USERDOMAIN' => _("IDM User@Domain Src IP"), 'DST_USERDOMAIN' => _("IDM User@Domain Dst IP"), 'SRC_HOSTNAME' => _("IDM Source"), 'DST_HOSTNAME' => _("IDM Destination"), 'SRC_MAC' => _("IDM MAC Src IP"), 'DST_MAC' => _("IDM MAC Dst IP"), 'REP_PRIO_SRC' => _("Rep Src IP Prio"), 'REP_PRIO_DST' => _("Rep Dst IP Prio"), 'REP_REL_SRC' => _("Rep Src IP Rel"), 'REP_REL_DST' => _("Rep Dst IP Rel"), 'REP_ACT_SRC' => _("Rep Src IP Act"), 'REP_ACT_DST' => _("Rep Dst IP Act"), 'DEVICE' => _("Device IP")); $user = $_SESSION["_user"]; $path_conf = $GLOBALS["CONF"]; /* database connect */ $db = new ossim_db(true); $conn = $db->connect(); //$conn = $db->custom_connect('localhost',$path_conf->get_conf("ossim_user"),$path_conf->get_conf("ossim_pass")); $config = new User_config($conn); $default_view = $config->get($login, 'custom_view_default', 'php', "siem") != "" ? $config->get($login, 'custom_view_default', 'php', "siem") : ($idm_enabled ? 'IDM' : 'default'); $output_name = $type[$rtype] . "_" . $user . "_" . date("Y-m-d", time()) . ".csv"; $csv_header = ""; $csv_body = ""; $var_data = Session::show_entities() ? "Context" : "Sensor"; if ($type[$rtype] == "Events") { $sql = "SELECT dataV1, dataV2, dataV11, dataV3, dataV5, dataV10, cell_data\n FROM datawarehouse.report_data WHERE id_report_data_type={$rtype} and user='******'"; if ($_SESSION['current_cview'] != $default_view) { foreach ($_SESSION['views'][$_SESSION['current_cview']]['cols'] as $colname) { if ($csv_header != "") { $csv_header .= ";"; } $csv_header .= $current_cols_titles[$colname]; } $csv_header .= "\n";
* Otherwise you can read it here: http://www.gnu.org/licenses/gpl-2.0.txt ****************************************************************************/ /** * Class and Function List: * Function list: * - get_icon() * Classes list: */ require_once 'classes/Security.inc'; require_once 'classes/Session.inc'; require_once 'classes/User_config.inc'; require_once 'ossim_db.inc'; Session::logcheck("MenuControlPanel", "ControlPanelExecutive"); $db = new ossim_db(); $conn = $db->connect(); $config = new User_config($conn); $login = Session::get_session_user(); $window_id = GET('window_id') ? GET('window_id') : die("invalid window_id"); ossim_valid($window_id, OSS_ALPHA, OSS_SCORE, OSS_NULLABLE, 'illegal:' . _("window_id")); if (ossim_error()) { die(ossim_error()); } if (preg_match('#/window_panel.php#', @$_SERVER['HTTP_REFERER'])) { $status = 'edit'; } elseif (preg_match('#host.php$#', @$_SERVER['HTTP_REFERER'])) { $status = 'set_marker_pos'; } else { $status = 'view'; } /* * Array
function PrintPredefinedViews() { global $opensource; $current_str = $_SESSION['current_cview'] != "default" && $_SESSION['current_cview'] != "" ? Util::htmlentities($_SESSION['current_cview']) : _("Default"); // Get default view require_once "ossim_conf.inc"; $conf = $GLOBALS["CONF"]; $idm_enabled = $conf->get_conf("enable_idm") == 1 && Session::is_pro() ? true : false; $login = Session::get_session_user(); $db_aux = new ossim_db(true); $conn_aux = $db_aux->connect(); $config = new User_config($conn_aux); $default_view = $config->get($login, 'custom_view_default', 'php', "siem") != "" ? $config->get($login, 'custom_view_default', 'php', "siem") : ($idm_enabled ? 'IDM' : 'default'); $db_aux->close($conn_aux); ?> <button id="views_link" class="button av_b_secondary"> <?php echo _('Change View'); ?> ▾ </button> <div id="custom_views" class="dropdown dropdown-secondary dropdown-close dropdown-tip dropdown-anchor-right dropdown-scrolling" style='display:none'> <ul id="custom_views_ul" class="dropdown-menu"> <?php if (Session::am_i_admin()) { ?> <li><a href="#" onclick="GB_show('<?php echo _("Edit Current View"); ?> ','/forensics/custom_view_edit.php?edit=1',480,700);$('#custom_views').hide();return false"><?php echo _("Edit Current View"); ?> </a></li> <li><a href="#" onclick="GB_show('<?php echo _("Create new custom view"); ?> ','/forensics/custom_view_edit.php',480,700);$('#custom_views').hide();return false"><?php echo _("Create New View"); ?> </a></li> <?php } foreach ($_SESSION['views'] as $name => $attr) { $dname = $name == "default" ? "Default" : $name; $selected = $_SESSION['current_cview'] == $name ? "► " : ""; ?> <li><a href="#" onclick="change_view('<?php echo Util::htmlentities($name); ?> ');$('#custom_views').hide()"><?php echo $selected . Util::htmlentities($dname); ?> </a></li> <?php } ?> </ul> </div> <?php }
function PrintPredefinedViews() { global $opensource; $current_str = $_SESSION['current_cview'] != "default" && $_SESSION['current_cview'] != "" ? " [<i>" . Util::htmlentities($_SESSION['current_cview']) . "</i>]" : ""; // Get default view require_once "ossim_conf.inc"; $conf = $GLOBALS["CONF"]; $idm_enabled = $conf->get_conf("enable_idm") == 1 && Session::is_pro() ? true : false; $login = Session::get_session_user(); $db_aux = new ossim_db(); $conn_aux = $db_aux->connect(); $config = new User_config($conn_aux); $default_view = $config->get($login, 'custom_view_default', 'php', "siem") != "" ? $config->get($login, 'custom_view_default', 'php', "siem") : ($idm_enabled ? 'IDM' : 'default'); $db_aux->close($conn_aux); ?> <a style='cursor:pointer' class='ndc riskinfo' txt="<?php echo _("Predefined Views") . $current_str; ?> " onclick="$('#views').css({top: -1*$('#views').outerHeight(true)}).toggle()"><img src="../pixmaps/forensic_views.png" border="0"/></a> <br/> <div style='position: absolute; height: 1px; width: 1px;'> <div id="views" style="position:absolute; right:-5px; top:0px; display:none;"> <table cellpadding='0' cellspacing='0' align="center" > <tr> <th style="padding-right:3px"> <table class="transparent" style="width:100%;background:none;border:none;height:30px !important"> <tr> <td width="10"></td> <td><?php echo _("Select View"); ?> </td> <td width="10"><a style="cursor:pointer; text-align: right;" onclick="$('#views').toggle()"><img src="../pixmaps/cross-circle-frame.png" alt="<?php echo _("Close"); ?> " title="<?php echo _("Close"); ?> " border="0" align='absmiddle'/></a></td> </tr> </table> </th> </tr> <tr class="noborder"> <td id="viewsbox" colspan='2'> <table class='container' cellpadding='0' cellspacing='0' style='border: none;'> <?php $i = 0; foreach ($_SESSION['views'] as $name => $attr) { $i++; //$color = ($i%2==0) ? "impar" : "par"; ?> <tr class='noborder'> <?php if ($_SESSION['current_cview'] == $name) { $style = 'font-weight: bold;'; $opacidad = ''; $boton0 = !$opensource && Session::am_i_admin() ? "<a style='cursor:pointer;' onclick=\"GB_show('" . _('Edit custom view') . "','/forensics/custom_view_edit.php?edit=1&forcesave=1',480,700);\"><img src='../pixmaps/documents-save.png' alt='" . _('Save as report module') . "' title='" . _('Save as report module') . "' border='0'/></a> " : ""; $boton1 = "<a style='cursor:pointer;' onclick=\"save_view('save_" . $i . "');\"><img id='save_" . $i . "' src='../pixmaps/disk-gray.png' alt='" . _('Update View') . "' title='" . _('Update View') . "' border='0'/></a> "; $boton2 = "<a style='cursor:pointer;' onclick=\"GB_show('" . _('Edit custom view') . "','/forensics/custom_view_edit.php?edit=1',480,700);\"><img src='../vulnmeter/images/pencil.png' alt='" . _('Modify') . "' title='" . _('Modify') . "' border='0'/></a>"; } else { $style = ''; $opacidad = 'opacity:0.4;filter:alpha(opacity=40);'; $boton0 = ""; $boton1 = "<img id='save_" . $i . "' src='../pixmaps/disk-gray.png' alt='" . _('Update View') . "' title='" . _('Update View') . "' border='0'/> "; $boton2 = "<img src='../vulnmeter/images/pencil.png' alt='" . _('Modify') . "' title='" . _('Modify') . "' border='0'/>"; } $dname = $name == "default" ? "Default" : $name; ?> <td class="noborder" style='height:28px'><a href="" onclick="set_default_view('<?php echo Util::htmlentities($name); ?> ');return false" title="<?php echo _("Save as default"); ?> " alt="<?php echo _("Save as default"); ?> "><img class="view_star" id="view_star_<?php echo Util::htmlentities($name); ?> " src="../pixmaps/star-small<?php if ($name != $default_view) { ?> -empty<?php } ?> .png" onmouseover="this.src = '../pixmaps/star-small.png'" onmouseout="this.src = ('<?php echo Util::htmlentities($name); ?> ' == default_view) ? '../pixmaps/star-small.png' : '../pixmaps/star-small-empty.png'" width="16" /></a></td> <td class="noborder" style="height:28px; white-space: nowrap; min-width: 90px; padding: 0px 20px 0px 5px; text-align: left;"><a style="cursor:pointer;<?php echo $style; ?> " onclick="change_view('<?php echo Util::htmlentities($name); ?> ');" id="view_<?php echo Util::htmlentities($name); ?> "><span><?php echo Util::htmlentities($dname); ?> </span></a></td> <td class="noborder" style="<?php echo $opacidad; ?> padding-right:5px;text-align:right;height:28px"><?php echo $boton0 . $boton1 . $boton2; ?> </td> <td class="noborder" style="height:28px;<?php if ($name == "default") { echo $opacidad; } ?> "><?php if ($name != "default") { ?> <a style="cursor:pointer" onclick="if(confirm('<?php echo Util::js_entities(_("Are you sure?")); ?> ')) delete_view('<?php echo Util::htmlentities($name); ?> ')"><img src="../pixmaps/delete.gif" border="0" alt="<?php echo _("Delete"); ?> " title="<?php echo _("Delete"); ?> "></img></a><?php } ?> </td> </tr> <?php } ?> </table> </td> </tr> <tr> <td style='text-align: center; padding: 4px; font-size: 10px;' class="noborder"> <input type="button" value="<?php echo _("Create New View"); ?> " onclick="GB_show('<?php echo _("Create new custom view"); ?> ','/forensics/custom_view_edit.php',480,700);"/> </td> </tr> </table> </div> </div> <?php }
function set_default_map($conn, $id) { ossim_valid($id, OSS_HEX, 'illegal:' . _('Map')); if (ossim_error()) { $info_error = "Error: " . ossim_get_error(); ossim_clean_error(); $return['error'] = TRUE; $return['msg'] = $info_error; return $return; } if (!is_map_editable($conn, $id)) { $return['error'] = TRUE; $return['msg'] = _("You do not have permission to edit this map"); return $return; } $login = Session::get_session_user(); $config = new User_config($conn); $config->set($login, "riskmap", $id, 'simple', "main"); $return['error'] = FALSE; $return['msg'] = _("Default map changed successfully"); return $return; }
* Otherwise you can read it here: http://www.gnu.org/licenses/gpl-2.0.txt ****************************************************************************/ require_once 'classes/Session.inc'; Session::logcheck("MenuPolicy", "5DSearch"); require_once 'classes/Host.inc'; require_once 'classes/User_config.inc'; require_once 'classes/Util.inc'; require_once 'ossim_db.inc'; require_once 'ossim_conf.inc'; include "functions.php"; // Database Object $db = new ossim_db(); $conn = $db->connect(); // Read config file with filters rules $rules = get_rulesconfig(); $config = new User_config($conn); $user = Session::get_session_user(); $data = $config->get_all($user, "inv_search"); $new = isset($_GET['new']) && !empty($_GET['new']) ? 1 : 0; $case = 1; if ($new === 1) { unset($_SESSION['inventory_search']); unset($_SESSION['inventory_last_search']); unset($_SESSION['inventory_last_descr']); unset($_SESSION['profile']); $current_profile = null; } else { $current_profile = !empty($_GET['profile']) ? $_GET['profile'] : $_SESSION['profile']; $_SESSION['profile'] = $current_profile; if (isset($_SESSION['inventory_last_search'])) { $case = 2;
$cond_1 = POST("menu_perm{$key}") == 'on'; $cond_2 = $perms_check[$mainmenu][$key] == TRUE; if ($cond_1 && $cond_2) { $perms[$key] = TRUE; } } } } if ($mode == 'insert') { $msg = 'created'; if ($insert_menu == TRUE) { //New template $template_id = Session::update_template($conn, $login . "_perms", $perms); } Session::insert($conn, $login, $login_method, $pass1, $user_name, $email, $template_id, $entities, $sel_sensors, $sel_assets, $company, $department, $language, $first_login, $tzone, $is_admin); User_config::copy_panel($conn, $login); $_SESSION['_user_vision'] = $pro ? Acl::get_user_vision($conn) : Session::get_user_vision($conn); Util::memcacheFlush(); Session::log_pass_history($login, hash('sha256', $pass1)); } else { $msg = 'updated'; if ($insert_menu == TRUE) { Session::update_template($conn, $login . '_perms', $perms, $template_id); } $error = 0; if (($am_i_admin || $am_i_proadmin) && !$is_my_profile) { Session::update($conn, $login, $login_method, $user_name, $email, $template_id, $entities, $sel_sensors, $sel_assets, $company, $department, $language, $first_login, $tzone, $is_admin); Util::memcacheFlush(); } else { $error = Session::update_user_light($conn, $login, $login_method, $user_name, $email, $company, $department, $language, $first_login, $is_admin, $tzone); if ($error == 0) {
* * You should have received a copy of the GNU General Public License * along with this package; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, * MA 02110-1301 USA * * * On Debian GNU/Linux systems, the complete text of the GNU General * Public License can be found in `/usr/share/common-licenses/GPL-2'. * * Otherwise you can read it here: http://www.gnu.org/licenses/gpl-2.0.txt * */ set_include_path('/usr/share/ossim/include'); require_once 'av_init.php'; $user = $argv[1]; $file = $argv[2]; $db = new ossim_db(); $conn = $db->connect(); $config = new User_config($conn); if (!preg_match("/^\\/var\\/tmp\\//", $file) && !preg_match("/^\\/tmp\\//", $file)) { echo "Error: 'file' parameter must be a valid /tmp file\n"; exit; } if (!file_exists($file)) { echo "Error: '{$file}' file does not exist\n"; exit; } $pid = @shell_exec("(cat '{$file}' | ossim-db; rm -f '{$file}'; echo 'flush_all' | /bin/nc -q 2 127.0.0.1 11211; sleep 1) > /tmp/alarm_bg_result 2>&1 & echo \$!"); $config->set($user, 'background_task', $pid, 'simple', 'alarm'); $db->close($conn);
} // 2 -> file perms (must be 0700) // 4 -> uid (must be the apache uid) // 5 -> gid (must be the apache gid) if ($stat[2] != 16832 || $stat[4] !== $uid || $stat[5] !== $gid) { $config_nt = array('content' => _("Invalid perms for configs dir") . $fix_cmd, 'options' => array('type' => 'nf_warning', 'cancel_button' => FALSE), 'style' => 'width: 80%; margin: 20px auto;'); $nt = new Notification('nt_1', $config_nt); $nt->show(); exit; } } check_writable_relative("./maps"); check_writable_relative("./pixmaps/uploaded"); $db = new Ossim_db(); $conn = $db->connect(); $config = new User_config($conn); $login = Session::get_session_user(); $default_map = $config->get($login, "riskmap", 'simple', 'main'); $default_map = $default_map == '' ? "00000000000000000000000000000001" : $default_map; $cnd_1 = !preg_match('/view\\.php/', $_SERVER['HTTP_REFERER']); $cnd_2 = empty($_GET['back_map']) && empty($_GET['map']); $cnd_3 = $_GET['map'] == $default_map || $_GET['back_map'] == $default_map; if ($cnd_1 || $cnd_2 || $cnd_3) { unset($_SESSION['default_riskmap']); unset($_SESSION['path_riskmaps']); unset($_SESSION['riskmap']); } $_SESSION['default_riskmap'] = $default_map; $map = $_GET['map'] != '' ? $_GET['map'] : $default_map; $map = $_GET['back_map'] != '' ? $_GET['back_map'] : $map; if (empty($_GET['back_map'])) {
function setPanelTabs($tabs, $user = null) { $db = new ossim_db(); $conn = $db->connect(); $config = new User_config($conn); if ($user == null) { $login = Session::get_session_user(); } else { $login = $user; } $config->set($login, 'panel_tabs', $tabs, 'php'); }
if (!($stat = stat($dir))) { die(_("Could not stat configs dir") . $fix_cmd); } // 2 -> file perms (must be 0700) // 4 -> uid (must be the apache uid) // 5 -> gid (must be the apache gid) if ($stat[2] != 16832 || $stat[4] !== $uid || $stat[5] !== $gid) { die(_("Invalid perms for configs dir") . $fix_cmd); } } check_writable_relative("./maps"); check_writable_relative("./pixmaps/uploaded"); require_once 'classes/Security.inc'; $db = new ossim_db(); $conn = $db->connect(); $config = new User_config($conn); $login = Session::get_session_user(); $default_map = $config->get($login, "riskmap", 'simple', 'main'); if ($default_map == "") { $default_map = 1; } $map = $_GET["map"] != "" ? $_GET["map"] : $default_map; $_SESSION["riskmap"] = $map; if ($_GET['default'] != "" && $map != "") { $config->set($login, "riskmap", $map, 'simple', "main"); } $hide_others = 1; ossim_valid($map, OSS_DIGIT, 'illegal:' . _("type")); if (ossim_error()) { die(ossim_error()); }
/** * This function returns the current map selected by the user * * @param object $conn Database access object * * @return string */ function get_current_map($conn) { $map = ''; if (GET('back_map') != '') { $map = GET('back_map'); } elseif (POST('map') != '') { $map = POST('map'); } elseif (GET('map') != '') { $map = GET('map'); } elseif ($_SESSION['riskmap'] != '') { $map = $_SESSION['riskmap']; } else { $config = new User_config($conn); $user = Session::get_session_user(); $map = $config->get($user, 'riskmap', 'simple', 'main'); if (empty($map)) { //No default map selected, we get the first available map $map = get_first_map_available($conn); } } return $map; }
break; case 'up': $directive_editor->up($dom, $rule, &$tab_rules, $direct); break; case 'down': $directive_editor->down($dom, $rule, &$tab_rules, $direct); break; } $directive_editor->save_xml($filepath, $dom, "DOMXML"); } } // Get columns $columns = array("name" => _("Name"), "reliability" => _("Reliability"), "time_out" => _("Timeout"), "occurrence" => _("Occurrence"), "from" => _("From"), "to" => _("To"), "plugin_id" => _("Data Source"), "plugin_sid" => _("Event Type"), "sensor" => _("Sensor"), "protocol" => _("Protocol"), "sticky_different" => _("Sticky Dif"), "username" => _("Username"), "password" => _("Pass"), "userdata1" => _("Userdata1"), "userdata2" => _("Userdata2"), "userdata3" => _("Userdata3"), "userdata4" => _("Userdata4"), "userdata5" => _("Userdata5"), "userdata6" => _("Userdata6"), "userdata7" => _("Userdata7"), "userdata8" => _("Userdata8"), "userdata9" => _("Userdata9")); $db = new ossim_db(); $conn = $db->connect(); $config = new User_config($conn); $columns_arr = $config->get(Session::get_session_user(), 'directive_editor_cols', 'php', 'directives'); if (count($columns_arr) < 1) { $columns_arr = array("name", "reliability", "time_out", "occurrence", "from", "to", "plugin_id", "plugin_sid"); } $rules = $directive_editor->get_rules($directive_id, $file); ?> <table width="100%" cellspacing="0"> <tr><td><table class="transparent" cellpadding="0" cellspacing="0"><tr><td style="padding:3px;text-align:left"><a href="" onclick="toggle_directive_rulelist(<?php echo $directive_id; ?> );return false" class='uppercase'><img id="rulelist_arrow_<?php echo $directive_id; ?> " src="../pixmaps/arrow_green_down.gif" align="absmiddle" border="0"/> <b><?php echo _("Rules");
/** * Set user config * * @param $key * @param $value * @param null $access_token_id * @return bool|User_config * @throws Exception */ public function setConfig($key, $value, $access_token_id = null) { $config = Config::get_by_key($key); if (!$config->id) { throw new Exception('There is no config with this key'); } if (!($userConfig = $this->ifUserHasConfig($key, $access_token_id))) { $userConfig = new User_config(); } $userConfig->value = $value; $userConfig->access_token_id = $access_token_id; $userConfig->save(array('user' => $this, 'config' => $config)); return $userConfig; }