From 3db7538653b56792b97c59fd4533aebf86058b99 Mon Sep 17 00:00:00 2001 From: bmeeks8 Date: Fri, 19 Sep 2014 13:33:29 -0400 Subject: Show alert description instead of classification in dashboard widget. --- config/snort/snort_alerts.js | 6 +++--- config/snort/snort_alerts.widget.php | 35 ++++++++++++----------------------- 2 files changed, 15 insertions(+), 26 deletions(-) diff --git a/config/snort/snort_alerts.js b/config/snort/snort_alerts.js index 647eb1b1..8133b928 100644 --- a/config/snort/snort_alerts.js +++ b/config/snort/snort_alerts.js @@ -50,11 +50,11 @@ function snort_alerts_fetch_new_events_callback(callback_data) { for(var x=0; x' + row_split[0] + '
' + row_split[1] + ''; - line += ''; + line = '' + row_split[0] + '
' + row_split[1] + ''; + line += ''; line += '
' + row_split[2] + '

'; line += '
' + row_split[3] + '
'; - line += '' + 'Priority: ' + row_split[4] + ' ' + row_split[5] + ''; + line += '
' + row_split[4] + '
'; new_data_to_add[new_data_to_add.length] = line; } snort_alerts_update_div_rows(new_data_to_add); diff --git a/config/snort/snort_alerts.widget.php b/config/snort/snort_alerts.widget.php index 0700ef2a..552dab61 100644 --- a/config/snort/snort_alerts.widget.php +++ b/config/snort/snort_alerts.widget.php @@ -39,19 +39,10 @@ if (!is_array($config['installedpackages']['snortglobal']['rule'])) $config['installedpackages']['snortglobal']['rule'] = array(); $a_instance = &$config['installedpackages']['snortglobal']['rule']; -// Test pfSense version and set different CSS class variables -// depending on version. 2.1 offers enhanced CSS styles. -$pfs_version=substr(trim(file_get_contents("/etc/version")),0,3); -if ($pfs_version > '2.0') { - $alertRowEvenClass = "listMReven"; - $alertRowOddClass = "listMRodd"; - $alertColClass = "listMRr"; -} -else { - $alertRowEvenClass = "listr"; - $alertRowOddClass = "listr"; - $alertColClass = "listr"; -} +// Set some CSS class variables +$alertRowEvenClass = "listMReven"; +$alertRowOddClass = "listMRodd"; +$alertColClass = "listMRr"; /* check if Snort widget alert display lines value is set */ $snort_nentries = $config['widgets']['widget_snort_display_lines']; @@ -93,7 +84,7 @@ if (isset($_GET['getNewAlerts'])) { $counter = 0; foreach ($s_alerts as $a) { $response .= $a['instanceid'] . " " . $a['dateonly'] . "||" . $a['timeonly'] . "||" . $a['src'] . "||"; - $response .= $a['dst'] . "||" . $a['priority'] . "||" . $a['category'] . "\n"; + $response .= $a['dst'] . "||" . $a['msg'] . "\n"; $counter++; if($counter >= $snort_nentries) break; @@ -165,8 +156,7 @@ function snort_widget_get_alerts() { // Add the DST PORT if not null if (!empty($fields[9])) $snort_alerts[$counter]['dst'] .= ":" . trim($fields[9]); - $snort_alerts[$counter]['priority'] = trim($fields[12]); - $snort_alerts[$counter]['category'] = trim($fields[11]); + $snort_alerts[$counter]['msg'] = trim($fields[4]); $counter++; }; fclose($fd); @@ -205,7 +195,7 @@ function snort_widget_get_alerts() { - + @@ -216,9 +206,9 @@ function snort_widget_get_alerts() { foreach ($snort_alerts as $alert) { $alertRowClass = $counter % 2 ? $alertRowEvenClass : $alertRowOddClass; echo(" - " . $alert['instanceid'] . " " . $alert['dateonly'] . "
" . $alert['timeonly'] . " -
" . $alert['src'] . "

" . $alert['dst'] . "
- Priority: " . $alert['priority'] . " " . $alert['category'] . ""); + " . $alert['instanceid'] . " " . $alert['dateonly'] . "
" . $alert['timeonly'] . " +
" . $alert['src'] . "

" . $alert['dst'] . "
+
" . $alert['msg'] . "
"); $counter++; if($counter >= $snort_nentries) break; @@ -233,9 +223,8 @@ function snort_widget_get_alerts() { var snortupdateDelay = 10000; // update every 10 seconds var snort_nentries = ; // number of alerts to display (5 is default) - var snortWidgetRowEvenClass = ""; // allows alternating background on 2.1 and higher - var snortWidgetRowOddClass = ""; // allows alternating background on 2.1 and higher - var snortWidgetColClass = ""; // sets column CSS style (different on 2.1 and higher) + var snortWidgetRowEvenClass = ""; // allows alternating background + var snortWidgetRowOddClass = ""; // allows alternating background selectIntLink = "snort_alerts-configure"; -- cgit v1.2.3