From e5e53211f0ad46d2b89e7e184f74f7b87ba02272 Mon Sep 17 00:00:00 2001 From: robiscool Date: Sat, 12 Dec 2009 23:21:32 -0800 Subject: snort-dev, add more download rules options --- config/snort-dev/snort_download_rules.php | 96 ++++++++++++++++++++----------- 1 file changed, 64 insertions(+), 32 deletions(-) (limited to 'config/snort-dev') diff --git a/config/snort-dev/snort_download_rules.php b/config/snort-dev/snort_download_rules.php index 549e7507..86bb0cac 100644 --- a/config/snort-dev/snort_download_rules.php +++ b/config/snort-dev/snort_download_rules.php @@ -64,11 +64,16 @@ $emergingthreats = $config['installedpackages']['snortglobal']['emergingthreats' $snort_emrging_info = "stop"; } - if ($oinkid == "" && $snortdownload == "basic" || $oinkid == "" && $snortdownload == "premium") + if ($oinkid == "" && $snortdownload != "off") { $snort_oinkid_info = "stop"; } + + /* check if main rule directory is empty */ + $if_mrule_dir = "/usr/local/etc/snort/rules"; + $mfolder_chk = (count(glob("$if_mrule_dir/*")) === 0) ? 'empty' : 'full'; + /* If no id show the user a button */ if ($id_d == "" || $snort_emrging_info == "stop" || $snort_oinkid_info == "stop") { @@ -126,15 +131,17 @@ echo "\n \n

\n"; - -echo "The rules directory is empty. /usr/local/etc/snort/rules

\n"; +if ($mfolder_chk == "empty") +{ +echo "WARNING:   The main rules directory is empty. /usr/local/etc/snort/rules

\n"; +} if ($snort_emrging_info == "stop") { -echo "WARNING:   Click on the \"Global Settings\" TAB and select ether snort.org or enmergingthreats.net rules to download.

\n"; +echo "WARNING:   Click on the \"Global Settings\" tab and select ether snort.org or enmergingthreats.net rules to download.

\n"; } if ($snort_oinkid_info == "stop") { -echo "WARNING:   Click on the \"Global Settings\" TAB and enter a oinkmaster code.

\n"; +echo "WARNING:   Click on the \"Global Settings\" tab and enter a oinkmaster code.

\n"; } @@ -488,38 +495,63 @@ if ($emergingthreats == "on") } } -/* Check if were up to date exits */ +/* Check if were up to date is so, exit */ +/* WARNING This code needs constant checks */ +if ($snortdownload != "off" && $emergingthreats != "off") +{ + if ($snort_md5_check_ok == "on" && $emerg_md5_check_ok == "on") + { + update_status(gettext("All your rules are up to date...")); + update_output_window(gettext("You may start Snort now...")); + echo ' + '; + echo ""; + echo ""; + conf_mount_ro(); + exit(0); + } +} -if ($snort_md5_check_ok == "on" && $emerg_md5_check_ok == "on") +if ($snortdownload == "on" && $emergingthreats == "off") { - update_status(gettext("All your rules are up to date...")); - update_output_window(gettext("You may start Snort now...")); - echo ' -'; -echo ""; -echo ""; -conf_mount_ro(); - exit(0); + if ($snort_md5_check_ok == "on") + { + update_status(gettext("Your snort.org rules are up to date...")); + update_output_window(gettext("You may start Snort now...")); + echo ' + '; + echo ""; + echo ""; + conf_mount_ro(); + exit(0); + } } -if ($snort_md5_check_ok == "on" && $emerg_md5_check_ok == "on") +if ($snortdownload == "off" && $emergingthreats == "on") { - update_status(gettext("All your rules are up to date...")); - update_output_window(gettext("You may start Snort now...")); - echo ' -'; - echo ""; - echo ""; - conf_mount_ro(); - exit(0); + if ($emerg_md5_check_ok == "on") + { + update_status(gettext("Your Emergingthreats rules are up to date...")); + update_output_window(gettext("You may start Snort now...")); + echo ' + '; + echo ""; + echo ""; + conf_mount_ro(); + exit(0); + } } /* You are Not Up to date, always stop snort when updating rules for low end machines */; -- cgit v1.2.3