From 3726058d63955bbe8b9b033dc033403a7cb9c640 Mon Sep 17 00:00:00 2001 From: robiscool Date: Tue, 1 Dec 2009 13:51:20 -0800 Subject: snort-dev, add new rule edit page, add new popup rule code --- config/snort-dev/snort.inc | 15 + config/snort-dev/snort_rules.php | 18 +- config/snort-dev/snort_rules_edit.php | 680 ++++++++++++---------------------- 3 files changed, 275 insertions(+), 438 deletions(-) (limited to 'config') diff --git a/config/snort-dev/snort.inc b/config/snort-dev/snort.inc index 6fae43ab..6e3ced27 100644 --- a/config/snort-dev/snort.inc +++ b/config/snort-dev/snort.inc @@ -105,6 +105,10 @@ function sync_package_snort() exec("/bin/rm -f /usr/local/etc/rc.d/snort"); } + if(!file_exists("/usr/local/etc/snort/custom_rules")) { + exec("/bin/mkdir -p /usr/local/etc/snort/custom_rules/"); + } + /* remove example files */ /* TODO: remove these filese during binary builds */ if(file_exists("/usr/local/lib/snort/dynamicrules/lib_sfdynamic_example_rule.so.0")) { @@ -179,6 +183,17 @@ conf_mount_ro(); /* Start of main config files */ /* Start of main config files */ +/* if rules exist copy to new interfaces */ +$if_rule_dir = "/usr/local/etc/snort/snort_$id$if_real/rules"; +$folder_chk = (count(glob("$if_rule_dir/*")) === 0) ? 'empty' : 'full'; + +if($folder_chk == "empty") { + exec("/bin/cp -R /usr/local/etc/snort/rules /usr/local/etc/snort/snort_$id$if_real"); + if(file_exists("/usr/local/etc/snort/custom_rules/local_$id$if_real.rules")) { + exec("/bin/cp /usr/local/etc/snort/custom_rules/local_$id$if_real.rules /usr/local/etc/snort/snort_$id$if_real/rules/local_$id$if_real.rules"); + } +} + /* open snort.sh for writing" */ function create_snort_sh() { diff --git a/config/snort-dev/snort_rules.php b/config/snort-dev/snort_rules.php index c0831385..b77e6224 100644 --- a/config/snort-dev/snort_rules.php +++ b/config/snort-dev/snort_rules.php @@ -416,6 +416,21 @@ function go() } // --> + @@ -601,7 +616,8 @@ function go() - + +
diff --git a/config/snort-dev/snort_rules_edit.php b/config/snort-dev/snort_rules_edit.php index 41138acb..412024d8 100644 --- a/config/snort-dev/snort_rules_edit.php +++ b/config/snort-dev/snort_rules_edit.php @@ -1,437 +1,243 @@ - - - -

- - - - - - - - -
- - -
-
- - - - -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Enabled: >
SID:
Type:
Protocol:
Source:
Source Port:
Direction:
Destination:
Destination Port:
Message:
Flow:
Content:
Metadata:
Reference:
Reference2:
Classtype:
Revision:
 
-
-
-
- - - - \ No newline at end of file +#!/usr/local/bin/php + "") { + if($_POST['highlight'] == "yes" or + $_POST['highlight'] == "enabled") { + $highlight = "yes"; + } else { + $highlight = "no"; + } +} else { + $highlight = "no"; +} + +if($_POST['rows'] <> "") + $rows = $_POST['rows']; +else + $rows = 1; + +if($_POST['cols'] <> "") + $cols = $_POST['cols']; +else + $cols = 66; + +if ($_POST) +{ + if ($_POST['save']) { + + /* get the changes */ + $rule_content2 = $_POST['code']; + + //copy string into file array for writing + $splitcontents[$lineid] = $rule_content2; + + //write the new .rules file + write_rule_file($splitcontents, $file); + + header("Location: /snort/snort_rules_edit.php?id=$id&openruleset=$file&ids=$ids"); + + } +} + +$pgtitle = array(gettext("Advanced"), gettext("File Editor")); + +// +?> + + + + + + + + +
+
+ + + + + +
+ +
+ : + /> + + /> + +
+ + + + +
+
+ + +
+
+ + + + +
+
+ + +
+
+ +
+
+ + + + + + + + + + + + + + + + + -- cgit v1.2.3