From ddadd6547c7a810e53d5341c361112082bb1b3b8 Mon Sep 17 00:00:00 2001 From: Ermal Date: Wed, 11 Jul 2012 23:31:16 +0000 Subject: Beatify a bit the categories tab and provide select all/unselect all buttons --- config/snort/snort_rulesets.php | 162 +++++++++++++++++++++++++++++----------- 1 file changed, 119 insertions(+), 43 deletions(-) diff --git a/config/snort/snort_rulesets.php b/config/snort/snort_rulesets.php index 2a64aa26..98e3c76d 100644 --- a/config/snort/snort_rulesets.php +++ b/config/snort/snort_rulesets.php @@ -139,11 +139,31 @@ if ($_POST["Submit"]) { write_config(); sync_snort_package_config(); - header( 'Expires: Sat, 26 Jul 1997 05:00:00 GMT' ); - header( 'Last-Modified: ' . gmdate( 'D, d M Y H:i:s' ) . ' GMT' ); - header( 'Cache-Control: no-store, no-cache, must-revalidate' ); - header( 'Cache-Control: post-check=0, pre-check=0', false ); - header( 'Pragma: no-cache' ); + header("Location: /snort/snort_rulesets.php?id=$id"); + exit; +} + +if ($_POST['unselectall']) { + $a_nat[$id]['rulesets'] = ""; + + write_config(); + sync_snort_package_config(); + + header("Location: /snort/snort_rulesets.php?id=$id"); + exit; +} + +if ($_POST['selectall']) { + $files = glob("{$snortdir}/snort_{$iface_uuid}_{$if_real}/rules/*.rules"); + $rulesets = array(); + foreach ($files as $file) + $rulesets[] = basename($file); + + $a_nat[$id]['rulesets'] = implode("||", $rulesets); + + write_config(); + sync_snort_package_config(); + header("Location: /snort/snort_rulesets.php?id=$id"); exit; } @@ -161,14 +181,11 @@ include_once("head.inc"); ' . $pgtitle . '

';}?> -"; - -?> "; + + - + + + + + + + + + + + + + - - + \n"; - echo "\n"; - echo "\n\n\n"; + if (!empty($emergingrules[$j])) { + $file = $emergingrules[$j]; + echo "\n"; + echo "\n"; + } else + echo "\n"; + if (!empty($snortrules[$j])) { + $file = $snortrules[$j]; + echo "\n"; + echo "\n"; + } else + echo "\n"; + if (!empty($snortsorules[$j])) { + $file = $snortsorules[$j]; + echo "\n"; + echo "\n"; + } else + echo "\n"; + echo "\n"; } ?>
Check the rulesets that you would like Snort to load at startup.







EnabledEnabled Enabled
"; - if(is_array($enabled_rulesets_array)) - if(in_array($file, $enabled_rulesets_array)) { - $CHECKED = " checked=\"checked\""; - } else { - $CHECKED = ""; - } - else - $CHECKED = ""; - echo " \n\n"; - echo "\n"; - echo "{$file}\n"; - echo "
"; + if(is_array($enabled_rulesets_array)) { + if(in_array($file, $enabled_rulesets_array)) + $CHECKED = " checked=\"checked\""; + else + $CHECKED = ""; + } else + $CHECKED = ""; + echo " \n\n"; + echo "\n"; + echo "{$file}\n"; + echo "
"; + if(is_array($enabled_rulesets_array)) { + if(in_array($file, $enabled_rulesets_array)) + $CHECKED = " checked=\"checked\""; + else + $CHECKED = ""; + } else + $CHECKED = ""; + echo " \n\n"; + echo "\n"; + echo "{$file}\n"; + echo "
"; + if(is_array($enabled_rulesets_array)) { + if(in_array($file, $enabled_rulesets_array)) + $CHECKED = " checked=\"checked\""; + else + $CHECKED = ""; + } else + $CHECKED = ""; + echo " \n\n"; + echo "\n"; + echo "{$file}\n"; + echo "
-   - - - Check the rulesets that you would like Snort to load at startup. - - -   - - - +   -- cgit v1.2.3