From bca1905789f4fdf938f81a7cfe5dd98751726aa7 Mon Sep 17 00:00:00 2001 From: bmeeks8 Date: Fri, 7 Mar 2014 21:35:27 -0500 Subject: Put [] around IPv6 addr and tidy up Suri Dashboard Widget. --- config/suricata/suricata_alerts.js | 6 +++--- config/suricata/suricata_alerts.widget.php | 29 ++++++++++++++++++++--------- 2 files changed, 23 insertions(+), 12 deletions(-) diff --git a/config/suricata/suricata_alerts.js b/config/suricata/suricata_alerts.js index 9e5b0b29..16e0c73c 100644 --- a/config/suricata/suricata_alerts.js +++ b/config/suricata/suricata_alerts.js @@ -14,9 +14,9 @@ function suricata_alerts_fetch_new_rules_callback(callback_data) { for(var x=0; x' + row_split[1] + ''; - line += '' + row_split[2] + '
' + row_split[3] + ''; - line += '' + 'Pri: ' + row_split[4] + ' ' + row_split[5] + ''; + line = '' + row_split[0] + '
' + row_split[1] + ''; + line += '' + row_split[2] + '
' + row_split[3] + ''; + line += '' + 'Pri: ' + row_split[4] + ' ' + row_split[5] + ''; new_data_to_add[new_data_to_add.length] = line; } suricata_alerts_update_div_rows(new_data_to_add); diff --git a/config/suricata/suricata_alerts.widget.php b/config/suricata/suricata_alerts.widget.php index c9cfc98e..ce01c0a4 100644 --- a/config/suricata/suricata_alerts.widget.php +++ b/config/suricata/suricata_alerts.widget.php @@ -135,10 +135,16 @@ function suricata_widget_get_alerts() { $suricata_alerts[$counter]['timeonly'] = date_format($event_tm, "H:i:s"); $suricata_alerts[$counter]['dateonly'] = date_format($event_tm, "M d"); // Add zero-width space as soft-break opportunity after each colon in any IPv6 address - $suricata_alerts[$counter]['src'] = str_replace(":", ":​", $fields[9]); + if (is_ipaddrv6($fields[9]) && !empty($fields[10])) + $suricata_alerts[$counter]['src'] = "[" . str_replace(":", ":​", $fields[9]) . "]"; + else + $suricata_alerts[$counter]['src'] = $fields[9]; $suricata_alerts[$counter]['srcport'] = $fields[10]; // Add zero-width space as soft-break opportunity after each colon in any IPv6 address - $suricata_alerts[$counter]['dst'] = str_replace(":", ":​", $fields[11]); + if (is_ipaddrv6($fields[11]) && !empty($fields[12])) + $suricata_alerts[$counter]['dst'] = "[" . str_replace(":", ":​", $fields[11]) . "]"; + else + $suricata_alerts[$counter]['dst'] = $fields[11]; $suricata_alerts[$counter]['dstport'] = $fields[12]; $suricata_alerts[$counter]['priority'] = $fields[7]; $suricata_alerts[$counter]['category'] = $fields[6]; @@ -179,12 +185,17 @@ var suri_nentries = ; - +
+ + + + + - - - + + + @@ -195,9 +206,9 @@ var suri_nentries = ; foreach ($suricata_alerts as $alert) { $evenRowClass = $counter % 2 ? " listMReven" : " listMRodd"; echo(" - - - "); + + + "); $counter++; if($counter >= $suri_nentries) break; -- cgit v1.2.3
IF/DateSrc/DstDetailsIF/DateSrc/DstDetails
" . $alert['instanceid'] . " " . $alert['dateonly'] . "
" . $alert['timeonly'] . "
" . $alert['src'] . ":" . $alert['srcport'] . "
" . $alert['dst'] . ":" . $alert['dstport'] . "
Pri: " . $alert['priority'] . " " . $alert['category'] . "
" . $alert['instanceid'] . " " . $alert['dateonly'] . "
" . $alert['timeonly'] . "
" . $alert['src'] . ":" . $alert['srcport'] . "
" . $alert['dst'] . ":" . $alert['dstport'] . "
Pri: " . $alert['priority'] . " " . $alert['category'] . "