From a421b8cc83e20596a792d1b27cb0b757152fc134 Mon Sep 17 00:00:00 2001 From: Scott Ullrich Date: Wed, 27 Sep 2006 00:09:04 +0000 Subject: * Keep track of last download date. * Automatically fetch the newest snort ruleset date * Only allow user to invoke the download only if they have never downloaded prior or if there is a newer ruleset posted --- packages/snort/snort_download_rules.php | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) (limited to 'packages/snort') diff --git a/packages/snort/snort_download_rules.php b/packages/snort/snort_download_rules.php index 3b3e83ec..ae9ae659 100644 --- a/packages/snort/snort_download_rules.php +++ b/packages/snort/snort_download_rules.php @@ -28,6 +28,7 @@ */ +require_once("config.inc"); require_once("functions.inc"); require_once("guiconfig.inc"); @@ -60,8 +61,26 @@ include("head.inc");  "; - echo "Press here to start download."; + echo ""; + if($last_update_date) + echo ""; + if($last_ruleset_download) + echo ""; + echo "
Last snort.org rule update:{$last_update_date}
You last updated the ruleset:{$last_ruleset_download}
"; + echo " "; + /* get time stamps for comparison operations */ + $date1ts = strtotime($last_ruleset_download); + $date2ts = strtotime($last_ruleset_download); + /* is there a newer ruleset available? */ + if($date1ts > $date2ts or !$last_ruleset_download) + echo "Press here to start download."; + else + echo "Your snort rulesets are up to date."; echo " "; echo ""; include("fend.inc"); @@ -146,6 +165,9 @@ extract_snort_rules_md5($tmpfname); $static_output = gettext("Your snort rules are now up to date."); update_all_status($static_output); +$config['installedpackages']['snort']['last_ruleset_download'] = date("Y-m-d"); +write_config(); + /* cleanup temporary directory */ exec("/bin/rm -rf {$tmpfname};"); -- cgit v1.2.3