aboutsummaryrefslogtreecommitdiffstats
path: root/packages/snort
diff options
context:
space:
mode:
authorScott Ullrich <sullrich@pfsense.org>2006-09-27 04:44:45 +0000
committerScott Ullrich <sullrich@pfsense.org>2006-09-27 04:44:45 +0000
commit5d74aede64811b101f8e83cdedbbd400d90d02a4 (patch)
treeb1fe56d2f6f6702c66692a869da1c9604a5add07 /packages/snort
parent28a256448332f0d4736b5b51e1d975f100a83650 (diff)
downloadpfsense-packages-5d74aede64811b101f8e83cdedbbd400d90d02a4.tar.gz
pfsense-packages-5d74aede64811b101f8e83cdedbbd400d90d02a4.tar.bz2
pfsense-packages-5d74aede64811b101f8e83cdedbbd400d90d02a4.zip
Make console text friendler
Diffstat (limited to 'packages/snort')
-rw-r--r--packages/snort/snort.inc50
-rw-r--r--packages/snort/snort_check_for_rule_updates.php10
2 files changed, 39 insertions, 21 deletions
diff --git a/packages/snort/snort.inc b/packages/snort/snort.inc
index 18a4bcff..45781bc8 100644
--- a/packages/snort/snort.inc
+++ b/packages/snort/snort.inc
@@ -302,21 +302,30 @@ function check_for_common_errors($filename) {
if(!$console_mode) {
update_all_status("An error occured. Scroll down to inspect it's contents.");
hide_progress_bar_status();
+ } else {
+ log_error("An error occured. Scroll down to inspect it's contents.");
+ echo "An error occured. Scroll down to inspect it's contents.";
+ }
+ if(!$console_mode) {
+ echo "
+ <center>
+ <div id='error' style='background:white;width:90%'>
+ <!-- TODO: The below paragraphs are kind of stupid. Use CSS instead -->
+ <p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p>
+ <p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p>
+ <p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p>
+ <p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p>
+ <p>The following error occured while downloading the snort rules file from snort.org:</p>
+ {$contents}
+ <p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p>
+ </div>
+ </center>
+ ";
+ } else {
+ $contents = strip_tags($contents);
+ log_error("Error downloading snort rules: {$contents}");
+ echo "Error downloading snort rules: {$contents}";
}
- echo "
- <center>
- <div id='error' style='background:white;width:90%'>
- <!-- TODO: The below paragraphs are kind of stupid. Use CSS instead -->
- <p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p>
- <p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p>
- <p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p>
- <p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p>
- <p>The following error occured while downloading the snort rules file from snort.org:</p>
- {$contents}
- <p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p>
- </div>
- </center>
- ";
scroll_down_to_bottom_of_page();
exit;
}
@@ -343,6 +352,9 @@ function verify_downloaded_file($filename) {
if(!$console_mode) {
update_all_status("Could not fetch snort rules ({$filename}). Check oinkid key and dns and try again.");
hide_progress_bar_status();
+ } else {
+ log_error("Could not fetch snort rules ({$filename}). Check oinkid key and dns and try again.");
+ echo "Could not fetch snort rules ({$filename}). Check oinkid key and dns and try again.";
}
exit;
}
@@ -360,6 +372,9 @@ function extract_snort_rules_md5($tmpfname) {
if(!$console_mode) {
$static_output = gettext("Snort rules extracted.");
update_all_status($static_output);
+ } else {
+ log_error("Snort rules extracted.");
+ echo "Snort rules extracted.";
}
}
@@ -374,9 +389,12 @@ function verify_snort_rules_md5($tmpfname) {
$file_md5_ondisk = `/sbin/md5 {$tmpfname}/{$snort_filename} | /usr/bin/awk '{ print $4 }'`;
if($md5 <> $file_md5_ondisk) {
if(!$console_mode) {
- $static_output = gettext("md5 signature of rules mismatch.");
+ $static_output = gettext("snort rules: md5 signature of rules mismatch.");
update_all_status($static_output);
hide_progress_bar_status();
+ } else {
+ log_error("snort rules: md5 signature of rules mismatch.");
+ echo "snort rules: md5 signature of rules mismatch.";
}
exit;
}
@@ -390,7 +408,7 @@ function hide_progress_bar_status() {
}
function update_all_status($status) {
- global $snort_filename, $snort_filename_md5;
+ global $snort_filename, $snort_filename_md5, $console_mode;
ob_flush();
if(!$console_mode) {
update_status($status);
diff --git a/packages/snort/snort_check_for_rule_updates.php b/packages/snort/snort_check_for_rule_updates.php
index 32c09c48..40136f40 100644
--- a/packages/snort/snort_check_for_rule_updates.php
+++ b/packages/snort/snort_check_for_rule_updates.php
@@ -1,4 +1,4 @@
-#!/usr/local/bin/php -v
+#!/usr/local/bin/php -f
<?php
/* $Id$ */
@@ -61,12 +61,12 @@ if($date1ts > $date2ts or !$last_ruleset_download) {
exec("/bin/rm -rf {$tmpfname};/bin/mkdir -p {$tmpfname}");
/* download snort rules */
- exec("fetch -vvv -o {$tmpfname}/{$snort_filename} $dl");
+ exec("fetch -q -o {$tmpfname}/{$snort_filename} $dl");
verify_downloaded_file($tmpfname . "/{$snort_filename}");
/* download snort rules md5 file */
$static_output = gettext("Downloading current snort rules md5... ");
- exec("fetch -vvv -o {$tmpfname}/{$snort_filename_md5} $dl_md5");
+ exec("fetch -q -o {$tmpfname}/{$snort_filename_md5} $dl_md5");
verify_downloaded_file($tmpfname . "/{$snort_filename_md5}");
/* verify downloaded rules signature */
@@ -84,9 +84,9 @@ if($date1ts > $date2ts or !$last_ruleset_download) {
/* cleanup temporary directory */
exec("/bin/rm -rf {$tmpfname};");
- echo "Rules are now up to date.";
+ echo "Rules are now up to date.\n";
} else {
- echo "Rules are up to date.";
+ echo "Rules are up to date.\n";
}
?> \ No newline at end of file