Example #1
0
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;
}
Example #2
0
function delete_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;
    }
    $map_name = "map" . $id . ".jpg";
    if (getimagesize("maps/{$map_name}")) {
        unlink("maps/{$map_name}");
        //Deleting the indicators that appear in the map to be deleted.
        $query = "DELETE FROM risk_indicators WHERE map=unhex(?)";
        $params = array($id);
        $result = $conn->Execute($query, $params);
        //Deleting the indicator that are linking to the map to be deleted.
        $query = "DELETE FROM risk_indicators WHERE url='view.php?map={$id}'";
        $result = $conn->Execute($query);
        //Deleting the map.
        $query = "DELETE FROM risk_maps WHERE map=unhex(?)";
        $params = array($id);
        $result = $conn->Execute($query, $params);
        $config = new User_config($conn);
        $login = Session::get_session_user();
        $default_map = $config->get($login, "riskmap", 'simple', 'main');
        if (strcasecmp($default_map, $id) == 0) {
            $map = get_map($conn, '00000000000000000000000000000001');
            if (!empty($map)) {
                set_default_map($conn, $map);
            }
        }
        $return['error'] = FALSE;
        $return['msg'] = _("Map deleted successfully");
        return $return;
    }
    $return['error'] = TRUE;
    $return['msg'] = _("The map couldn't be deleted");
    return $return;
}
Example #3
0
*
*/
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');
} elseif ($_SESSION['_db_show_edit'] != "") {
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');
    ?>
 &nbsp;&#x25be;
    </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");
        ?>
&nbsp;</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");
        ?>
&nbsp;</a></li>
            <?php 
    }
    foreach ($_SESSION['views'] as $name => $attr) {
        $dname = $name == "default" ? "Default" : $name;
        $selected = $_SESSION['current_cview'] == $name ? "&#x25BA;&nbsp;" : "";
        ?>
                <li><a href="#" onclick="change_view('<?php 
        echo Util::htmlentities($name);
        ?>
');$('#custom_views').hide()"><?php 
        echo $selected . Util::htmlentities($dname);
        ?>
&nbsp;</a></li>
            <?php 
    }
    ?>
        </ul>
    </div>

    <?php 
}
Example #5
0
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)) {
            $name = $found[1] . $found[2] . $found[3] . $found[4];
Example #6
0
$action = POST("action");
$data = POST("data");
ossim_valid($action, OSS_DIGIT, 'illegal:' . _('Action'));
if (ossim_error()) {
    $response['error'] = TRUE;
    $response['msg'] = ossim_get_error();
} else {
    if (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') {
        switch ($action) {
            case 1:
                $response = delete_map($conn, $data);
                if ($return['error'] == FALSE) {
                    unset($_SESSION['riskmap']);
                    $config = new User_config($conn);
                    $user = Session::get_session_user();
                    $default_map = $config->get($user, "riskmap", 'simple', 'main');
                    if (strcasecmp($default_map, $data) == 0) {
                        //Save new default map in the PHP Session
                        $map = get_first_map_available($conn);
                        if (map_exists($map)) {
                            $_SESSION['riskmap'] = $map;
                            set_default_map($conn, $map);
                        }
                    }
                }
                break;
            case 2:
                $response = set_default_map($conn, $data);
                //Save default map in the PHP Session
                if ($return['error'] == FALSE) {
                    $_SESSION['riskmap'] = $data;
Example #7
0
        $inv_session['data'][$i] = $_SESSION['inventory_last_search'][$i];
    }
    $inv_session['op'] = $_SESSION['inventory_last_search_op'];
    $serialized_inv = serialize($inv_session);
    $name = mb_detect_encoding(GET('name') . " ", 'UTF-8,ISO-8859-1') == 'UTF-8' ? GET('name') : mb_convert_encoding(GET('name'), 'ISO-8859-1', 'UTF-8');
    $name = Util::utf8entities($name);
    $_SESSION['profile'] = base64_encode($name);
    $name = mb_convert_encoding($name, 'UTF-8', 'ISO-8859-1');
    $config->set($user, $name, $serialized_inv, 'simple', "inv_search");
    echo "1###" . $_SESSION['profile'];
} elseif (GET('inv_do') == "import") {
    $profile_name = base64_decode(GET('name'));
    $name = mb_detect_encoding($profile_name . " ", 'UTF-8,ISO-8859-1') == 'UTF-8' ? $profile_name : mb_convert_encoding($profile_name, 'UTF-8', 'ISO-8859-1');
    $name = Util::utf8entities($name);
    $name = mb_convert_encoding($name, 'ISO-8859-1', 'UTF-8');
    $data = $config->get($user, $name, 'php', "inv_search");
    if (!is_array($data) || empty($data)) {
        exit;
    }
    echo "{\"dt\":[";
    $coma = "";
    foreach ($data['data'] as $i => $filter) {
        echo $coma;
        $value = null;
        $value2 = null;
        $value = mb_detect_encoding($filter['value'] . " ", 'UTF-8,ISO-8859-1') == 'UTF-8' ? $filter['value'] : mb_convert_encoding($filter['value'], 'UTF-8', 'ISO-8859-1');
        $value2 = mb_detect_encoding($filter['value2'] . " ", 'UTF-8,ISO-8859-1') == 'UTF-8' ? $filter['value2'] : mb_convert_encoding($filter['value2'], 'UTF-8', 'ISO-8859-1');
        echo "{\"type\":\"" . $filter['type'] . "\",\"subtype\":\"" . $filter['subtype'] . "\",\"match\":\"" . $filter['match'] . "\",\"value\":\"" . $value . "\",\"value2\":\"" . $value2 . "\"}";
        $coma = ",";
    }
    $description = mb_detect_encoding($data['description'] . " ", 'UTF-8,ISO-8859-1') == 'UTF-8' ? $data['description'] : mb_convert_encoding($data['description'], 'UTF-8', 'ISO-8859-1');
Example #8
0
    $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"]);
}
Example #9
0
/**
 * 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;
}
Example #10
0
 function getPanelTabs($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;
     }
     $tabs = $config->get($login, 'panel_tabs', 'php');
     if ($tabs == null) {
         return false;
     } else {
         return $tabs;
     }
     // Save a var into the database as a serialized PHP var
 }
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>&nbsp;" : "";
            $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>&nbsp;";
            $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'/>&nbsp;";
            $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 
}
Example #12
0
} else {
    $status = 'view';
}
/*
* Array
(
[map_type] => virtual_earth
[lon] => 0
[lat] => 0
[zoom] => 0
[controls] => 0
[max-zoom] => 0
[min-zoom] => 15
)
*/
$opts = $config->get($login, $window_id, 'php', 'panel');
if (!$opts) {
    die(ossim_error(_("Map configuration not found, please configure a map using the Executive Panel")));
}
$zoom_js = "minZoomLevel: {$opts['max-zoom']}, maxZoomLevel: {$opts['min-zoom']}";
function get_icon($metric_a, $threshold_a, $metric_c, $threshold_c)
{
    $risk_a = round($metric_a / $threshold_a * 100);
    $risk_c = round($metric_c / $threshold_c * 100);
    $risk = $risk_a > $risk_c ? $risk_a : $risk_c;
    if ($risk > 500) {
        $icon = 'marker.png';
    } elseif ($risk > 300) {
        $icon = 'marker-gold.png';
    } elseif ($risk > 100) {
        $icon = 'marker-gold.png';
Example #13
0
/**
* 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"/>
  <link rel="stylesheet" type="text/css" href="../style/datepicker.css"/>
  
Example #14
0
			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 
    echo $user->get_login();
    ?>
Example #15
0
    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');
}
Example #16
0
    }
    // 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());
}
$perms = array();
$query = "SELECT map,perm FROM risk_maps";
Example #17
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;
}
Example #18
0
            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");
?>
Example #19
0
    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 */
$config = new Config();