Revision 45d6ada5
Added by Sjon Hortensius over 10 years ago
usr/local/www/diag_states_summary.php | ||
---|---|---|
33 | 33 |
|
34 | 34 |
/* |
35 | 35 |
pfSense_BUILDER_BINARIES: /sbin/pfctl |
36 |
pfSense_MODULE: filter
|
|
36 |
pfSense_MODULE: filter
|
|
37 | 37 |
*/ |
38 | 38 |
|
39 | 39 |
##|+PRIV |
... | ... | |
120 | 120 |
|
121 | 121 |
addipinfo($allipinfo, $srcip, $proto, $srcport, $dstport); |
122 | 122 |
addipinfo($allipinfo, $dstip, $proto, $srcport, $dstport); |
123 |
|
|
124 | 123 |
} |
125 | 124 |
} |
126 | 125 |
|
... | ... | |
134 | 133 |
$ports = array(); |
135 | 134 |
asort($portarr); |
136 | 135 |
foreach (array_reverse($portarr, TRUE) as $port => $count) { |
137 |
$str = ""; |
|
138 | 136 |
$service = getservbyport($port, strtolower($proto)); |
139 | 137 |
$port = "{$proto}/{$port}"; |
140 | 138 |
if ($service) |
... | ... | |
144 | 142 |
return implode($ports, ', '); |
145 | 143 |
} |
146 | 144 |
|
147 |
function print_summary_table($label, $iparr, $sort = TRUE) { ?> |
|
148 |
|
|
149 |
<h3><?php echo $label; ?></h3> |
|
150 |
<table class="tabcont" width="100%" border="0" cellspacing="0" cellpadding="0" summary="states summary"> |
|
151 |
<tr> |
|
152 |
<td class="listhdrr"><?=gettext("IP");?></td> |
|
153 |
<td class="listhdrr"># <?=gettext("States");?></td> |
|
154 |
<td class="listhdrr"><?=gettext("Proto");?></td> |
|
155 |
<td class="listhdrr"># <?=gettext("States");?></td> |
|
156 |
<td class="listhdrr"><?=gettext("Src Ports");?></td> |
|
157 |
<td class="listhdrr"><?=gettext("Dst Ports");?></td> |
|
158 |
</tr> |
|
159 |
<?php if ($sort) |
|
145 |
function print_summary_table($label, $iparr, $sort = TRUE) |
|
146 |
{ |
|
147 |
if ($sort) |
|
160 | 148 |
uksort($iparr, "sort_by_ip"); |
161 |
foreach($iparr as $ip => $ipinfo) { ?> |
|
162 |
<tr> |
|
163 |
<td class="vncell"><?php echo $ip; ?></td> |
|
164 |
<td class="vncell"><?php echo $ipinfo['seen']; ?></td> |
|
165 |
<td class="vncell"> </td> |
|
166 |
<td class="vncell"> </td> |
|
167 |
<td class="vncell"> </td> |
|
168 |
<td class="vncell"> </td> |
|
169 |
</tr> |
|
170 |
<?php foreach($ipinfo['protos'] as $proto => $protoinfo) { ?> |
|
171 |
<tr> |
|
172 |
<td class="list"> </td> |
|
173 |
<td class="list"> </td> |
|
174 |
<td class="listlr"><?php echo $proto; ?></td> |
|
175 |
<td class="listr" align="center"><?php echo $protoinfo['seen']; ?></td> |
|
176 |
<td class="listr" align="center"><span title="<?php echo build_port_info($protoinfo['srcports'], $proto); ?>"><?php echo count($protoinfo['srcports']); ?></span></td> |
|
177 |
<td class="listr" align="center"><span title="<?php echo build_port_info($protoinfo['dstports'], $proto); ?>"><?php echo count($protoinfo['dstports']); ?></span></td> |
|
178 |
</tr> |
|
179 |
<?php } ?> |
|
180 |
<?php } ?> |
|
181 |
|
|
182 |
</table> |
|
183 | 149 |
|
150 |
?> |
|
151 |
<div class="panel panel-default"> |
|
152 |
<div class="panel-heading"> |
|
153 |
<h2 class="panel-title"><?=$label?></h2> |
|
154 |
</div> |
|
155 |
<div class="panel-body"> |
|
156 |
<div class="table-responsive"> |
|
157 |
<table class="table table-hover table-condensed table-striped"> |
|
158 |
<thead> |
|
159 |
<tr> |
|
160 |
<th ><?=gettext("IP");?></th> |
|
161 |
<th class="text-center"># <?=gettext("States");?></th> |
|
162 |
<th ><?=gettext("Proto");?></th> |
|
163 |
<th class="text-center"># <?=gettext("States");?></th> |
|
164 |
<th class="text-center"><?=gettext("Src Ports");?></th> |
|
165 |
<th class="text-center"><?=gettext("Dst Ports");?></th> |
|
166 |
</tr> |
|
167 |
</thead> |
|
168 |
<tbody> |
|
169 |
<?php foreach($iparr as $ip => $ipinfo): |
|
170 |
$protocolCount = count($ipinfo['protos']); |
|
171 |
$rowSpan = ''; |
|
172 |
$i = 0; |
|
173 |
|
|
174 |
if ($protocolCount > 1) |
|
175 |
$rowSpan = ' rowspan="' . $protocolCount . '"'; |
|
176 |
?> |
|
177 |
<tr> |
|
178 |
<td<?= $rowSpan ?>><?php echo $ip; ?></td> |
|
179 |
<td<?= $rowSpan ?> class="text-center"><?php echo $ipinfo['seen']; ?></td> |
|
180 |
|
|
181 |
<?php foreach($ipinfo['protos'] as $proto => $protoinfo): ?> |
|
182 |
<?php if ($protocolCount > 1 && $i > 0): ?> |
|
183 |
</tr><tr> |
|
184 |
<?php endif; ?> |
|
185 |
<td><?php echo $proto; ?></td> |
|
186 |
<td class="text-center" ><?php echo $protoinfo['seen']; ?></td> |
|
187 |
<td class="text-center" ><span title="<?php echo build_port_info($protoinfo['srcports'], $proto); ?>"><?php echo count($protoinfo['srcports']); ?></span></td> |
|
188 |
<td class="text-center" ><span title="<?php echo build_port_info($protoinfo['dstports'], $proto); ?>"><?php echo count($protoinfo['dstports']); ?></span></td> |
|
189 |
<?php $i++; endforeach; ?> |
|
190 |
</tr> |
|
191 |
<?php endforeach; ?> |
|
192 |
</tbody> |
|
193 |
</table> |
|
194 |
</div> |
|
195 |
</div> |
|
196 |
</div> |
|
184 | 197 |
<?php |
185 | 198 |
} |
186 | 199 |
|
187 | 200 |
$pgtitle = array(gettext("Diagnostics"),gettext("State Table Summary")); |
188 | 201 |
require_once("guiconfig.inc"); |
189 | 202 |
include("head.inc"); |
190 |
echo "<body>"; |
|
191 |
include("fbegin.inc"); |
|
192 |
|
|
193 | 203 |
|
194 | 204 |
print_summary_table(gettext("By Source IP"), $srcipinfo); |
195 | 205 |
print_summary_table(gettext("By Destination IP"), $dstipinfo); |
196 | 206 |
print_summary_table(gettext("Total per IP"), $allipinfo); |
197 | 207 |
print_summary_table(gettext("By IP Pair"), $pairipinfo, FALSE); |
198 |
?> |
|
199 | 208 |
|
200 |
<?php include("fend.inc"); ?> |
|
201 |
</body> |
|
202 |
</html> |
|
209 |
include("foot.inc"); |
Also available in: Unified diff
Revert "Merge pull request #100 from sbeaver-netgate/halt"
This reverts commit 5bd406696ae634b3993d79a8b9aef03eeab42488, reversing
changes made to b9bd62735f2afb818d9ff3afd399c6c7d3b904c5.