1
|
<?php
|
2
|
/*
|
3
|
status_wireless.php
|
4
|
*/
|
5
|
/* ====================================================================
|
6
|
* Copyright (c) 2004-2015 Electric Sheep Fencing, LLC. All rights reserved.
|
7
|
*
|
8
|
* Redistribution and use in source and binary forms, with or without modification,
|
9
|
* are permitted provided that the following conditions are met:
|
10
|
*
|
11
|
* 1. Redistributions of source code must retain the above copyright notice,
|
12
|
* this list of conditions and the following disclaimer.
|
13
|
*
|
14
|
* 2. Redistributions in binary form must reproduce the above copyright
|
15
|
* notice, this list of conditions and the following disclaimer in
|
16
|
* the documentation and/or other materials provided with the
|
17
|
* distribution.
|
18
|
*
|
19
|
* 3. All advertising materials mentioning features or use of this software
|
20
|
* must display the following acknowledgment:
|
21
|
* "This product includes software developed by the pfSense Project
|
22
|
* for use in the pfSense software distribution. (http://www.pfsense.org/).
|
23
|
*
|
24
|
* 4. The names "pfSense" and "pfSense Project" must not be used to
|
25
|
* endorse or promote products derived from this software without
|
26
|
* prior written permission. For written permission, please contact
|
27
|
* coreteam@pfsense.org.
|
28
|
*
|
29
|
* 5. Products derived from this software may not be called "pfSense"
|
30
|
* nor may "pfSense" appear in their names without prior written
|
31
|
* permission of the Electric Sheep Fencing, LLC.
|
32
|
*
|
33
|
* 6. Redistributions of any form whatsoever must retain the following
|
34
|
* acknowledgment:
|
35
|
*
|
36
|
* "This product includes software developed by the pfSense Project
|
37
|
* for use in the pfSense software distribution (http://www.pfsense.org/).
|
38
|
*
|
39
|
* THIS SOFTWARE IS PROVIDED BY THE pfSense PROJECT ``AS IS'' AND ANY
|
40
|
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
41
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
42
|
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE pfSense PROJECT OR
|
43
|
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
44
|
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
45
|
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
46
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
47
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
48
|
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
49
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
50
|
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
51
|
*
|
52
|
* ====================================================================
|
53
|
*
|
54
|
*/
|
55
|
|
56
|
##|+PRIV
|
57
|
##|*IDENT=page-diagnostics-wirelessstatus
|
58
|
##|*NAME=Status: Wireless
|
59
|
##|*DESCR=Allow access to the 'Status: Wireless' page.
|
60
|
##|*MATCH=status_wireless.php*
|
61
|
##|-PRIV
|
62
|
|
63
|
require_once("guiconfig.inc");
|
64
|
|
65
|
$pgtitle = array(gettext("Status"), gettext("Wireless"));
|
66
|
$shortcut_section = "wireless";
|
67
|
|
68
|
include("head.inc");
|
69
|
|
70
|
$if = $_POST['if'];
|
71
|
|
72
|
if ($_GET['if'] != "") {
|
73
|
$if = $_GET['if'];
|
74
|
}
|
75
|
|
76
|
$ciflist = get_configured_interface_with_descr();
|
77
|
if (empty($if)) {
|
78
|
/* Find the first interface that is wireless */
|
79
|
foreach ($ciflist as $interface => $ifdescr) {
|
80
|
if (is_interface_wireless(get_real_interface($interface))) {
|
81
|
$if = $interface;
|
82
|
break;
|
83
|
}
|
84
|
}
|
85
|
}
|
86
|
|
87
|
$tab_array = array();
|
88
|
|
89
|
foreach ($ciflist as $interface => $ifdescr) {
|
90
|
if (is_interface_wireless(get_real_interface($interface))) {
|
91
|
$enabled = false;
|
92
|
if ($if == $interface) {
|
93
|
$enabled = true;
|
94
|
}
|
95
|
|
96
|
$tab_array[] = array(gettext("Status") . " ({$ifdescr})", $enabled, "status_wireless.php?if={$interface}");
|
97
|
}
|
98
|
}
|
99
|
|
100
|
$rwlif = get_real_interface($if);
|
101
|
|
102
|
if ($_POST['rescanwifi'] != "") {
|
103
|
mwexec_bg("/sbin/ifconfig {$rwlif} scan 2>&1");
|
104
|
$savemsg = gettext("Rescan has been initiated in the background. Refresh this page in 10 seconds to see the results.");
|
105
|
}
|
106
|
|
107
|
if ($savemsg) {
|
108
|
print_info_box($savemsg, 'success');
|
109
|
}
|
110
|
|
111
|
display_top_tabs($tab_array);
|
112
|
?>
|
113
|
|
114
|
<div class="panel panel-default">
|
115
|
<div class="panel-heading"><h2 class="panel-title"><?=gettext("Nearby Access Points or Ad-Hoc Peers")?></h2></div>
|
116
|
<div class="panel-body">
|
117
|
<div class="table-responsive">
|
118
|
<table class="table table-striped table-hover table-condensed sortable-theme-bootstrap" data-sortable>
|
119
|
<thead>
|
120
|
<tr>
|
121
|
<th>SSID</th>
|
122
|
<th>BSSID</th>
|
123
|
<th>CHAN</th>
|
124
|
<th>RATE</th>
|
125
|
<th>RSSI</th>
|
126
|
<th>INT</th>
|
127
|
<th>CAPS</th>
|
128
|
</tr>
|
129
|
</thead>
|
130
|
<tbody>
|
131
|
<?php
|
132
|
exec("/sbin/ifconfig {$rwlif} list scan 2>&1", $states, $ret);
|
133
|
/* Skip Header */
|
134
|
array_shift($states);
|
135
|
|
136
|
$counter = 0;
|
137
|
foreach ($states as $state) {
|
138
|
/* Split by Mac address for the SSID Field */
|
139
|
$split = preg_split("/([0-9a-f][[0-9a-f]\:[0-9a-f][[0-9a-f]\:[0-9a-f][[0-9a-f]\:[0-9a-f][[0-9a-f]\:[0-9a-f][[0-9a-f]\:[0-9a-f][[0-9a-f])/i", $state);
|
140
|
preg_match("/([0-9a-f][[0-9a-f]\:[0-9a-f][[0-9a-f]\:[0-9a-f][[0-9a-f]\:[0-9a-f][[0-9a-f]\:[0-9a-f][[0-9a-f]\:[0-9a-f][[0-9a-f])/i", $state, $bssid);
|
141
|
$ssid = htmlspecialchars($split[0]);
|
142
|
$bssid = $bssid[0];
|
143
|
/* Split the rest by using spaces for this line using the 2nd part */
|
144
|
$split = preg_split("/[ ]+/i", $split[1]);
|
145
|
$channel = $split[1];
|
146
|
$rate = $split[2];
|
147
|
$rssi = $split[3];
|
148
|
$int = $split[4];
|
149
|
$caps = "$split[5] $split[6] $split[7] $split[8] $split[9] $split[10] $split[11] ";
|
150
|
?>
|
151
|
<tr>
|
152
|
<td>
|
153
|
<?=$ssid?>
|
154
|
</td>
|
155
|
<td>
|
156
|
<?=$bssid?>
|
157
|
</td>
|
158
|
<td>
|
159
|
<?=$channel?>
|
160
|
</td>
|
161
|
<td>
|
162
|
<?=$rate?>
|
163
|
</td>
|
164
|
<td>
|
165
|
<?=$rssi?>
|
166
|
</td>
|
167
|
<td>
|
168
|
<?=$int?>
|
169
|
</td>
|
170
|
<td>
|
171
|
<?=$caps?>
|
172
|
</td>
|
173
|
</tr>
|
174
|
<?php
|
175
|
} // e-o-foreach
|
176
|
?>
|
177
|
</tbody>
|
178
|
</table>
|
179
|
</div>
|
180
|
</div>
|
181
|
</div>
|
182
|
|
183
|
<div class="panel panel-default">
|
184
|
<div class="panel-heading"><h2 class="panel-title"><?=gettext("Associated or Ad-Hoc Peers")?></h2></div>
|
185
|
<div class="panel-body">
|
186
|
<div class="table-responsive">
|
187
|
<table class="table table-striped table-hover table-condensed sortable-theme-bootstrap" data-sortable>
|
188
|
<thead>
|
189
|
<tr>
|
190
|
<th>ADDR</th>
|
191
|
<th>AID</th>
|
192
|
<th>CHAN</th>
|
193
|
<th>RATE</th>
|
194
|
<th>RSSI</th>
|
195
|
<th>IDLE</th>
|
196
|
<th>TXSEQ</th>
|
197
|
<th>RXSEQ</th>
|
198
|
<th>CAPS</th>
|
199
|
<th>ERP</th>
|
200
|
</tr>
|
201
|
</thead>
|
202
|
<tbody>
|
203
|
|
204
|
<?php
|
205
|
$states = array();
|
206
|
exec("/sbin/ifconfig {$rwlif} list sta 2>&1", $states, $ret);
|
207
|
array_shift($states);
|
208
|
|
209
|
$counter=0;
|
210
|
|
211
|
foreach ($states as $state) {
|
212
|
$split = preg_split("/[ ]+/i", $state);
|
213
|
?>
|
214
|
<tr>
|
215
|
<?php
|
216
|
/* Split the rest by using spaces for this line using the 2nd part */
|
217
|
for ($idx=0; $idx<10; $idx++) {
|
218
|
?>
|
219
|
<td>
|
220
|
<?=$split[$idx]?>
|
221
|
</td>
|
222
|
<?php
|
223
|
}
|
224
|
?>
|
225
|
</tr>
|
226
|
<?php
|
227
|
}
|
228
|
?>
|
229
|
</tbody>
|
230
|
</table>
|
231
|
</div>
|
232
|
</div>
|
233
|
</div>
|
234
|
|
235
|
|
236
|
<form action="status_wireless.php" method="post">
|
237
|
<nav class="action-buttons">
|
238
|
<input type="hidden" name="if" id="if" value="<?=htmlspecialchars($if)?>" />
|
239
|
<button type="submit" class="btn btn-success" name="rescanwifi" id="rescanwifi" value="Rescan">
|
240
|
<i class="fa fa-refresh icon-embed-btn"></i>
|
241
|
<?=gettext("Rescan")?>
|
242
|
</button>
|
243
|
</nav>
|
244
|
</form>
|
245
|
<div class="infoblock">
|
246
|
<?php
|
247
|
print_info_box(gettext('<b>Flags:</b> A = authorized, E = Extended Rate (802.11g), P = Power saving mode.<br />' .
|
248
|
'<b>Capabilities:</b> E = ESS (infrastructure mode), I = IBSS (ad-hoc mode), P = privacy (WEP/TKIP/AES), ' .
|
249
|
'S = Short preamble, s = Short slot time.'), 'info', false);
|
250
|
?>
|
251
|
</div>
|
252
|
<?php
|
253
|
include("foot.inc");
|