aboutsummaryrefslogtreecommitdiffstats
path: root/packages/snort
diff options
context:
space:
mode:
authorScott Ullrich <sullrich@pfsense.org>2006-10-07 05:19:40 +0000
committerScott Ullrich <sullrich@pfsense.org>2006-10-07 05:19:40 +0000
commit2d65485637b23d6042baa25054370c97e6d61e61 (patch)
tree536e95492e8ce737343bf66202218b3c5d618aa0 /packages/snort
parentcea6f43d276c92959f9fbb53022a41007bddf0d4 (diff)
downloadpfsense-packages-2d65485637b23d6042baa25054370c97e6d61e61.tar.gz
pfsense-packages-2d65485637b23d6042baa25054370c97e6d61e61.tar.bz2
pfsense-packages-2d65485637b23d6042baa25054370c97e6d61e61.zip
CACHE /var/log/snort/alert in between calls
Diffstat (limited to 'packages/snort')
-rw-r--r--packages/snort/snort.inc8
1 files changed, 6 insertions, 2 deletions
diff --git a/packages/snort/snort.inc b/packages/snort/snort.inc
index fb0b7343..aba44a75 100644
--- a/packages/snort/snort.inc
+++ b/packages/snort/snort.inc
@@ -485,9 +485,13 @@ function update_all_status($status) {
}
}
+$snort_alert_file_split = split("\n", file_get_contents("/var/log/snort/alert"));
+
function get_snort_alert($ip) {
- $file_split = split("\n", file_get_contents("/var/log/snort/alert"));
- foreach($file_split as $fileline) {
+ global $snort_alert_file_split;
+ if(!$snort_alert_file_split)
+ $snort_alert_file_split = split("\n", file_get_contents("/var/log/snort/alert"));
+ foreach($snort_alert_file_split as $fileline) {
if (preg_match("/\[\*\*\] (\[.*\]) (.*) (\[\*\*\])/", $fileline, $matches))
$alert_title = $matches[2];
if (preg_match("/(\b(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\b)/", $fileline, $matches))