diff options
author | Chris Buechler <cmb@pfsense.org> | 2014-12-22 17:39:26 -0600 |
---|---|---|
committer | Chris Buechler <cmb@pfsense.org> | 2014-12-22 17:39:26 -0600 |
commit | b5d827f644b3ae4fbd9e7a58d6e4bb1e34897fed (patch) | |
tree | e45beb189016fb3718551deedc79058cd8d9bf95 /usr/local | |
parent | 07499022f16be530ad6caab2ef0452c1cc6dd7a2 (diff) | |
parent | acfef9f5f790a8fbdd4bafa8838ceedd227236be (diff) | |
download | pfsense-b5d827f644b3ae4fbd9e7a58d6e4bb1e34897fed.zip pfsense-b5d827f644b3ae4fbd9e7a58d6e4bb1e34897fed.tar.gz |
Merge pull request #1400 from phil-davis/patch-17
Diffstat (limited to 'usr/local')
-rwxr-xr-x | usr/local/www/diag_logs_filter_dynamic.php | 53 | ||||
-rw-r--r-- | usr/local/www/javascript/filter_log.js | 2 | ||||
-rw-r--r-- | usr/local/www/widgets/widgets/log.widget.php | 56 |
3 files changed, 91 insertions, 20 deletions
diff --git a/usr/local/www/diag_logs_filter_dynamic.php b/usr/local/www/diag_logs_filter_dynamic.php index d4722f0..2413bf2 100755 --- a/usr/local/www/diag_logs_filter_dynamic.php +++ b/usr/local/www/diag_logs_filter_dynamic.php @@ -1,7 +1,7 @@ <?php /* $Id$ */ /* - diag_logs_filter.php + diag_logs_filter_dynamic.php part of pfSesne Copyright (C) 2004-2009 Scott Ullrich Copyright (C) 2013-2014 Electric Sheep Fencing, LP @@ -83,11 +83,29 @@ include("head.inc"); ?> /* Called by the AJAX updater */ function format_log_line(row) { - var i = 0; - var line = '<td class="listMRlr nowrap" align="center">' + row[i++] + '<\/td>'; - while (i < 6) { - line += '<td class="listMRr nowrap">' + row[i++] + '<\/td>'; + if ( row[8] == '6' ) { + srcIP = '[' + row[3] + ']'; + dstIP = '[' + row[5] + ']'; + } else { + srcIP = row[3]; + dstIP = row[5]; } + + if ( row[4] == '' ) + srcPort = ''; + else + srcPort = ':' + row[4]; + if ( row[6] == '' ) + dstPort = ''; + else + dstPort = ':' + row[6]; + + var line = '<td class="listMRlr" align="center">' + row[0] + '</td>' + + '<td class="listMRr nowrap">' + row[1] + '</td>' + + '<td class="listMRr nowrap">' + row[2] + '</td>' + + '<td class="listMRr nowrap">' + srcIP + srcPort + '</td>' + + '<td class="listMRr nowrap">' + dstIP + dstPort + '</td>' + + '<td class="listMRr nowrap">' + row[7] + '</td>'; return line; } //]]> @@ -145,7 +163,25 @@ include("head.inc"); $rowIndex = 0; foreach ($filterlog as $filterent): $evenRowClass = $rowIndex % 2 ? " listMReven" : " listMRodd"; - $rowIndex++;?> + $rowIndex++; + if ($filterent['version'] == '6') { + $srcIP = "[" . htmlspecialchars($filterent['srcip']) . "]"; + $dstIP = "[" . htmlspecialchars($filterent['dstip']) . "]"; + } else { + $srcIP = htmlspecialchars($filterent['srcip']); + $dstIP = htmlspecialchars($filterent['dstip']); + } + + if ($filterent['srcport']) + $srcPort = ":" . htmlspecialchars($filterent['srcport']); + else + $srcPort = ""; + + if ($filterent['dstport']) + $dstPort = ":" . htmlspecialchars($filterent['dstport']); + else + $dstPort = ""; + ?> <tr class="<?=$evenRowClass?>"> <td class="listMRlr nowrap" align="center"> <a href="#" onclick="javascript:getURL('diag_logs_filter.php?getrulenum=<?php echo "{$filterent['rulenum']},{$filterent['act']}"; ?>', outputrule);"> @@ -154,8 +190,8 @@ include("head.inc"); </td> <td class="listMRr nowrap"><?php echo htmlspecialchars($filterent['time']);?></td> <td class="listMRr nowrap"><?php echo htmlspecialchars($filterent['interface']);?></td> - <td class="listMRr nowrap"><?php echo htmlspecialchars($filterent['src']);?></td> - <td class="listMRr nowrap"><?php echo htmlspecialchars($filterent['dst']);?></td> + <td class="listMRr nowrap"><?php echo $srcIP . $srcPort;?></td> + <td class="listMRr nowrap"><?php echo $dstIP . $dstPort;?></td> <?php if ($filterent['proto'] == "TCP") $filterent['proto'] .= ":{$filterent['tcpflags']}"; @@ -163,7 +199,6 @@ include("head.inc"); <td class="listMRr nowrap"><?php echo htmlspecialchars($filterent['proto']);?></td> </tr> <?php endforeach; ?> - <tr style="display:none;"><td></td></tr> </tbody> </table> </div> diff --git a/usr/local/www/javascript/filter_log.js b/usr/local/www/javascript/filter_log.js index 2cee6d4..66a7309 100644 --- a/usr/local/www/javascript/filter_log.js +++ b/usr/local/www/javascript/filter_log.js @@ -59,7 +59,7 @@ function fetch_new_rules_callback(callback_data) { for(var x=0; x<data_split.length-1; x++) { /* loop through rows */ row_split = data_split[x].split("||"); - lastsawtime = row_split[6]; + lastsawtime = row_split[9]; var tmp = format_log_line(row_split); if ( !(tmp) ) continue; diff --git a/usr/local/www/widgets/widgets/log.widget.php b/usr/local/www/widgets/widgets/log.widget.php index fb240fb..2677ee5 100644 --- a/usr/local/www/widgets/widgets/log.widget.php +++ b/usr/local/www/widgets/widgets/log.widget.php @@ -105,11 +105,30 @@ else /* Called by the AJAX updater */ function format_log_line(row) { - var line = '<td class="listMRlr" align="center">' + row[0] + '<\/td>' + - '<td class="listMRr ellipsis" title="' + row[1] + '">' + row[1].slice(0,-3) + '<\/td>' + - '<td class="listMRr ellipsis" title="' + row[2] + '">' + row[2] + '<\/td>' + - '<td class="listMRr ellipsis" title="' + row[3] + '">' + row[3] + '<\/td>' + - '<td class="listMRr ellipsis" title="' + row[4] + '">' + row[4] + '<\/td>'; + var rrText = "<?php echo gettext("Reverse Resolve with DNS"); ?>"; + + if ( row[8] == '6' ) { + srcIP = '[' + row[3] + ']'; + dstIP = '[' + row[5] + ']'; + } else { + srcIP = row[3]; + dstIP = row[5]; + } + + if ( row[4] == '' ) + srcPort = ''; + else + srcPort = ':' + row[4]; + if ( row[6] == '' ) + dstPort = ''; + else + dstPort = ':' + row[6]; + + var line = '<td class="listMRlr" align="center">' + row[0] + '</td>' + + '<td class="listMRr ellipsis" title="' + row[1] + '">' + row[1].slice(0,-3) + '</td>' + + '<td class="listMRr ellipsis" title="' + row[2] + '">' + row[2] + '</td>' + + '<td class="listMRr ellipsis" title="' + srcIP + srcPort + '"><a href="diag_dns.php?host=' + row[3] + '" title="' + rrText + '">' + srcIP + '</a></td>' + + '<td class="listMRr ellipsis" title="' + dstIP + dstPort + '"><a href="diag_dns.php?host=' + row[5] + '" title="' + rrText + '">' + dstIP + '</a>' + dstPort + '</td>'; var nentriesacts = "<?php echo $nentriesacts; ?>"; var nentriesinterfaces = "<?php echo $nentriesinterfaces; ?>"; @@ -188,6 +207,24 @@ function format_log_line(row) { foreach ($filterlog as $filterent): $evenRowClass = $rowIndex % 2 ? " listMReven" : " listMRodd"; $rowIndex++; + if ($filterent['version'] == '6') { + $srcIP = "[" . htmlspecialchars($filterent['srcip']) . "]"; + $dstIP = "[" . htmlspecialchars($filterent['dstip']) . "]"; + } else { + $srcIP = htmlspecialchars($filterent['srcip']); + $dstIP = htmlspecialchars($filterent['dstip']); + } + + if ($filterent['srcport']) + $srcPort = ":" . htmlspecialchars($filterent['srcport']); + else + $srcPort = ""; + + if ($filterent['dstport']) + $dstPort = ":" . htmlspecialchars($filterent['dstport']); + else + $dstPort = ""; + ?> <tr class="<?=$evenRowClass?>"> <td class="listMRlr nowrap" align="center"> @@ -197,19 +234,18 @@ function format_log_line(row) { </td> <td class="listMRr ellipsis nowrap" title="<?php echo htmlspecialchars($filterent['time']);?>"><?php echo substr(htmlspecialchars($filterent['time']),0,-3);?></td> <td class="listMRr ellipsis nowrap" title="<?php echo htmlspecialchars($filterent['interface']);?>"><?php echo htmlspecialchars($filterent['interface']);?></td> - <td class="listMRr ellipsis nowrap" title="<?php echo htmlspecialchars($filterent['src']);?>"> + <td class="listMRr ellipsis nowrap" title="<?php echo $srcIP . $srcPort;?>"> <a href="diag_dns.php?host=<?php echo "{$filterent['srcip']}"; ?>" title="<?=gettext("Reverse Resolve with DNS");?>"> - <?php echo htmlspecialchars($filterent['srcip']);?></a></td> - <td class="listMRr ellipsis nowrap" title="<?php echo htmlspecialchars($filterent['dst']);?>"> + <?php echo $srcIP;?></a></td> + <td class="listMRr ellipsis nowrap" title="<?php echo $dstIP . $dstPort;?>"> <a href="diag_dns.php?host=<?php echo "{$filterent['dstip']}"; ?>" title="<?=gettext("Reverse Resolve with DNS");?>"> - <?php echo htmlspecialchars($filterent['dstip']);?></a><?php echo ":" . htmlspecialchars($filterent['dstport']);?></td> + <?php echo $dstIP;?></a><?php echo $dstPort;?></td> <?php if ($filterent['proto'] == "TCP") $filterent['proto'] .= ":{$filterent['tcpflags']}"; ?> </tr> <?php endforeach; ?> - <tr style="display:none;"><td></td></tr> </tbody> </table> |