From b33b9a9d050bd5bc8247fc4c95ff7bde39d612f2 Mon Sep 17 00:00:00 2001 From: bmeeks8 Date: Wed, 19 Feb 2014 22:34:27 -0500 Subject: Incorporate Ermal's comments into Suricata BETA pkg code. --- config/suricata/suricata_download_updates.php | 215 ++++++++++++-------------- 1 file changed, 97 insertions(+), 118 deletions(-) (limited to 'config/suricata/suricata_download_updates.php') diff --git a/config/suricata/suricata_download_updates.php b/config/suricata/suricata_download_updates.php index 8ff30e9b..ecfd5f8b 100644 --- a/config/suricata/suricata_download_updates.php +++ b/config/suricata/suricata_download_updates.php @@ -34,7 +34,6 @@ require_once("/usr/local/pkg/suricata/suricata.inc"); /* Define some locally required variables from Suricata constants */ $suricatadir = SURICATADIR; $suricata_rules_upd_log = RULES_UPD_LOGFILE; -$log = $suricata_rules_upd_log; /* load only javascript that is needed */ $suricata_load_jquery = 'yes'; @@ -56,7 +55,7 @@ else { $et_name = "EMERGING THREATS RULES"; } -/* quick md5s chk */ +/* quick md5 chk of downloaded rules */ $snort_org_sig_chk_local = 'N/A'; if (file_exists("{$suricatadir}{$snort_rules_file}.md5")) $snort_org_sig_chk_local = file_get_contents("{$suricatadir}{$snort_rules_file}.md5"); @@ -70,48 +69,45 @@ if (file_exists("{$suricatadir}{$snort_community_rules_filename}.md5")) $snort_community_sig_chk_local = file_get_contents("{$suricatadir}{$snort_community_rules_filename}.md5"); /* Check for postback to see if we should clear the update log file. */ -if (isset($_POST['clear'])) { +if ($_POST['clear']) { if (file_exists("{$suricata_rules_upd_log}")) mwexec("/bin/rm -f {$suricata_rules_upd_log}"); } -if (isset($_POST['update'])) { +if ($_POST['update']) { header("Location: /suricata/suricata_download_rules.php"); exit; } /* check for logfile */ -$suricata_rules_upd_log_chk = 'no'; if (file_exists("{$suricata_rules_upd_log}")) $suricata_rules_upd_log_chk = 'yes'; +else + $suricata_rules_upd_log_chk = 'no'; -$pgtitle = gettext("Suricata: Rule Updates"); +if ($_POST['view']&& $suricata_rules_upd_log_chk == 'yes') { + $contents = @file_get_contents($suricata_rules_upd_log); + if (empty($contents)) + $input_errors[] = gettext("Unable to read log file: {$suricata_rules_upd_log}"); +} + +$pgtitle = gettext("Suricata: Update Rules Set Files"); include_once("head.inc"); ?> -' . $pgtitle . '

';}?> - - - +
@@ -128,111 +124,94 @@ h += 96; ?> - + + + +
+
- - + + + + + + + -
-
- + + + + +

+ - + + -
-
-

- -

-   --> -   
- SNORT VRT RULES  --> -   
- SNORT GPLv2 COMMUNITY RULES  --> -   
-

-
-
  --->
-
- - + + -
-
-

-
-
- - ' . gettext("Update Rules") . '
-

- ' . gettext("WARNING:") . '  ' . gettext('No rule types have been selected for download. ') . - gettext('Visit the ') . 'Global Settings Tab' . gettext(' to select rule types.') . '
'; - - echo '

' . "\n"; - } else { - - echo ' -
' . "\n"; - - } - - ?>
-

-
-
SNORT VRT RULES  --->
-
- - - + + -
-
-

-
-
- " . gettext("View Log") . ""; - echo "          \n"; - }else{ - echo " -    " . gettext("Log is empty.") . "\n"; - } - echo '

' . gettext("The log file is limited to 1024K in size and automatically clears when the limit is exceeded."); - ?> -
-

-
-
SNORT GPLv2 COMMUNITY RULES  --->
- -
+

+
+ +

+

+    + Global Settings Tab' . gettext(' to select rule types.'); ?> +

+ +
+ " name="update" id="submit" class="formbtn" + title=""/>

+ +
- - + + + + + + + + + + + - -
-
- -   " . - gettext(" and ") . "" . gettext("EmergingThreats.net") . "" . - gettext(" will go down from time to time. Please be patient."); ?> +
+ +
+ " name="view" id="view" class="formbtn" + title=""/> +            + " name="clear" id="clear" class="formbtn" + title="" onClick="return confirm('Are you sure?\nOK to confirm, or CANCEL to quit');"/> +
+ +
+    
+ +


+
+
+
-
- +
+

+ +   " . + gettext(" and ") . "" . gettext("EmergingThreats.net") . "" . + gettext(" will go down from time to time. Please be patient."); ?>

-
- - + +
-- cgit v1.2.3