From 1c216eda16dc6eb190770c8a1259a5aa700791c9 Mon Sep 17 00:00:00 2001 From: Scott Ullrich Date: Mon, 11 Dec 2006 19:08:57 +0000 Subject: Latest fixes from Scott --- packages/snort/snort.xml | 10 ++++++++++ packages/snort/snort_rules.php | 36 +++++++++++++++++------------------- 2 files changed, 27 insertions(+), 19 deletions(-) (limited to 'packages') diff --git a/packages/snort/snort.xml b/packages/snort/snort.xml index 6919d0cf..fadaec51 100644 --- a/packages/snort/snort.xml +++ b/packages/snort/snort.xml @@ -24,6 +24,16 @@ 077 http://www.pfsense.com/packages/config/snort/snort_download_rules.php + + /usr/local/www/ + 077 + http://www.pfsense.com/packages/config/snort/snort_rules.php + + + /usr/local/www/ + 077 + http://www.pfsense.com/packages/config/snort/snort_rules_edit.php + /usr/local/www/ 077 diff --git a/packages/snort/snort_rules.php b/packages/snort/snort_rules.php index 27fa7012..788d9bfe 100644 --- a/packages/snort/snort_rules.php +++ b/packages/snort/snort_rules.php @@ -120,12 +120,15 @@ if ($_POST) $post_dest = $_POST['dest']; $post_destport = $_POST['destport']; + //clean up any white spaces insert by accident + $post_src = str_replace(" ", "", $post_src); + $post_srcport = str_replace(" ", "", $post_srcport); + $post_dest = str_replace(" ", "", $post_dest); + $post_destport = str_replace(" ", "", $post_destport); + //copy rule contents from array into string $tempstring = $splitcontents[$post_lineid]; - //explode rule contents into an array, (delimiter is space) - $rule_content = explode(' ', $tempstring); - //search string $findme = "# alert"; //find string for disabled alerts @@ -146,10 +149,7 @@ if ($_POST) { //rule is staying disabled $counter2 = 2; - } - //if enabled box was not changed, default - $counter2 = 2; } else { @@ -165,27 +165,25 @@ if ($_POST) //rule is staying enabled $counter2 = 1; } - //if enabled box was not changed, default - $counter2 = 1; } + //explode rule contents into an array, (delimiter is space) + $rule_content = explode(' ', $tempstring); + + //insert new values $counter2++; - $source = $rule_content[$counter2];//source location + $rule_content[$counter2] = $post_src;//source location $counter2++; - $source_port = $rule_content[$counter2];//source port location + $rule_content[$counter2] = $post_srcport;//source port location $counter2 = $counter2+2; - $destination = $rule_content[$counter2];//destination location + $rule_content[$counter2] = $post_dest;//destination location $counter2++; - $destination_port = $rule_content[$counter2];//destination port location + $rule_content[$counter2] = $post_destport;//destination port location - //insert new values into their respective places - $tempstring = str_replace($source, $post_src, $tempstring); - $tempstring = str_replace($source_port, $post_srcport, $tempstring); - $tempstring = str_replace($destination, $post_dest, $tempstring); - $tempstring = str_replace($destination_port, $post_destport, $tempstring); + //implode the array back into string + $tempstring = implode(' ', $rule_content); - - //copy string into array for writing + //copy string into file array for writing $splitcontents[$post_lineid] = $tempstring; //write the new .rules file -- cgit v1.2.3