1 |
438d04f6
|
Scott Ullrich
|
<?php
|
2 |
|
|
/* $Id$ */
|
3 |
|
|
/*
|
4 |
45d6ada5
|
Sjon Hortensius
|
diag_pf_info.php
|
5 |
|
|
Copyright (C) 2010 Scott Ullrich
|
6 |
|
|
Copyright (C) 2013-2015 Electric Sheep Fencing, LP
|
7 |
|
|
All rights reserved.
|
8 |
|
|
|
9 |
|
|
Redistribution and use in source and binary forms, with or without
|
10 |
|
|
modification, are permitted provided that the following conditions are met:
|
11 |
|
|
|
12 |
|
|
1. Redistributions of source code must retain the above copyright notice,
|
13 |
|
|
this list of conditions and the following disclaimer.
|
14 |
|
|
|
15 |
|
|
2. Redistributions in binary form must reproduce the above copyright
|
16 |
|
|
notice, this list of conditions and the following disclaimer in the
|
17 |
|
|
documentation and/or other materials provided with the distribution.
|
18 |
|
|
|
19 |
|
|
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
20 |
|
|
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
21 |
|
|
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
22 |
|
|
AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
23 |
|
|
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
24 |
|
|
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
25 |
|
|
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
26 |
|
|
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
27 |
|
|
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
28 |
|
|
POSSIBILITY OF SUCH DAMAGE.
|
29 |
438d04f6
|
Scott Ullrich
|
*/
|
30 |
|
|
|
31 |
|
|
/*
|
32 |
|
|
pfSense_BUILDER_BINARIES: /usr/bin/top
|
33 |
45d6ada5
|
Sjon Hortensius
|
pfSense_MODULE: system
|
34 |
438d04f6
|
Scott Ullrich
|
*/
|
35 |
|
|
|
36 |
|
|
##|+PRIV
|
37 |
7997ed44
|
Renato Botelho
|
##|*IDENT=page-diagnostics-pf-info
|
38 |
|
|
##|*NAME=Diagnostics: pfInfo
|
39 |
|
|
##|*DESCR=Allows access to the 'Diagnostics: pfInfo' page
|
40 |
|
|
##|*MATCH=diag_pf_info.php*
|
41 |
438d04f6
|
Scott Ullrich
|
##|-PRIV
|
42 |
|
|
|
43 |
|
|
require("guiconfig.inc");
|
44 |
|
|
|
45 |
79992f17
|
Scott Ullrich
|
$pgtitle = gettext("Diagnostics: pfInfo");
|
46 |
438d04f6
|
Scott Ullrich
|
|
47 |
45d6ada5
|
Sjon Hortensius
|
if (stristr($_POST['Submit'], gettext("No"))) {
|
48 |
|
|
header("Location: index.php");
|
49 |
|
|
exit;
|
50 |
|
|
}
|
51 |
|
|
|
52 |
438d04f6
|
Scott Ullrich
|
if($_REQUEST['getactivity']) {
|
53 |
|
|
$text = `/sbin/pfctl -vvsi`;
|
54 |
|
|
$text .= "<p/>";
|
55 |
7fd51c68
|
Scott Ullrich
|
$text .= `/sbin/pfctl -vvsm`;
|
56 |
|
|
$text .= "<p/>";
|
57 |
|
|
$text .= `/sbin/pfctl -vvst`;
|
58 |
|
|
$text .= "<p/>";
|
59 |
438d04f6
|
Scott Ullrich
|
$text .= `/sbin/pfctl -vvsI`;
|
60 |
|
|
echo $text;
|
61 |
|
|
exit;
|
62 |
|
|
}
|
63 |
|
|
|
64 |
|
|
include("head.inc");
|
65 |
|
|
|
66 |
45d6ada5
|
Sjon Hortensius
|
if ($input_errors)
|
67 |
|
|
print_input_errors($input_errors);
|
68 |
|
|
|
69 |
|
|
require('classes/Form.class.php');
|
70 |
|
|
$form = new Form(false);
|
71 |
|
|
$form->addGlobal(new Form_Input(
|
72 |
|
|
'getactivity',
|
73 |
|
|
null,
|
74 |
|
|
'hidden',
|
75 |
|
|
'yes'
|
76 |
|
|
));
|
77 |
|
|
$section = new Form_Section('Auto update page');
|
78 |
|
|
|
79 |
|
|
$section->addInput(new Form_Checkbox(
|
80 |
|
|
'refresh',
|
81 |
|
|
'Refresh',
|
82 |
|
|
'Automatically refresh the output below',
|
83 |
|
|
true
|
84 |
|
|
));
|
85 |
|
|
|
86 |
|
|
$form->add($section);
|
87 |
|
|
print $form;
|
88 |
|
|
|
89 |
438d04f6
|
Scott Ullrich
|
?>
|
90 |
45d6ada5
|
Sjon Hortensius
|
<script>
|
91 |
1cbbef94
|
Warren Baker
|
function getpfinfo() {
|
92 |
45d6ada5
|
Sjon Hortensius
|
if (!$('#refresh').is(':checked'))
|
93 |
|
|
return;
|
94 |
|
|
|
95 |
|
|
$.ajax(
|
96 |
|
|
'/diag_pf_info.php',
|
97 |
|
|
{
|
98 |
|
|
type: 'post',
|
99 |
|
|
data: $(document.forms[0]).serialize(),
|
100 |
|
|
success: function (data) {
|
101 |
|
|
$('#xhrOutput').html(data);
|
102 |
|
|
},
|
103 |
1cbbef94
|
Warren Baker
|
});
|
104 |
438d04f6
|
Scott Ullrich
|
}
|
105 |
45d6ada5
|
Sjon Hortensius
|
|
106 |
|
|
events.push(function(){
|
107 |
|
|
setInterval('getpfinfo()', 2500);
|
108 |
|
|
getpfinfo();
|
109 |
|
|
});
|
110 |
438d04f6
|
Scott Ullrich
|
</script>
|
111 |
45d6ada5
|
Sjon Hortensius
|
|
112 |
|
|
<div class="panel panel-default">
|
113 |
|
|
<div class="panel-heading"><?=gettext('Output')?></div>
|
114 |
|
|
<div class="panel panel-body">
|
115 |
|
|
<pre id="xhrOutput"><?=gettext("Gathering PF information, please wait...")?></pre>
|
116 |
|
|
</div>
|
117 |
7442b5c6
|
Colin Fleming
|
</div>
|
118 |
45d6ada5
|
Sjon Hortensius
|
|
119 |
|
|
<?php include("foot.inc");
|