aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorScott Ullrich <sullrich@pfsense.org>2006-09-27 00:09:04 +0000
committerScott Ullrich <sullrich@pfsense.org>2006-09-27 00:09:04 +0000
commita421b8cc83e20596a792d1b27cb0b757152fc134 (patch)
treeb7ee04a9f3da7afd8d95d4fabd3e618af55323b7
parent4272de25e28efa93cce0e82989a2347984512cd9 (diff)
downloadpfsense-packages-a421b8cc83e20596a792d1b27cb0b757152fc134.tar.gz
pfsense-packages-a421b8cc83e20596a792d1b27cb0b757152fc134.tar.bz2
pfsense-packages-a421b8cc83e20596a792d1b27cb0b757152fc134.zip
* 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
-rw-r--r--packages/snort/snort_download_rules.php24
1 files changed, 23 insertions, 1 deletions
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");
</tr>
<?php
if(!$_GET['start'] && !$_POST['start']) {
+ $last_ruleset_download = $config['installedpackages']['snort']['last_ruleset_download'];
+ $text = file_get_contents("http://www.snort.org/pub-bin/downloads.cgi");
+ if (preg_match_all("/.*RELEASED\: (.*)\</", $text, $matches))
+ $last_update_date = trim($matches[1][0]);
echo "<tr><td>&nbsp;</td></tr>";
- echo "<tr><td colspan='2'>Press <a href='snort_download_rules.php?start=yes'>here</a> to start download.</td></tr>";
+ echo "<tr><td><table>";
+ if($last_update_date)
+ echo "<tr><td>Last snort.org rule update:</td><td>{$last_update_date}</td></tr>";
+ if($last_ruleset_download)
+ echo "<tr><td>You last updated the ruleset:</td><td>{$last_ruleset_download}</td></tr>";
+ echo "</td></tr></table>";
+ echo "<tr><td>&nbsp;</td></tr>";
+ /* 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 "<tr><td colspan='2'>Press <a href='snort_download_rules.php?start=yes'>here</a> to start download.</td></tr>";
+ else
+ echo "<tr><td colspan='2'>Your snort rulesets are up to date.</td></tr>";
echo "<tr><td>&nbsp;</td></tr>";
echo "</table>";
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};");