diff options
Diffstat (limited to 'src/usr/local/www/diag_states_summary.php')
-rw-r--r-- | src/usr/local/www/diag_states_summary.php | 179 |
1 files changed, 104 insertions, 75 deletions
diff --git a/src/usr/local/www/diag_states_summary.php b/src/usr/local/www/diag_states_summary.php index 7aa91d6..587ddcd 100644 --- a/src/usr/local/www/diag_states_summary.php +++ b/src/usr/local/www/diag_states_summary.php @@ -1,39 +1,63 @@ <?php /* diag_states_summary.php - Copyright (C) 2013-2015 Electric Sheep Fencing, LP - Copyright (C) 2010-2014 Jim Pingle - - Portions borrowed from diag_dump_states.php: - Copyright (C) 2005-2009 Scott Ullrich - Copyright (C) 2005 Colin Smith - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, - OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. */ +/* ==================================================================== + * Copyright (c) 2004-2015 Electric Sheep Fencing, LLC. All rights reserved. + * Copyright (c) 2005-2009 Scott Ullrich + * Copyright (c) 2005 Colin Smith + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgment: + * "This product includes software developed by the pfSense Project + * for use in the pfSense software distribution. (http://www.pfsense.org/). + * + * 4. The names "pfSense" and "pfSense Project" must not be used to + * endorse or promote products derived from this software without + * prior written permission. For written permission, please contact + * coreteam@pfsense.org. + * + * 5. Products derived from this software may not be called "pfSense" + * nor may "pfSense" appear in their names without prior written + * permission of the Electric Sheep Fencing, LLC. + * + * 6. Redistributions of any form whatsoever must retain the following + * acknowledgment: + * + * "This product includes software developed by the pfSense Project + * for use in the pfSense software distribution (http://www.pfsense.org/). + * + * THIS SOFTWARE IS PROVIDED BY THE pfSense PROJECT ``AS IS'' AND ANY + * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE pfSense PROJECT OR + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * + * ==================================================================== + * + */ /* pfSense_BUILDER_BINARIES: /sbin/pfctl - pfSense_MODULE: filter + pfSense_MODULE: filter */ ##|+PRIV @@ -120,7 +144,6 @@ if (count($states) > 0) { addipinfo($allipinfo, $srcip, $proto, $srcport, $dstport); addipinfo($allipinfo, $dstip, $proto, $srcport, $dstport); - } } @@ -135,7 +158,6 @@ function build_port_info($portarr, $proto) { $ports = array(); asort($portarr); foreach (array_reverse($portarr, TRUE) as $port => $count) { - $str = ""; $service = getservbyport($port, strtolower($proto)); $port = "{$proto}/{$port}"; if ($service) { @@ -146,61 +168,68 @@ function build_port_info($portarr, $proto) { return implode($ports, ', '); } -function print_summary_table($label, $iparr, $sort = TRUE) { ?> - -<h3><?php echo $label; ?></h3> -<table class="tabcont" width="100%" border="0" cellspacing="0" cellpadding="0" summary="states summary"> - <tr> - <td class="listhdrr"><?=gettext("IP");?></td> - <td class="listhdrr"># <?=gettext("States");?></td> - <td class="listhdrr"><?=gettext("Proto");?></td> - <td class="listhdrr"># <?=gettext("States");?></td> - <td class="listhdrr"><?=gettext("Src Ports");?></td> - <td class="listhdrr"><?=gettext("Dst Ports");?></td> - </tr> -<?php - if ($sort) { +function print_summary_table($label, $iparr, $sort = TRUE) +{ + if ($sort) uksort($iparr, "sort_by_ip"); - } - foreach ($iparr as $ip => $ipinfo) { ?> - <tr> - <td class="vncell"><?php echo $ip; ?></td> - <td class="vncell"><?php echo $ipinfo['seen']; ?></td> - <td class="vncell"> </td> - <td class="vncell"> </td> - <td class="vncell"> </td> - <td class="vncell"> </td> - </tr> - <?php foreach ($ipinfo['protos'] as $proto => $protoinfo) { ?> - <tr> - <td class="list"> </td> - <td class="list"> </td> - <td class="listlr"><?php echo $proto; ?></td> - <td class="listr" align="center"><?php echo $protoinfo['seen']; ?></td> - <td class="listr" align="center"><span title="<?php echo build_port_info($protoinfo['srcports'], $proto); ?>"><?php echo count($protoinfo['srcports']); ?></span></td> - <td class="listr" align="center"><span title="<?php echo build_port_info($protoinfo['dstports'], $proto); ?>"><?php echo count($protoinfo['dstports']); ?></span></td> - </tr> - <?php } ?> -<?php } ?> - -</table> +?> + <div class="panel panel-default"> + <div class="panel-heading"> + <h2 class="panel-title"><?=$label?></h2> + </div> + <div class="panel-body"> + <div class="table-responsive"> + <table class="table table-hover table-condensed table-striped"> + <thead> + <tr> + <th ><?=gettext("IP");?></th> + <th class="text-center"># <?=gettext("States");?></th> + <th ><?=gettext("Proto");?></th> + <th class="text-center"># <?=gettext("States");?></th> + <th class="text-center"><?=gettext("Src Ports");?></th> + <th class="text-center"><?=gettext("Dst Ports");?></th> + </tr> + </thead> + <tbody> +<?php foreach($iparr as $ip => $ipinfo): + $protocolCount = count($ipinfo['protos']); + $rowSpan = ''; + $i = 0; + + if ($protocolCount > 1) + $rowSpan = ' rowspan="' . $protocolCount . '"'; +?> + <tr> + <td<?= $rowSpan ?>><?php echo $ip; ?></td> + <td<?= $rowSpan ?> class="text-center"><?php echo $ipinfo['seen']; ?></td> + +<?php foreach($ipinfo['protos'] as $proto => $protoinfo): ?> +<?php if ($protocolCount > 1 && $i > 0): ?> + </tr><tr> +<?php endif; ?> + <td><?php echo $proto; ?></td> + <td class="text-center" ><?php echo $protoinfo['seen']; ?></td> + <td class="text-center" ><span title="<?php echo build_port_info($protoinfo['srcports'], $proto); ?>"><?php echo count($protoinfo['srcports']); ?></span></td> + <td class="text-center" ><span title="<?php echo build_port_info($protoinfo['dstports'], $proto); ?>"><?php echo count($protoinfo['dstports']); ?></span></td> +<?php $i++; endforeach; ?> + </tr> +<?php endforeach; ?> + </tbody> + </table> + </div> + </div> + </div> <?php } $pgtitle = array(gettext("Diagnostics"), gettext("State Table Summary")); require_once("guiconfig.inc"); include("head.inc"); -echo "<body>"; -include("fbegin.inc"); - print_summary_table(gettext("By Source IP"), $srcipinfo); print_summary_table(gettext("By Destination IP"), $dstipinfo); print_summary_table(gettext("Total per IP"), $allipinfo); print_summary_table(gettext("By IP Pair"), $pairipinfo, FALSE); -?> -<?php include("fend.inc"); ?> -</body> -</html> +include("foot.inc");
\ No newline at end of file |