exit;
 } else {
     if (!$rs->EOF) {
         if ($rs->fields['template_sensors'] > 0 || $rs->fields['template_assets'] > 0 || $rs->fields['template_menus'] > 0 || $rs->fields['template_policies'] > 0 || $rs->fields['inherit_sensors'] > 0 || $rs->fields['inherit_assets'] > 0 || $rs->fields['inherit_menus'] > 0 || $rs->fields['inherit_policies'] > 0) {
             continue;
         }
     } else {
         echo "User '{$login}' not found.\n";
         continue;
     }
 }
 echo "User '{$login}' has OpenSource perms. Trying to migrate...\n";
 foreach ($net_list as $net) {
     $net_cidr = $net['ips'];
     $net_name = $net['name'];
     if (false !== strpos(Session::allowedNets($login), $net_cidr)) {
         if ($nets == "") {
             $nets = $net_cidr;
         } else {
             $nets .= "," . $net_cidr;
         }
     }
 }
 foreach ($sensor_list as $sensor) {
     $sensor_name = $sensor['name'];
     $sensor_ip = $sensor['ip'];
     if (false !== strpos(Session::allowedSensors($login), $sensor_ip)) {
         if ($sensors == "") {
             $sensors = $sensor_ip;
         } else {
             $sensors .= "," . $sensor_ip;
Example #2
0
ossim_valid($range, OSS_ALPHA, OSS_NULLABLE, 'illegal:' . _("range"));
if (ossim_error()) {
    die(ossim_error());
}
$conf = $GLOBALS['CONF'];
$conf_threshold = $conf->get_conf('threshold');
$db = new ossim_db();
$conn = $db->connect();
//ajax_set_values();
$host_qualification_cache = get_host_qualification($conn);
$net_qualification_cache = get_net_qualification($conn);
////////////////////////////////////////////////////////////////
// Network Groups
////////////////////////////////////////////////////////////////
// If allowed_nets === null, then permit all
$allowed_nets = Session::allowedNets($user);
if ($allowed_nets) {
    $allowed_nets = explode(',', $allowed_nets);
}
$allowed_sensors = Session::allowedSensors($user);
if ($allowed_sensors) {
    $allowed_sensors = explode(',', $allowed_sensors);
}
$net_where = "";
if ($allowed_sensors != "" || $allowed_nets != "") {
    $nets_aux = Net::get_list($conn);
    $networks_str = "";
    foreach ($nets_aux as $net) {
        $networks_str .= $networks_str != "" ? ",'" . $net->get_name() . "'" : "'" . $net->get_name() . "'";
    }
    if ($networks_str != "") {
Example #3
0
    </tr>
	
	<tr>
		<td class="nobborder" valign="top" style="padding-top:8px">
			<table>
				 <tr>
					<td class="left nobborder">
						<select style="width:100%;height:90%" multiple="multiple" size="19" name="nets[]" id="nets">
						<?php 
/* ===== Networks ==== */
foreach ($net_list as $net) {
    $net_name = $net->get_name();
    $net_ips = $net->get_ips();
    $cidrs = explode(",", $net_ips);
    foreach ($cidrs as $cidr) {
        if (false !== strpos(Session::allowedNets($user->get_login()), $net_ips)) {
            echo "<option value='{$net_name}'>{$net_name} ({$net_ips})</option>";
        }
    }
}
?>
						</select>
					</td>
				</tr>
				<tr>
					<td class="nobborder" style="text-align:right">
					<input type="button" value=" [X] " onclick="deletefrom('nets')" class="lbutton"/>
					<input type="button" style="margin-right:0px;" value="<?php 
echo gettext("Clean All Nets");
?>
" onclick="deleteall('nets')" class="lbutton"/>
Example #4
0
if (isset($_GET['numnets']) && is_numeric($_GET['numnets'])) {
    $numnets = $_GET['numnets'];
} else {
    $numnets = "10";
}
//Refresh interval
if (isset($_GET['refresh']) && is_numeric($_GET['refresh'])) {
    $refresh = $_GET['refresh'];
} else {
    $refresh = 2;
}
$db = new ossim_db();
$conn = $db->connect();
$nets_where = "";
if (Session::allowedNets() != "") {
    $nets = explode(",", Session::allowedNets());
    foreach ($nets as $net) {
        $nets_where .= $nets_where != "" ? " OR net_name=\"" . Net::get_name_by_ip($conn, $net) . "\"" : " WHERE net_name=\"" . Net::get_name_by_ip($conn, $net) . "\"";
    }
}
$query = "select * from net_qualification{$nets_where} order by (compromise+attack)/2 desc limit {$numnets};";
if (!($rs =& $conn->Execute($query))) {
    print $conn->ErrorMsg();
    exit;
}
$addresses = array();
$compromise = array();
$attack = array();
$i = 0;
$addresses[$i] = "Nets";
$compromise[$i] = "Compromise";
 function Import()
 {
     parent::Import();
     require dirname(__FILE__) . '/../base_conf.php';
     $vals = NULL;
     $empty = 1;
     /* expand IP into octets */
     $this->criteria = $_SESSION['ip_addr'];
     $this->criteria_cnt = $_SESSION['ip_addr_cnt'];
     for ($i = 0; $i < $this->criteria_cnt; $i++) {
         if (isset($this->criteria[$i][3]) && ereg("([0-9]*)\\.([0-9]*)\\.([0-9]*)\\.([0-9]*)", $this->criteria[$i][3])) {
             if ($use_ossim_session && Session::allowedNets()) {
                 require_once 'classes/Net.inc';
                 $domain = Session::allowedNets();
                 if ($domain != "") {
                     $tmp_myip = $this->criteria[$i][3];
                     $myip = strtok($tmp_myip, "/");
                     if (Net::isIpInNet($myip, $domain)) {
                         $tmp_ip_str = $this->criteria[$i][7] = $this->criteria[$i][3];
                         $this->criteria[$i][2] = "=";
                         $this->criteria[$i][3] = strtok($tmp_ip_str, ".");
                         $this->criteria[$i][4] = strtok(".");
                         $this->criteria[$i][5] = strtok(".");
                         $this->criteria[$i][6] = strtok("/");
                         $this->criteria[$i][10] = strtok("");
                         $empty = 0;
                         $vals[] = $this->criteria[$i];
                     }
                 }
             } else {
                 $tmp_ip_str = $this->criteria[$i][7] = $this->criteria[$i][3];
                 $this->criteria[$i][3] = strtok($tmp_ip_str, ".");
                 $this->criteria[$i][4] = strtok(".");
                 $this->criteria[$i][5] = strtok(".");
                 $this->criteria[$i][6] = strtok("/");
                 $this->criteria[$i][10] = strtok("");
                 $empty = 0;
                 $vals[] = $this->criteria[$i];
             }
         } elseif (is_array($this->criteria[$i]) && array_key_exists(7, $this->criteria[$i]) && ereg("([0-9]*)\\.([0-9]*)\\.([0-9]*)\\.([0-9]*)", $this->criteria[$i][7])) {
             $empty = 0;
             $vals[] = $this->criteria[$i];
         }
     }
     //print_r ($this->criteria);
     $this->criteria = $vals;
     $this->criteria_cnt = count($vals);
     if ($use_ossim_session && $empty) {
         $domain = Session::allowedNets();
         if ($domain != "") {
             $nets = explode(",", $domain);
             $this->criteria = array();
             for ($i = 0; $i < count($nets); $i++) {
                 $tmp_ip_str = $tmp[7] = $nets[$i];
                 $tmp[0] = " ";
                 $tmp[1] = "ip_both";
                 $tmp[2] = "=";
                 $tmp[3] = strtok($tmp_ip_str, ".");
                 $tmp[4] = strtok(".");
                 $tmp[5] = strtok(".");
                 $tmp[6] = strtok("/");
                 $tmp[10] = strtok("");
                 $tmp[8] = " ";
                 if ($i == count($nets) - 1) {
                     $tmp[9] = " ";
                 } else {
                     $tmp[9] = "OR";
                 }
                 $this->criteria[$this->criteria_cnt] = $tmp;
                 $this->criteria_cnt++;
             }
         }
     }
     $new = ImportHTTPVar("new", VAR_DIGIT);
     $submit = ImportHTTPVar("submit", VAR_ALPHA | VAR_SPACE);
     if ($new == 1 && $submit == "") {
         $this->criteria = NULL;
         $this->criteria_cnt = 1;
     }
     if ($this->criteria_cnt == "") {
         $this->criteria_cnt = 1;
     }
     //print_r ($this->criteria);
     $_SESSION['ip_addr'] =& $this->criteria;
     $_SESSION['ip_addr_cnt'] =& $this->criteria_cnt;
 }
Example #6
0
$db = new ossim_db();
$conn = $db->connect();
if ($debug) {
    echo "Retrieving Assets from entity/user: {$filter_by}...";
}
$allowedNets = "";
$allowedSensors = "";
if ($filter_by != "") {
    // Entity
    if (preg_match("/^\\d+\$/", $filter_by)) {
        $allowedSensors = Session::entityPerm($conn, $filter_by, "sensors");
        $allowedNets = Session::entityPerm($conn, $filter_by, "assets");
        // Username
    } elseif (preg_match("/^[A-Za-z0-9\\_\\-\\.]+\$/", $filter_by)) {
        $allowedSensors = Session::allowedSensors($filter_by);
        $allowedNets = Session::allowedNets($filter_by);
    }
}
if ($allowedNets == "" && $allowedSensors == "") {
    if ($debug) {
        echo "no filters for {$filter_by}\n";
    }
} else {
    // 1) GET ALLOWED HOSTS
    $sensor_where = "";
    if ($allowedSensors != "") {
        $user_sensors = explode(",", $allowedSensors);
        $sensor_str = "";
        foreach ($user_sensors as $user_sensor) {
            if ($user_sensor != "") {
                $sensor_str .= ($sensor_str != "" ? "," : "") . "'" . $user_sensor . "'";