From e9562289eb7346dc2782e8f2ffe0236878deedc7 Mon Sep 17 00:00:00 2001 From: jim-p Date: Sat, 17 Oct 2009 15:27:13 -0400 Subject: Snort widget updates, courtesy of matrix200 --- config/widget-snort/snort_alerts.inc.php | 8 ++++++-- config/widget-snort/snort_alerts.js | 9 ++++----- config/widget-snort/snort_alerts.widget.php | 14 ++++++-------- config/widget-snort/widget-snort.xml | 2 +- pkg_config.7.xml | 2 +- pkg_config.8.xml | 2 +- pkg_config.xml | 2 +- 7 files changed, 20 insertions(+), 19 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; diff --git a/config/widget-snort/snort_alerts.js b/config/widget-snort/snort_alerts.js index 48c97d6c..2eebb140 100644 --- a/config/widget-snort/snort_alerts.js +++ b/config/widget-snort/snort_alerts.js @@ -72,10 +72,9 @@ function snort_alerts_fetch_new_rules_callback(callback_data) { /* loop through rows */ row_split = data_split[x].split("||"); var line = ''; - line = '' + row_split[1] + ''; - line += '' + row_split[2] + ''; - line += '' + row_split[3] + ''; - line += '' + row_split[4] + ''; + line = '' + row_split[6] + '
' + row_split[7]+ ''; + line += '' + row_split[3] + '
' + row_split[4] + ''; + line += '' + 'Pri : ' + row_split[1] + '
' + 'Cat : ' + row_split[2] + ''; snortlastsawtime = row_split[5]; new_data_to_add[new_data_to_add.length] = line; } @@ -142,4 +141,4 @@ function snort_alerts_toggle_pause() { } } /* start local AJAX engine */ -snorttimer = setInterval('snort_alerts_fetch_new_rules()', snortupdateDelay); +snorttimer = setInterval('snort_alerts_fetch_new_rules()', snortupdateDelay); \ No newline at end of file diff --git a/config/widget-snort/snort_alerts.widget.php b/config/widget-snort/snort_alerts.widget.php index 22bd1b69..aa416274 100644 --- a/config/widget-snort/snort_alerts.widget.php +++ b/config/widget-snort/snort_alerts.widget.php @@ -30,10 +30,9 @@ global $config, $g; - - - - + + + @@ -56,10 +55,9 @@ global $config, $g; ?> > - - - - + + + diff --git a/config/widget-snort/widget-snort.xml b/config/widget-snort/widget-snort.xml index b32a27d7..1644181c 100644 --- a/config/widget-snort/widget-snort.xml +++ b/config/widget-snort/widget-snort.xml @@ -46,7 +46,7 @@ Dashboard package and SnortCurrently there are no FAQ items provided.widget-snort - 0.1 + 0.2Widget - Snort/usr/local/pkg/widget-snort.inc diff --git a/pkg_config.7.xml b/pkg_config.7.xml index 0a217750..f2d24221 100755 --- a/pkg_config.7.xml +++ b/pkg_config.7.xml @@ -132,7 +132,7 @@ Dashboard widget for Snort. System http://www.pfsense.com/packages/config/widget-snort/widget-snort.xml - 0.1 + 0.2 BETA 1.2 widget-snort.xml diff --git a/pkg_config.8.xml b/pkg_config.8.xml index 70d01e7d..0b48267f 100755 --- a/pkg_config.8.xml +++ b/pkg_config.8.xml @@ -756,7 +756,7 @@ Dashboard widget for Snort. System http://www.pfsense.com/packages/config/widget-snort/widget-snort.xml - 0.1 + 0.2 BETA 1.2 widget-snort.xml diff --git a/pkg_config.xml b/pkg_config.xml index 1ebb3da3..e1773ca6 100644 --- a/pkg_config.xml +++ b/pkg_config.xml @@ -99,7 +99,7 @@ Dashboard widget for Snort. System http://www.pfsense.com/packages/config/widget-snort/widget-snort.xml - 0.1 + 0.2 BETA 1.2 widget-snort.xml -- cgit v1.2.3
PriCategorySrcDstDateSrc/DstDetails
' . $alert["dst"] ?>' . 'Cat : ' . $alert['category'] ?>