diff options
Diffstat (limited to 'packages')
-rw-r--r-- | packages/snort/snort.inc | 8 |
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)) |