From 28f4d0b841263bd1667fe870ff8d9041ffe0f096 Mon Sep 17 00:00:00 2001 From: Ermal Date: Thu, 1 Sep 2011 22:09:10 +0000 Subject: Some improvements to the snort rules screens --- config/snort/snort_rules.php | 8 +++-- config/snort/snort_rules_edit.php | 73 +++++++++++++++------------------------ 2 files changed, 33 insertions(+), 48 deletions(-) diff --git a/config/snort/snort_rules.php b/config/snort/snort_rules.php index 3975fd2c..75233529 100644 --- a/config/snort/snort_rules.php +++ b/config/snort/snort_rules.php @@ -43,6 +43,10 @@ $a_nat = &$config['installedpackages']['snortglobal']['rule']; $id = $_GET['id']; if (isset($_POST['id'])) $id = $_POST['id']; +if (is_null($id)) { + header("Location: /snort/snort_interfaces.php"); + exit; +} if (isset($id) && $a_nat[$id]) { $pconfig['enable'] = $a_nat[$id]['enable']; @@ -185,8 +189,8 @@ if ($_GET['openruleset'] != '' && $_GET['ids'] != '') { } */ -//$ruledir = "/usr/local/etc/snort/snort_{$iface_uuid}_{$if_real}/rules/"; -$ruledir = "/usr/local/etc/snort/rules/"; +$ruledir = "/usr/local/etc/snort/snort_{$iface_uuid}_{$if_real}/rules/"; +//$ruledir = "/usr/local/etc/snort/rules/"; $dh = opendir($ruledir); while (false !== ($filename = readdir($dh))) { diff --git a/config/snort/snort_rules_edit.php b/config/snort/snort_rules_edit.php index bac04f68..666147dc 100644 --- a/config/snort/snort_rules_edit.php +++ b/config/snort/snort_rules_edit.php @@ -1,6 +1,6 @@ 0 ) { $contents2 = file_get_contents($file); @@ -80,23 +83,16 @@ $delimiter = "\n"; $splitcontents = explode($delimiter, $contents2); if ($_POST) { - if($_POST['highlight'] <> "") { - if($_POST['highlight'] == "yes" or - $_POST['highlight'] == "enabled") { - $highlight = "yes"; - } else { - $highlight = "no"; - } - } else { - $highlight = "no"; - } + $highlight = "no"; + if($_POST['highlight'] == "yes") + $highlight = "yes"; - if($_POST['rows'] <> "") + if ($_POST['rows'] <> "") $rows = $_POST['rows']; else $rows = 1; - if($_POST['cols'] <> "") + if ($_POST['cols'] <> "") $cols = $_POST['cols']; else $cols = 66; @@ -125,17 +121,19 @@ $pgtitle = array(gettext("Advanced"), gettext("File Editor")); - - + - + +
-
+
+ + + - -
+ + +
Disable original rule :
@@ -146,37 +144,20 @@ $pgtitle = array(gettext("Advanced"), gettext("File Editor"));
-
-
- - -
+
+ +
- - - - - -
-
- -
-
-
- - -- cgit v1.2.3