aboutsummaryrefslogtreecommitdiffstats
path: root/config
diff options
context:
space:
mode:
authorbmeeks8 <bmeeks8@bellsouth.net>2014-09-19 13:33:29 -0400
committerbmeeks8 <bmeeks8@bellsouth.net>2014-09-19 13:33:29 -0400
commit3db7538653b56792b97c59fd4533aebf86058b99 (patch)
treeb5ae2dffff2eedc3a02b5991c52b80e14216875a /config
parentda8dd4b95f0db8a215a0d6e893d3ebd60a2251f5 (diff)
downloadpfsense-packages-3db7538653b56792b97c59fd4533aebf86058b99.tar.gz
pfsense-packages-3db7538653b56792b97c59fd4533aebf86058b99.tar.bz2
pfsense-packages-3db7538653b56792b97c59fd4533aebf86058b99.zip
Show alert description instead of classification in dashboard widget.
Diffstat (limited to 'config')
-rw-r--r--config/snort/snort_alerts.js6
-rw-r--r--config/snort/snort_alerts.widget.php35
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<data_split.length-1; x++) {
row_split = data_split[x].split("||");
var line = '';
- line = '<td class="' + snortWidgetColClass + '">' + row_split[0] + '<br/>' + row_split[1] + '</td>';
- line += '<td class="' + snortWidgetColClass + '" style="overflow: hidden; text-overflow: ellipsis;" nowrap>';
+ line = '<td class="listMRr">' + row_split[0] + '<br/>' + row_split[1] + '</td>';
+ line += '<td class="listMRr" style="overflow: hidden; text-overflow: ellipsis;" nowrap>';
line += '<div style="display:inline;" title="' + row_split[2] + '">' + row_split[2] + '</div><br/>';
line += '<div style="display:inline;" title="' + row_split[3] + '">' + row_split[3] + '</div></td>';
- line += '<td class="' + snortWidgetColClass + '">' + 'Priority: ' + row_split[4] + ' ' + row_split[5] + '</td>';
+ line += '<td class="listMRr"><div style="display: fixed; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.2em; max-height: 2.4em; overflow: hidden; text-overflow: ellipsis;" title="' + row_split[4] + '">' + row_split[4] + '</div></td>';
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() {
<tr>
<th class="widgetsubheader"><?=gettext("IF/Date");?></th>
<th class="widgetsubheader"><?=gettext("Src/Dst Address");?></th>
- <th class="widgetsubheader"><?=gettext("Classification");?></th>
+ <th class="widgetsubheader"><?=gettext("Description");?></th>
</tr>
</thead>
<tbody id="snort-alert-entries">
@@ -216,9 +206,9 @@ function snort_widget_get_alerts() {
foreach ($snort_alerts as $alert) {
$alertRowClass = $counter % 2 ? $alertRowEvenClass : $alertRowOddClass;
echo(" <tr class='" . $alertRowClass . "'>
- <td class='" . $alertColClass . "'>" . $alert['instanceid'] . "&nbsp;" . $alert['dateonly'] . "<br/>" . $alert['timeonly'] . "</td>
- <td class='" . $alertColClass . "' style='overflow: hidden; text-overflow: ellipsis;' nowrap><div style='display:inline;' title='" . $alert['src'] . "'>" . $alert['src'] . "</div><br/><div style='display:inline;' title='" . $alert['dst'] . "'>" . $alert['dst'] . "</div></td>
- <td class='" . $alertColClass . "'>Priority: " . $alert['priority'] . " " . $alert['category'] . "</td></tr>");
+ <td class='listMRr'>" . $alert['instanceid'] . "&nbsp;" . $alert['dateonly'] . "<br/>" . $alert['timeonly'] . "</td>
+ <td class='listMRr' style='overflow: hidden; text-overflow: ellipsis;' nowrap><div style='display:inline;' title='" . $alert['src'] . "'>" . $alert['src'] . "</div><br/><div style='display:inline;' title='" . $alert['dst'] . "'>" . $alert['dst'] . "</div></td>
+ <td class='listMRr'><div style='display: fixed; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.2em; max-height: 2.4em; overflow: hidden; text-overflow: ellipsis;' title='{$alert['msg']}'>" . $alert['msg'] . "</div></td></tr>");
$counter++;
if($counter >= $snort_nentries)
break;
@@ -233,9 +223,8 @@ function snort_widget_get_alerts() {
<!-- needed in the snort_alerts.js file code -->
var snortupdateDelay = 10000; // update every 10 seconds
var snort_nentries = <?=$snort_nentries;?>; // number of alerts to display (5 is default)
- var snortWidgetRowEvenClass = "<?=$alertRowEvenClass;?>"; // allows alternating background on 2.1 and higher
- var snortWidgetRowOddClass = "<?=$alertRowOddClass;?>"; // allows alternating background on 2.1 and higher
- var snortWidgetColClass = "<?=$alertColClass;?>"; // sets column CSS style (different on 2.1 and higher)
+ var snortWidgetRowEvenClass = "<?=$alertRowEvenClass;?>"; // allows alternating background
+ var snortWidgetRowOddClass = "<?=$alertRowOddClass;?>"; // allows alternating background
<!-- needed to display the widget settings menu -->
selectIntLink = "snort_alerts-configure";