1
|
<?php
|
2
|
/*
|
3
|
* status_wireless.php
|
4
|
*
|
5
|
* part of pfSense (https://www.pfsense.org)
|
6
|
* Copyright (c) 2004-2018 Rubicon Communications, LLC (Netgate)
|
7
|
* All rights reserved.
|
8
|
*
|
9
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
10
|
* you may not use this file except in compliance with the License.
|
11
|
* You may obtain a copy of the License at
|
12
|
*
|
13
|
* http://www.apache.org/licenses/LICENSE-2.0
|
14
|
*
|
15
|
* Unless required by applicable law or agreed to in writing, software
|
16
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
17
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
18
|
* See the License for the specific language governing permissions and
|
19
|
* limitations under the License.
|
20
|
*/
|
21
|
|
22
|
##|+PRIV
|
23
|
##|*IDENT=page-diagnostics-wirelessstatus
|
24
|
##|*NAME=Status: Wireless
|
25
|
##|*DESCR=Allow access to the 'Status: Wireless' page.
|
26
|
##|*MATCH=status_wireless.php*
|
27
|
##|-PRIV
|
28
|
|
29
|
require_once("guiconfig.inc");
|
30
|
|
31
|
$pgtitle = array(gettext("Status"), gettext("Wireless"));
|
32
|
$shortcut_section = "wireless";
|
33
|
|
34
|
include("head.inc");
|
35
|
|
36
|
$if = $_REQUEST['if'];
|
37
|
|
38
|
$ciflist = get_configured_interface_with_descr();
|
39
|
if (empty($if)) {
|
40
|
/* Find the first interface that is wireless */
|
41
|
foreach ($ciflist as $interface => $ifdescr) {
|
42
|
if (is_interface_wireless(get_real_interface($interface))) {
|
43
|
$if = $interface;
|
44
|
break;
|
45
|
}
|
46
|
}
|
47
|
}
|
48
|
|
49
|
$tab_array = array();
|
50
|
|
51
|
foreach ($ciflist as $interface => $ifdescr) {
|
52
|
if (is_interface_wireless(get_real_interface($interface))) {
|
53
|
$enabled = false;
|
54
|
if ($if == $interface) {
|
55
|
$enabled = true;
|
56
|
}
|
57
|
|
58
|
$tab_array[] = array(gettext("Status") . " ({$ifdescr})", $enabled, "status_wireless.php?if={$interface}");
|
59
|
}
|
60
|
}
|
61
|
|
62
|
$rwlif = get_real_interface($if);
|
63
|
|
64
|
if ($_POST['rescanwifi'] != "") {
|
65
|
mwexec_bg("/sbin/ifconfig {$rwlif} scan 2>&1");
|
66
|
$savemsg = gettext("Rescan has been initiated in the background. Refresh this page in 10 seconds to see the results.");
|
67
|
}
|
68
|
|
69
|
if ($savemsg) {
|
70
|
print_info_box($savemsg, 'success');
|
71
|
}
|
72
|
|
73
|
display_top_tabs($tab_array);
|
74
|
?>
|
75
|
|
76
|
<div class="panel panel-default">
|
77
|
<div class="panel-heading"><h2 class="panel-title"><?=gettext("Nearby Access Points or Ad-Hoc Peers")?></h2></div>
|
78
|
<div class="panel-body">
|
79
|
<div class="table-responsive">
|
80
|
<table class="table table-striped table-hover table-condensed sortable-theme-bootstrap" data-sortable>
|
81
|
<thead>
|
82
|
<tr>
|
83
|
<th>SSID</th>
|
84
|
<th>BSSID</th>
|
85
|
<th>CHAN</th>
|
86
|
<th>RATE</th>
|
87
|
<th>RSSI</th>
|
88
|
<th>INT</th>
|
89
|
<th>CAPS</th>
|
90
|
</tr>
|
91
|
</thead>
|
92
|
<tbody>
|
93
|
<?php
|
94
|
exec("/sbin/ifconfig {$rwlif} list scan 2>&1", $states, $ret);
|
95
|
/* Skip Header */
|
96
|
array_shift($states);
|
97
|
|
98
|
$counter = 0;
|
99
|
foreach ($states as $state) {
|
100
|
/* Split by Mac address for the SSID Field */
|
101
|
$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);
|
102
|
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);
|
103
|
$ssid = htmlspecialchars($split[0]);
|
104
|
$bssid = $bssid[0];
|
105
|
/* Split the rest by using spaces for this line using the 2nd part */
|
106
|
$split = preg_split("/[ ]+/i", $split[1]);
|
107
|
$channel = $split[1];
|
108
|
$rate = $split[2];
|
109
|
$rssi = $split[3];
|
110
|
$int = $split[4];
|
111
|
$caps = "$split[5] $split[6] $split[7] $split[8] $split[9] $split[10] $split[11] ";
|
112
|
?>
|
113
|
<tr>
|
114
|
<td>
|
115
|
<?=$ssid?>
|
116
|
</td>
|
117
|
<td>
|
118
|
<?=$bssid?>
|
119
|
</td>
|
120
|
<td>
|
121
|
<?=$channel?>
|
122
|
</td>
|
123
|
<td>
|
124
|
<?=$rate?>
|
125
|
</td>
|
126
|
<td>
|
127
|
<?=$rssi?>
|
128
|
</td>
|
129
|
<td>
|
130
|
<?=$int?>
|
131
|
</td>
|
132
|
<td>
|
133
|
<?=$caps?>
|
134
|
</td>
|
135
|
</tr>
|
136
|
<?php
|
137
|
} // e-o-foreach
|
138
|
?>
|
139
|
</tbody>
|
140
|
</table>
|
141
|
</div>
|
142
|
</div>
|
143
|
</div>
|
144
|
|
145
|
<div class="panel panel-default">
|
146
|
<div class="panel-heading"><h2 class="panel-title"><?=gettext("Associated or Ad-Hoc Peers")?></h2></div>
|
147
|
<div class="panel-body">
|
148
|
<div class="table-responsive">
|
149
|
<table class="table table-striped table-hover table-condensed sortable-theme-bootstrap" data-sortable>
|
150
|
<thead>
|
151
|
<tr>
|
152
|
<th>ADDR</th>
|
153
|
<th>AID</th>
|
154
|
<th>CHAN</th>
|
155
|
<th>RATE</th>
|
156
|
<th>RSSI</th>
|
157
|
<th>IDLE</th>
|
158
|
<th>TXSEQ</th>
|
159
|
<th>RXSEQ</th>
|
160
|
<th>CAPS</th>
|
161
|
<th>ERP</th>
|
162
|
</tr>
|
163
|
</thead>
|
164
|
<tbody>
|
165
|
|
166
|
<?php
|
167
|
$states = array();
|
168
|
exec("/sbin/ifconfig {$rwlif} list sta 2>&1", $states, $ret);
|
169
|
array_shift($states);
|
170
|
|
171
|
$counter=0;
|
172
|
|
173
|
foreach ($states as $state) {
|
174
|
$split = preg_split("/[ ]+/i", $state);
|
175
|
?>
|
176
|
<tr>
|
177
|
<?php
|
178
|
/* Split the rest by using spaces for this line using the 2nd part */
|
179
|
for ($idx=0; $idx<10; $idx++) {
|
180
|
?>
|
181
|
<td>
|
182
|
<?=$split[$idx]?>
|
183
|
</td>
|
184
|
<?php
|
185
|
}
|
186
|
?>
|
187
|
</tr>
|
188
|
<?php
|
189
|
}
|
190
|
?>
|
191
|
</tbody>
|
192
|
</table>
|
193
|
</div>
|
194
|
</div>
|
195
|
</div>
|
196
|
|
197
|
|
198
|
<form action="status_wireless.php" method="post">
|
199
|
<nav class="action-buttons">
|
200
|
<input type="hidden" name="if" id="if" value="<?=htmlspecialchars($if)?>" />
|
201
|
<button type="submit" class="btn btn-success" name="rescanwifi" id="rescanwifi" value="Rescan">
|
202
|
<i class="fa fa-refresh icon-embed-btn"></i>
|
203
|
<?=gettext("Rescan")?>
|
204
|
</button>
|
205
|
</nav>
|
206
|
</form>
|
207
|
<div class="infoblock">
|
208
|
<?php
|
209
|
print_info_box(sprintf(gettext('%1$sFlags:%2$s A = authorized, E = Extended Rate (802.11g), P = Power saving mode.%3$s' .
|
210
|
'%1$sCapabilities:%2$s E = ESS (infrastructure mode), I = IBSS (ad-hoc mode), P = privacy (WEP/TKIP/AES), ' .
|
211
|
'S = Short preamble, s = Short slot time.'), '<b>', '</b>', '<br />'), 'info', false);
|
212
|
?>
|
213
|
</div>
|
214
|
<?php
|
215
|
include("foot.inc");
|