From b5f8826c8f4055cbe817248af1f3ea41e078178a Mon Sep 17 00:00:00 2001 From: Scott Ullrich Date: Mon, 25 Sep 2006 02:59:55 +0000 Subject: Add script that will download rules from snort.com and populate to /usr/local/etc/snort/ This script uses the download progress bar framework. --- packages/snort/snort_download_rules.php | 157 ++++++++++++++++++++++++++++++++ 1 file changed, 157 insertions(+) create mode 100644 packages/snort/snort_download_rules.php (limited to 'packages/snort/snort_download_rules.php') diff --git a/packages/snort/snort_download_rules.php b/packages/snort/snort_download_rules.php new file mode 100644 index 00000000..3558ee8b --- /dev/null +++ b/packages/snort/snort_download_rules.php @@ -0,0 +1,157 @@ + + + + + +
+
+ + + + + + + +
+ +
+
+ + + + +
+ + + + + +
+ /images/misc/progress_bar.gif' width='280' height='23' name='progressbar' id='progressbar' alt='' /> +
+
+ + + + +
+
+
+
+ +document.progressbar.style.visibility='hidden';\n"; + exit; +} + +$dl = "http://www.snort.org/pub-bin/oinkmaster.cgi/{$oinkid}/snortrules-snapshot-CURRENT.tar.gz"; +$dl_md5 = "http://www.snort.org/pub-bin/oinkmaster.cgi/{$oinkid}/snortrules-snapshot-CURRENT.tar.gz.md5"; +$tmpfname = tempnam("/tmp", "snortRules"); +$static_output = gettext("Downloading current snort rules... "); + +update_all_status($static_output); +download_file_with_progress_bar($dl, $tmpfname); +$static_output = gettext("Downloading current snort rules md5... "); + +update_all_status($static_output); +download_file_with_progress_bar($dl_md5, $tmpfname); + +/* verify downloaded rules signature */ +verify_snort_rules_md5($tmpfname); + +/* extract rules */ +extract_snort_rules_md5($tmpfname); + +$static_output = gettext("Your snort rules are now up to date."); +update_all_status($static_output); + +echo "\n"; +?> + + + + $file_md5_ondisk) { + $static_output = gettext("md5 signature of rules mismatch."); + update_all_status($static_output); + echo "\n"; + exit; + } +} + +function update_all_status($status) { + update_status($status); + update_output_window($status); +} + +?> \ No newline at end of file -- cgit v1.2.3