aboutsummaryrefslogtreecommitdiffstats
path: root/config/suricata/suricata_alerts.widget.php
diff options
context:
space:
mode:
Diffstat (limited to 'config/suricata/suricata_alerts.widget.php')
-rw-r--r--config/suricata/suricata_alerts.widget.php53
1 files changed, 31 insertions, 22 deletions
diff --git a/config/suricata/suricata_alerts.widget.php b/config/suricata/suricata_alerts.widget.php
index 370c6e96..21fad03d 100644
--- a/config/suricata/suricata_alerts.widget.php
+++ b/config/suricata/suricata_alerts.widget.php
@@ -80,8 +80,8 @@ if (isset($_GET['getNewAlerts'])) {
$suri_alerts = suricata_widget_get_alerts();
$counter = 0;
foreach ($suri_alerts as $a) {
- $response .= $a['instanceid'] . " " . $a['dateonly'] . "||" . $a['timeonly'] . "||" . $a['src'] . ":" . $a['srcport'] . "||";
- $response .= $a['dst'] . ":" . $a['dstport'] . "||" . $a['priority'] . "||" . $a['category'] . "\n";
+ $response .= $a['instanceid'] . " " . $a['dateonly'] . "||" . $a['timeonly'] . "||" . $a['src'] . "||";
+ $response .= $a['dst'] . "||" . $a['priority'] . "||" . $a['category'] . "\n";
$counter++;
if($counter >= $suri_nentries)
break;
@@ -134,10 +134,22 @@ function suricata_widget_get_alerts() {
$suricata_alerts[$counter]['timestamp'] = strval(date_timestamp_get($event_tm));
$suricata_alerts[$counter]['timeonly'] = date_format($event_tm, "H:i:s");
$suricata_alerts[$counter]['dateonly'] = date_format($event_tm, "M d");
- $suricata_alerts[$counter]['src'] = $fields[9];
- $suricata_alerts[$counter]['srcport'] = $fields[10];
- $suricata_alerts[$counter]['dst'] = $fields[11];
- $suricata_alerts[$counter]['dstport'] = $fields[12];
+ // Add square brackets around any IPv6 address
+ if (is_ipaddrv6($fields[9]))
+ $suricata_alerts[$counter]['src'] = "[" . $fields[9] . "]";
+ else
+ $suricata_alerts[$counter]['src'] = $fields[9];
+ // Add the SRC PORT if not null
+ if (!empty($fields[10]))
+ $suricata_alerts[$counter]['src'] .= ":" . $fields[10];
+ // Add square brackets around any IPv6 address
+ if (is_ipaddrv6($fields[11]))
+ $suricata_alerts[$counter]['dst'] = "[" . $fields[11] . "]";
+ else
+ $suricata_alerts[$counter]['dst'] = $fields[11];
+ // Add the SRC PORT if not null
+ if (!empty($fields[12]))
+ $suricata_alerts[$counter]['dst'] .= ":" . $fields[12];
$suricata_alerts[$counter]['priority'] = $fields[7];
$suricata_alerts[$counter]['category'] = $fields[6];
$counter++;
@@ -161,13 +173,6 @@ function suricata_widget_get_alerts() {
/* display the result */
?>
-<script type="text/javascript">
-//<![CDATA[
-var suricataupdateDelay = 10000; // update every 10 second
-var suri_nentries = <?php echo $suri_nentries; ?>;
-//]]>
-</script>
-
<input type="hidden" id="suricata_alerts-config" name="suricata_alerts-config" value=""/>
<div id="suricata_alerts-settings" class="widgetconfigdiv" style="display:none;">
<form action="/widgets/widgets/suricata_alerts.widget.php" method="post" name="iformd">
@@ -177,12 +182,17 @@ var suri_nentries = <?php echo $suri_nentries; ?>;
</form>
</div>
-<table width="100%" border="0" cellspacing="0" cellpadding="0">
+<table width="100%" border="0" cellspacing="0" cellpadding="0" style="table-layout: fixed;">
+ <colgroup>
+ <col style="width: 24%;" />
+ <col style="width: 38%;" />
+ <col style="width: 38%;" />
+ </colgroup>
<thead>
- <tr class="suricata-alert-header">
- <td width="22%" class="widgetsubheader" align="center">IF/Date</td>
- <td width="39%" class="widgetsubheader" align="center">Src/Dst</td>
- <td width="39%" class="widgetsubheader" align="center">Details</td>
+ <tr>
+ <th class="listhdrr"><?=gettext("IF/Date");?></th>
+ <th class="listhdrr"><?=gettext("Src/Dst Address");?></th>
+ <th class="listhdrr"><?=gettext("Classification");?></th>
</tr>
</thead>
<tbody id="suricata-alert-entries">
@@ -193,9 +203,9 @@ var suri_nentries = <?php echo $suri_nentries; ?>;
foreach ($suricata_alerts as $alert) {
$evenRowClass = $counter % 2 ? " listMReven" : " listMRodd";
echo(" <tr class='" . $evenRowClass . "'>
- <td width='22%' class='listMRr' nowrap>" . $alert['instanceid'] . " " . $alert['dateonly'] . "<br/>" . $alert['timeonly'] . "</td>
- <td width='39%' class='listMRr'>" . $alert['src'] . ":" . $alert['srcport'] . "<br>" . $alert['dst'] . ":" . $alert['dstport'] . "</td>
- <td width='39%' class='listMRr'>Pri: " . $alert['priority'] . "&nbsp;" . $alert['category'] . "</td></tr>");
+ <td class='listMRr'>" . $alert['instanceid'] . " " . $alert['dateonly'] . "<br/>" . $alert['timeonly'] . "</td>
+ <td class='listMRr 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'>Pri: " . $alert['priority'] . " " . $alert['category'] . "</td></tr>");
$counter++;
if($counter >= $suri_nentries)
break;
@@ -211,7 +221,6 @@ var suri_nentries = <?php echo $suri_nentries; ?>;
var suri_nentries = <?php echo $suri_nentries; ?>; // default is 5
<!-- needed to display the widget settings menu -->
-//<![CDATA[
selectIntLink = "suricata_alerts-configure";
textlink = document.getElementById(selectIntLink);
textlink.style.display = "inline";