Example #1
0
$fnd = array();
if (preg_match("/(.*=)(.*\\|)(.*)/", $str, $fnd)) {
    $prev = $fnd[2];
    $str = $fnd[1] . $fnd[3];
}
$data = array();
$top = 10;
$tag_typing = 0;
if (trim($str) != "") {
    list($sensors, $hosts) = Host::get_ips_and_hostname($conn);
    $nets = Net::get_list($conn);
    $plugins = GetPlugins($conn);
    $sourcetypes = GetSourceTypes($conn);
    $plugingroups = Plugingroup::get_list($conn);
    $ports = Port::get_list($conn);
    $categories = GetPluginCategories($conn);
    $subcategories = GetPluginSubCategories($conn, $categories);
    // Typing a tag
    if (preg_match("/^(sensor|src|dst|plugin|datasource|plugingroup|dsgroup|src_port|dst_port|product_type|event_category|category|data)(\\!?\\=)(.*)/i", $str, $found)) {
        $tag_typing = 1;
        $str = $found[3];
        $op = $found[2];
        if ($str == "") {
            $str = ".";
        }
        $qstr = $str;
        if ($found[1] == "sensor") {
            foreach ($sensors as $ip => $name) {
                if ((preg_match("/^{$qstr}/i", $name) || preg_match("/^{$qstr}/i", $ip)) && !preg_match("/{$name}/i", $fnd[2]) && count($data) < $top && $current_query["sensor{$op}{$ip}"] == "") {
                    $data[] = array("name" => "<b>sensor</b>{$op}{$prev}{$name}");
                }
function calculate_combinatory($type, $sql, $dbconn)
{
    $num = 0;
    switch ($type) {
        case "1":
            $num = 1;
            break;
        case "2":
            $categories = GetPluginCategories($dbconn, $sql);
            $num += count($categories);
            /*
            foreach ($categories as $k => $categorie)
            {
                $subcategories= GetPluginSubCategory($dbconn,$k, $sql);
                $num += count($subcategories);
                $num++;
            }
            */
            $num++;
            break;
        case "3":
            $sourcetypes = GetSourceTypes($dbconn);
            foreach ($sourcetypes as $sourcetype) {
                $sql = " AND product_type.name='" . $sourcetype . "'";
                $categories = GetPluginCategories($dbconn, $sql);
                //$num+= count($categories);
                $num++;
                /*
                foreach ($categories as $k => $categorie)
                {
                    $subcategories= GetPluginSubCategory($dbconn,$k, $sql);
                    $num += count($subcategories);
                    $num++;
                }
                */
            }
            $num++;
            break;
        case "4":
            $num = count(GetSourceTypes($dbconn)) + 1;
            break;
    }
    return $num;
}
Example #3
0
        echo "<option value=\"{$srctype}\"" . ($_SESSION["sourcetype"] == $srctype ? " selected" : "") . ">{$srctype}</option>\n";
    }
    ?>
																	</select>
																</div>
															</div>
														
															<div style='text-align: left; padding-bottom: 15px; clear: both;'>
																<div style='float: left; width:90px;'><?php 
    echo _("Event Category");
    ?>
:</div>
																<div style='float: left;'>
																	<select name="category[0]" id="category" class="selectp" style="width:155px" onchange="$('input[name=plugin]').val('');this.form.bsf.click()"><option value=''></option> 
																	<?php 
    $categories = GetPluginCategories($db);
    foreach ($categories as $idcat => $category) {
        echo "<option value=\"{$idcat}\"" . ($_SESSION["category"][0] != 0 && $_SESSION["category"][0] == $idcat ? " selected" : "") . ">{$category}</option>\n";
    }
    ?>
																	</select>
																</div>
															</div>
														
															<div style='text-align: left; padding-bottom: 15px; clear: both;'>
																<div style='float: left; width:90px;'><?php 
    echo _("Sub-Category");
    ?>
:</div>
																<div style='float: left;'>
																	<?php