diff options
Diffstat (limited to 'config')
-rw-r--r-- | config/states-summary/diag_states_summary.php | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/config/states-summary/diag_states_summary.php b/config/states-summary/diag_states_summary.php index 26697bb7..973c2630 100644 --- a/config/states-summary/diag_states_summary.php +++ b/config/states-summary/diag_states_summary.php @@ -90,6 +90,20 @@ function sort_by_ip($a, $b) { return sprintf("%u", ip2long($a)) < sprintf("%u", ip2long($b)) ? -1 : 1; } +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) + $port = "{$port} ({$service})"; + $ports[] = "{$port}: {$count}"; + } + return implode($ports, ', '); +} + function print_summary_table($label, $iparr, $sort = TRUE) { ?> <h3><?php echo $label; ?></h3> @@ -119,8 +133,8 @@ function print_summary_table($label, $iparr, $sort = TRUE) { ?> <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"><?php echo count($protoinfo['srcports']); ?></td> - <td class='listr' align="center"><?php echo count($protoinfo['dstports']); ?></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 } ?> |