Exemple #1
0
    $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"]);
}
// resolv host2ip if needed
if ($_GET["search_str"] != "" && preg_match("/.*IP/", $_GET["submit"]) && !preg_match("/\\d+\\.\\d+(\\.\\d+\\.\\d+)?/", $_GET["search_str"])) {
    include_once "classes/Host.inc";
    $_GET["search_str"] = Host::hostname2ip($conn_aux, $_GET["search_str"], true);
}
$db_aux->close($conn_aux);
if ($_SESSION['view_name_changed']) {
    $_GET['custom_view'] = $_SESSION['view_name_changed'];
    $_SESSION['view_name_changed'] = "";
    $_SESSION['norefresh'] = 1;
} else {
    $_SESSION['norefresh'] = "";
}
$custom_view = $_GET['custom_view'];
if ($custom_view != "") {
    $_SESSION['current_cview'] = $custom_view;
    if (is_array($_SESSION['views'][$custom_view]['data'])) {
        foreach ($_SESSION['views'][$custom_view]['data'] as $skey => $sval) {
            if (!preg_match("/^(_|alarms_|back_list|current_cview|views|ports_cache|acid_|report_|graph_radar|siem_event|deletetask|mdspw).*/", $skey)) {
Exemple #2
0
$assets_aux = !empty($assets) ? explode(" ", trim($assets)) : array();
$assets = null;
$db = new ossim_db();
$conn = $db->connect();
foreach ($assets_aux as $k => $v) {
    $aux = null;
    if (!preg_match('/,/', $v)) {
        $aux = array($v);
    } else {
        $aux = explode(",", $v);
    }
    foreach ($aux as $i => $j) {
        $j = trim($j);
        ossim_valid($j, OSS_IP_ADDRCIDR, 'illegal:' . _("Assets"));
        if (ossim_error()) {
            $ip_cidr = Host::hostname2ip($conn, $j);
            $ip_cidr = empty($ip_cidr) ? Net::get_ips_by_name($conn, $j) : $ip_cidr . "/32";
            if (empty($ip_cidr)) {
                $info_error[] = ossim_get_error();
                $error = true;
                break;
            } else {
                $aux[$i] = $ip_cidr;
            }
        } else {
            if (!preg_match('/\\//', $j)) {
                $aux[$i] = $j . "/32";
            }
        }
        ossim_clean_error();
    }
Exemple #3
0
} elseif ($date_from == date('Y-m-d', strtotime("-1 year")) && $date_to == date('Y-m-d', time())) {
    $type_active = 'lastYear';
} else {
    $type_active = 'null';
}
require_once 'ossim_db.inc';
require_once 'ossim_conf.inc';
// Database Object
$db = new ossim_db();
$conn = $db->connect();
$conn_snort = $db->snort_connect();
if ($host == $hostname && preg_match('/^(\\d+)\\.(\\d+)\\.(\\d+)\\.(\\d+)$/', $host)) {
    $hostname = Host::ip2hostname($conn, $host);
}
if ($host == "" && $hostname != "") {
    $host = Host::hostname2ip($conn, $hostname);
}
if ($host == "" && GET('netname') != "") {
    $aux_list = Net::get_list($conn, "name='" . GET('netname') . "'");
    $host = preg_replace("/,.*/", "", $aux_list[0]->get_ips());
}
$hostname = "Host";
$_SESSION['host_report'] = $host;
$network = 0;
if (preg_match("/\\/\\d+/", $host)) {
    $network = 1;
}
if ($network) {
    require_once 'classes/Net.inc';
    require_once 'classes/Net_scan.inc';
    $netaux = Net::get_list($conn, "name='" . Net::get_name_by_ip($conn, $host) . "'");
Exemple #4
0
     $info_error[] = ossim_get_error();
     ossim_clean_error();
     $error = true;
 }
 // destinations
 if ($dst != "") {
     $all_destinations = explode("\n", $dst);
     $tdestinations = array();
     // sources for tshark
     foreach ($all_destinations as $destination) {
         $destination = trim($destination);
         $destination_type = null;
         if (ossim_error() == false) {
             if (!preg_match("/\\//", $destination)) {
                 if (!preg_match('/^(\\d+)\\.(\\d+)\\.(\\d+)\\.(\\d+)$/', $destination)) {
                     $destination = Host::hostname2ip($dbconn, $destination, true);
                 }
                 // resolve to ip
                 ossim_valid($destination, OSS_IP_ADDR, 'illegal:' . _("Destination ip"));
                 $destination_type = 'host';
             } else {
                 ossim_valid($destination, OSS_IP_CIDR, 'illegal:' . _("Destination cidr"));
                 $destination_type = 'net';
             }
         }
         if (ossim_error()) {
             $info_error[] = ossim_get_error();
             ossim_clean_error();
             $error = true;
         } else {
             if ($destination_type == 'host') {