From 2c102f579e66efcc164d13cde3e11255b516e006 Mon Sep 17 00:00:00 2001 From: Ermal Date: Sat, 3 Sep 2011 20:07:15 +0000 Subject: Correct toggle action behaviour on snort rules. Also a quick attempt to fix keeping local modification of disable/enable of rules. --- config/snort/snort_rules_edit.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'config/snort/snort_rules_edit.php') diff --git a/config/snort/snort_rules_edit.php b/config/snort/snort_rules_edit.php index 7c31b017..266750fa 100644 --- a/config/snort/snort_rules_edit.php +++ b/config/snort/snort_rules_edit.php @@ -95,9 +95,25 @@ if ($_POST) { else $splitcontents[$lineid] = "# " . $_POST['code']; + //write disable/enable sid to config.xml + $sid = get_middle($splitcontents[$lineid], 'sid:', ';', 0); + if (is_numeric($sid)) { + // rule_sid_on registers + if (!empty($a_nat[$id]['rule_sid_on'])) + $a_nat[$id]['rule_sid_on'] = str_replace("||enablesid $sid", "", $a_nat[$id]['rule_sid_on']); + if (!empty($a_nat[$id]['rule_sid_on'])) + $a_nat[$id]['rule_sid_off'] = str_replace("||disablesid $sid", "", $a_nat[$id]['rule_sid_off']); + if ($_POST['highlight'] == "yes") + $a_nat[$id]['rule_sid_on'] = "||enablesid $sid" . $a_nat[$id]['rule_sid_on']; + else + $a_nat[$id]['rule_sid_off'] = "||disablesid $sid" . $a_nat[$id]['rule_sid_off']; + } + //write the new .rules file @file_put_contents($file, implode($delimiter, $splitcontents)); + write_config(); + echo ""; exit; } -- cgit v1.2.3