if ($nump == 0) {
    $nump = 500;
}
if (GET('action') == 'edit') {
    $group_id = GET('id');
    $delete_id = GET('delete');
    ossim_valid($group_id, OSS_DIGIT, 'illegal:ID');
    ossim_valid($delete_id, OSS_DIGIT, OSS_NULLABLE, 'illegal:delete');
    if (ossim_error()) {
        die(ossim_error());
    }
    if ($delete_id != "") {
        Plugingroup::delete_plugin_id($conn, $group_id, $delete_id);
    }
    $where = "plugin_group_descr.group_id={$group_id}";
    $list = Plugingroup::get_list($conn, $where);
    if (count($list) != 1) {
        die(_("Empty DS Group ID"));
    }
    $plug_ed = $list[0];
    $name = $plug_ed->get_name();
    $descr = $plug_ed->get_description();
    $plugs = $plug_ed->get_plugins();
} else {
    $group_id = $name = $descr = null;
    ossim_valid(GET('pname'), OSS_ALPHA, OSS_PUNC, OSS_SPACE, OSS_NULLABLE, 'illegal:Name');
    ossim_valid(GET('pdesc'), OSS_ALPHA, OSS_PUNC, OSS_SPACE, OSS_NULLABLE, 'illegal:Name');
    if (ossim_error()) {
        die(ossim_error());
    }
    $name = GET('pname');
示例#2
0
     if ($name != "") {
         $ports[] = $name;
     }
 }
 if (!count($ports)) {
     die(ossim_error(_("At least one Port required")));
 }
 /* plugin groups */
 $plug_groups = array();
 $plug_ids = array();
 $plugins = POST('plugins');
 if ($plugins) {
     foreach ($plugins as $group_id => $on) {
         ossim_valid($group_id, OSS_DIGIT, 'illegal:' . _("Plugin Group ID"));
         $plug_groups[] = $group_id;
         $ids = Plugingroup::get_list($conn, "plugin_group.group_id={$group_id}");
         if ($ids[0]) {
             foreach ($ids[0]->get_plugins() as $plg) {
                 $plug_ids[] = $plg['id'];
             }
         }
     }
 }
 if (!count($plug_groups)) {
     die(ossim_error(_("At least one plugin group required")));
 }
 if (ossim_error()) {
     die(ossim_error());
 }
 /* sensors */
 $sensors = array();
示例#3
0
}
$prev = "";
$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}"] == "") {
示例#4
0
        die($conn->ErrorMsg());
    }
    if (intval(POST('pluginid')) > 0) {
        header("Location: modifyplugingroupsform.php?action=edit&id={$group_id}" . (GET('withoutmenu') == "1" ? "&withoutmenu=1" : ""));
        exit;
    }
    //
    // Delete group
    //
} elseif (GET('action') == 'delete') {
    $group_id = GET('id');
    ossim_valid($group_id, OSS_DIGIT, 'illegal:ID');
    if (ossim_error()) {
        die(ossim_error());
    }
    if (Plugingroup::can_delete($conn, $group_id)) {
        $conn->StartTrans();
        $conn->Execute("DELETE FROM plugin_group WHERE group_id={$group_id}");
        $conn->Execute("DELETE FROM policy_plugin_group_reference WHERE group_id={$group_id}");
        $conn->Execute("DELETE FROM plugin_group_descr WHERE group_id={$group_id}");
        $conn->CompleteTrans();
        if ($conn->HasFailedTrans()) {
            die($conn->ErrorMsg());
        }
    } else {
        ?>
		<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
		<html xmlns="http://www.w3.org/1999/xhtml">
		<head>
		  <title> <?php 
        echo gettext("OSSIM Framework");
示例#5
0
        $i = 1;
        foreach ($port_group_list as $port_group) {
            $port_group_name = $port_group->get_name();
            ?>
			<option value="<?php 
            echo $port_group_name;
            ?>
"> <?php 
            echo $port_group_name . "<br>\n";
            ?>
			<?php 
            $i++;
        }
    }
} elseif ($tab == "plugins") {
    foreach (Plugingroup::get_list($conn) as $g) {
        ?>
		<input type="checkbox" id="plugin_<?php 
        echo $g->get_name();
        ?>
" onclick="drawpolicy()" name="plugins[<?php 
        echo $g->get_id();
        ?>
]" <?php 
        echo in_array($g->get_id(), $plugingroups) ? "checked='checked'" : "";
        ?>
> <a href="../policy/modifyplugingroupsform.php?action=edit&id=<?php 
        echo $g->get_id();
        ?>
&withoutmenu=1" class="greybox" title="<?php 
        echo _('View plugin group');
function draw_columns($group_id, $selected_col = 1)
{
    global $conn, $config, $login;
    $resp = new xajaxResponse();
    list($group_data) = Plugingroup::get_list($conn, "plugin_group.group_id={$group_id}");
    $groups_config = $config->get($login, 'event_viewer_tmp', 'php');
    $html = '<form id="colopts">' . _('Columns display configuration for group') . ': <b>' . $group_data->get_name() . '</b><br>
<table width="100%" align="center" style="border-width: 0px">
<tr>
<td style="border-width: 0px">
';
    if (is_array($groups_config) && isset($groups_config[$group_id])) {
        /*
         * Draw column tabs
         */
        //xajax_debug($groups_config, $resp);
        $html .= '<table width="100%" align="center"><tr>';
        $num_cols = count($groups_config[$group_id]);
        foreach ($groups_config[$group_id] as $col_num => $col_conf) {
            if ($col_num == $selected_col) {
                $td_bg = 'background-color: grey';
                $bold = true;
            } else {
                $td_bg = '';
                $bold = false;
            }
            $curr = $groups_config[$group_id][$col_num];
            $curr_label = isset($curr['label']) ? $curr['label'] : $col_num;
            $html .= '<td style="border-width: 0px;' . $td_bg . '">';
            $tmp = '';
            if ($col_num != 1) {
                $tmp = '<a href="#" onClick="javascript: xajax_move_column(' . $group_id . ', ' . $col_num . ', \'left\');">&lt;</a>&nbsp;';
            }
            $tmp .= '<a href="#" onClick="javascript: xajax_draw_columns(' . $group_id . ', ' . $col_num . ')">' . $curr_label . '</a>&nbsp;';
            if ($col_num != $num_cols) {
                $tmp .= '<a href="#" onClick="javascript: xajax_move_column(' . $group_id . ', ' . $col_num . ', \'right\');">&gt;</a>&nbsp;';
            }
            $tmp .= '<small>(<a href="#" onClick="javascript: xajax_delete_column(' . $group_id . ', ' . $col_num . ')">' . _("delete") . '</a>)</small>';
            $html .= $bold ? "<b>{$tmp}</b>" : $tmp;
            $html .= '</td>';
        }
        /*
         * Draw column options
         */
        $current_col = $groups_config[$group_id][$selected_col];
        $col_label = isset($current_col['label']) ? $current_col['label'] : '';
        $col_contents = isset($current_col['contents']) ? $current_col['contents'] : '';
        $col_width = isset($current_col['width']) ? $current_col['width'] : '';
        $col_align = isset($current_col['align']) ? $current_col['align'] : 'left';
        $col_selected_left = $col_selected_center = $col_selected_right = '';
        switch ($col_align) {
            case 'center':
                $col_selected_center = 'selected';
                break;
            case 'right':
                $col_selected_right = 'selected';
                break;
            default:
                $col_selected_left = 'selected';
        }
        $col_wrap = !isset($current_col['wrap']) ? true : false;
        $col_selected_wrap = $col_selected_nowrap = '';
        if ($col_wrap) {
            $col_selected_wrap = 'selected';
        } else {
            $col_selected_nowrap = 'selected';
        }
        // SELECT tag
        $tags = Event_viewer::get_tags();
        $select = '<option value="">' . _("Add replacement tag") . "</option>";
        foreach ($tags as $label => $descr) {
            $select .= "<option value= '{$label}'>{$label}</option>";
        }
        $select = '<select id="tags" onChange="javascript: add_tag(this)">' . $select . '</select>';
        $html .= '</tr><tr><td colspan="' . $num_cols . '" style="border-width: 0px">
' . _("Options for column") . ': <b>' . $selected_col . '</b><br>
<table width="100%" align="left" style="border-width: 0px">
<tr>
    <th>' . _("Column label") . '</th>
    <td style="text-align: left"><input type="text" value="' . $col_label . '" name="label" size="25"></td>
</tr><tr>
    <th>' . _("Column contents") . '</th>
    <td style="text-align: left" nowrap><input type="text" id="contents" value="' . $col_contents . '" name="contents" size="50">&lt;-' . $select . '</td>
</tr><tr>
    <th>' . _("Column settings") . '</th>
    <td style="text-align: left" nowrap>' . _("Align") . ': <select name="align">
                        <option value="left" ' . $col_selected_left . '>' . _("left") . '</option>
                        <option value="center" ' . $col_selected_center . '>' . _("center") . '</option>
                        <option value="right" ' . $col_selected_right . '>' . _("right") . '</option>
                      </select>&nbsp;' . _("Wrap") . ': <select name="wrap">
                        <option value="yes" ' . $col_selected_wrap . '>' . _("Yes") . '</option>
                        <option value="no" ' . $col_selected_nowrap . '>' . _("No") . '</option>
                      </select>&nbsp;' . _("Width") . ': <input type="text" value="' . $col_width . '" name="width" size="3">% (1-100)
    </td>
</tr><tr>
    <td colspan="2" style="border-width: 0px">
        <input type="button" name="save" value="' . _("save column") . ' ' . $selected_col . '"
               onclick="javascript: xajax_save_column_opts(' . $group_id . ', ' . $selected_col . ', xajax.getFormValues(\'colopts\'))">
    </td>
</tr>
</table>';
        $html .= '</td></tr></table>';
    }
    $html .= '
</td><td>
<td valign="top" style="border-width: 0px; text-align: right"><a href="#" onClick="javascript: xajax_add_column(' . $group_id . ')">' . _("add column") . '</td>
</td>
</tr>
</table>
</form>
';
    $resp->addAssign("columns_config", "innerHTML", $html);
    $resp->addAssign("columns_config", "style.display", '');
    return $resp;
}
示例#7
0
						<td class="nobborder" style="border-bottom: 1px dotted;padding-bottom:5px;">
							<input type="checkbox" id="plugin_ANY" onclick="drawpolicy()" name="plugins[0]" <?php 
echo in_array(0, $plugingroups) ? "checked='checked'" : "";
?>
/> <?php 
echo _("ANY");
?>
						</td>
					</tr>
					<tr>
						<td class="nobborder" id="plugins" style="text-align:left;padding-top:5px;">
                            <table width="100%" class="transparent" cellspacing="0" cellpadding="0"><tr>
                            <?php 
$iplugin = 0;
/* ===== plugin groups ==== */
foreach (Plugingroup::get_list($conn, "", "name") as $g) {
    echo "<td class='nobborder' style='text-align:left;padding-right:10px'>";
    ?>
                                    <input type="checkbox" id="plugin_<?php 
    echo $g->get_name();
    ?>
" onclick="drawpolicy()" name="plugins[<?php 
    echo $g->get_id();
    ?>
]" <?php 
    echo in_array($g->get_id(), $plugingroups) ? "checked='checked'" : "";
    ?>
> <a href="../policy/modifyplugingroupsform.php?action=edit&id=<?php 
    echo $g->get_id();
    ?>
&withoutmenu=1" class="greybox" title="<?php