diff options
Diffstat (limited to 'config/widget-snort/snort_alerts.inc.php')
-rw-r--r-- | config/widget-snort/snort_alerts.inc.php | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/config/widget-snort/snort_alerts.inc.php b/config/widget-snort/snort_alerts.inc.php index 99e3ee9f..48506f9b 100644 --- a/config/widget-snort/snort_alerts.inc.php +++ b/config/widget-snort/snort_alerts.inc.php @@ -26,7 +26,7 @@ function get_snort_alerts($snort_alerts, $nentries, $tail = 20) { function parse_snort_alert_line($line) { $log_split = ""; - + $datesplit = ""; preg_match("/^(.*)\s+\[\*\*\]\s+\[(\d+\:\d+:\d+)\]\s(.*)\s(.*)\s+\[\*\*\].*\s+\[Priority:\s(\d+)\]\s{(.*)}\s+(.*)\s->\s(.*)$/U", $line, $log_split); list($all, $alert['time'], $alert['rule'], $alert['category'], $alert['descr'], @@ -40,6 +40,10 @@ function parse_snort_alert_line($line) { $usableline = false; if($usableline == true) { + preg_match("/^(\d+)\/(\d+)-(\d+\:\d+\:\d+).\d+$/U", $alert['time'], $datesplit); + $alert['dateonly'] = $datesplit[2] . "/" . $datesplit[1]; + $alert['timeonly'] = $datesplit[3]; + $alert['category'] = strtoupper( substr($alert["category"],0 , 1) ) . strtolower( substr($alert["category"],1 ) ); return $alert; } else { if($g['debug']) { @@ -67,7 +71,7 @@ function handle_snort_ajax($snort_alerts_logfile, $nentries = 5, $tail = 50) { preg_match("/.*([0-9][0-9]:[0-9][0-9]:[0-9][0-9]).*/", $log_row['time'], $time_regex); $row_time = strtotime($time_regex[1]); if($row_time > $lastsawtime) { - $new_rules .= "{$log_row['time']}||{$log_row['priority']}||{$log_row['category']}||{$log_row['src']}||{$log_row['dst']}||" . time() . "||\n"; + $new_rules .= "{$log_row['time']}||{$log_row['priority']}||{$log_row['category']}||{$log_row['src']}||{$log_row['dst']}||" . time() . "||{$log_row['timeonly']}||{$log_row['dateonly']}" . "||\n"; } } echo $new_rules; |