1 |
d0330501
|
Scott Ullrich
|
<?php
|
2 |
5b237745
|
Scott Ullrich
|
/*
|
3 |
|
|
status_wireless.php
|
4 |
d0330501
|
Scott Ullrich
|
Copyright (C) 2004 Scott Ullrich
|
5 |
ce77a9c4
|
Phil Davis
|
Copyright (C) 2013-2015 Electric Sheep Fencing, LP
|
6 |
5b237745
|
Scott Ullrich
|
All rights reserved.
|
7 |
1f3a3ed2
|
jim-p
|
|
8 |
5b237745
|
Scott Ullrich
|
Redistribution and use in source and binary forms, with or without
|
9 |
|
|
modification, are permitted provided that the following conditions are met:
|
10 |
1f3a3ed2
|
jim-p
|
|
11 |
5b237745
|
Scott Ullrich
|
1. Redistributions of source code must retain the above copyright notice,
|
12 |
d0330501
|
Scott Ullrich
|
this list of conditions and the following disclaimer.
|
13 |
1f3a3ed2
|
jim-p
|
|
14 |
5b237745
|
Scott Ullrich
|
2. Redistributions in binary form must reproduce the above copyright
|
15 |
d0330501
|
Scott Ullrich
|
notice, this list of conditions and the following disclaimer in the
|
16 |
|
|
documentation and/or other materials provided with the distribution.
|
17 |
1f3a3ed2
|
jim-p
|
|
18 |
5b237745
|
Scott Ullrich
|
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
19 |
|
|
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
20 |
|
|
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
21 |
|
|
AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
22 |
|
|
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
23 |
|
|
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
24 |
|
|
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
25 |
|
|
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
26 |
|
|
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
27 |
|
|
POSSIBILITY OF SUCH DAMAGE.
|
28 |
|
|
*/
|
29 |
1d333258
|
Scott Ullrich
|
/*
|
30 |
454f52f9
|
sbeaver
|
pfSense_MODULE: interfaces
|
31 |
1d333258
|
Scott Ullrich
|
*/
|
32 |
5b237745
|
Scott Ullrich
|
|
33 |
6b07c15a
|
Matthew Grooms
|
##|+PRIV
|
34 |
|
|
##|*IDENT=page-diagnostics-wirelessstatus
|
35 |
d1104fa6
|
Chris Buechler
|
##|*NAME=Status: Wireless page
|
36 |
|
|
##|*DESCR=Allow access to the 'Status: Wireless' page.
|
37 |
6b07c15a
|
Matthew Grooms
|
##|*MATCH=status_wireless.php*
|
38 |
|
|
##|-PRIV
|
39 |
|
|
|
40 |
d0330501
|
Scott Ullrich
|
require_once("guiconfig.inc");
|
41 |
5b237745
|
Scott Ullrich
|
|
42 |
6c07db48
|
Phil Davis
|
$pgtitle = array(gettext("Status"), gettext("Wireless"));
|
43 |
b32dd0a6
|
jim-p
|
$shortcut_section = "wireless";
|
44 |
454f52f9
|
sbeaver
|
|
45 |
4df96eff
|
Scott Ullrich
|
include("head.inc");
|
46 |
|
|
|
47 |
d0330501
|
Scott Ullrich
|
$if = $_POST['if'];
|
48 |
454f52f9
|
sbeaver
|
|
49 |
|
|
if($_GET['if'] != "")
|
50 |
d0330501
|
Scott Ullrich
|
$if = $_GET['if'];
|
51 |
64b2f3c8
|
Ermal Lu?i
|
|
52 |
|
|
$ciflist = get_configured_interface_with_descr();
|
53 |
42b0c921
|
Phil Davis
|
if (empty($if)) {
|
54 |
d0330501
|
Scott Ullrich
|
/* Find the first interface
|
55 |
|
|
that is wireless */
|
56 |
42b0c921
|
Phil Davis
|
foreach ($ciflist as $interface => $ifdescr) {
|
57 |
|
|
if (is_interface_wireless(get_real_interface($interface))) {
|
58 |
64b2f3c8
|
Ermal Lu?i
|
$if = $interface;
|
59 |
be2b47d5
|
Erik Fonnesbeck
|
break;
|
60 |
|
|
}
|
61 |
d0330501
|
Scott Ullrich
|
}
|
62 |
|
|
}
|
63 |
5b237745
|
Scott Ullrich
|
|
64 |
d0330501
|
Scott Ullrich
|
$tab_array = array();
|
65 |
454f52f9
|
sbeaver
|
|
66 |
64b2f3c8
|
Ermal Lu?i
|
foreach($ciflist as $interface => $ifdescr) {
|
67 |
88e9bceb
|
smos
|
if (is_interface_wireless(get_real_interface($interface))) {
|
68 |
64b2f3c8
|
Ermal Lu?i
|
$enabled = false;
|
69 |
a2b724a6
|
Ermal Lu?i
|
if($if == $interface)
|
70 |
d0330501
|
Scott Ullrich
|
$enabled = true;
|
71 |
454f52f9
|
sbeaver
|
|
72 |
24357d92
|
jim-p
|
$tab_array[] = array(gettext("Status") . " ({$ifdescr})", $enabled, "status_wireless.php?if={$interface}");
|
73 |
d0330501
|
Scott Ullrich
|
}
|
74 |
|
|
}
|
75 |
454f52f9
|
sbeaver
|
|
76 |
72d2682c
|
Erik Fonnesbeck
|
$rwlif = get_real_interface($if);
|
77 |
454f52f9
|
sbeaver
|
|
78 |
|
|
if($_POST['rescanwifi'] != "") {
|
79 |
4362a612
|
Chris Buechler
|
mwexec_bg("/sbin/ifconfig {$rwlif} scan 2>&1");
|
80 |
c3ff89b4
|
Renato Botelho
|
$savemsg = gettext("Rescan has been initiated in the background. Refresh this page in 10 seconds to see the results.");
|
81 |
6f87ed42
|
Chris Buechler
|
}
|
82 |
454f52f9
|
sbeaver
|
|
83 |
|
|
if ($savemsg)
|
84 |
|
|
print_info_box($savemsg, 'success');
|
85 |
|
|
|
86 |
d0330501
|
Scott Ullrich
|
display_top_tabs($tab_array);
|
87 |
|
|
?>
|
88 |
454f52f9
|
sbeaver
|
|
89 |
|
|
<div class="panel panel-default">
|
90 |
f17594c7
|
Sjon Hortensius
|
<div class="panel-heading"><h2 class="panel-title"><?=gettext("Nearby access points or ad-hoc peers")?></h2></div>
|
91 |
454f52f9
|
sbeaver
|
<div class="panel-body">
|
92 |
|
|
<div class="table-responsive">
|
93 |
|
|
<table class="table table-striped table-hover table-condensed">
|
94 |
|
|
<thead>
|
95 |
|
|
<tr>
|
96 |
|
|
<th>SSID</th>
|
97 |
|
|
<th>BSSID</th>
|
98 |
|
|
<th>CHAN</th>
|
99 |
|
|
<th>RATE</th>
|
100 |
|
|
<th>RSSI</th>
|
101 |
|
|
<th>INT</th>
|
102 |
|
|
<th>CAPS</th>
|
103 |
|
|
</tr>
|
104 |
|
|
</thead>
|
105 |
|
|
<tbody>
|
106 |
351cbef7
|
Scott Ullrich
|
<?php
|
107 |
64b2f3c8
|
Ermal Lu?i
|
exec("/sbin/ifconfig {$rwlif} list scan 2>&1", $states, $ret);
|
108 |
e2d90eac
|
Seth Mos
|
/* Skip Header */
|
109 |
|
|
array_shift($states);
|
110 |
d0330501
|
Scott Ullrich
|
|
111 |
6c07db48
|
Phil Davis
|
$counter = 0;
|
112 |
42b0c921
|
Phil Davis
|
foreach ($states as $state) {
|
113 |
e2d90eac
|
Seth Mos
|
/* Split by Mac address for the SSID Field */
|
114 |
22275785
|
Seth Mos
|
$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);
|
115 |
|
|
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);
|
116 |
2bf0ada5
|
jim-p
|
$ssid = htmlspecialchars($split[0]);
|
117 |
22275785
|
Seth Mos
|
$bssid = $bssid[0];
|
118 |
e2d90eac
|
Seth Mos
|
/* Split the rest by using spaces for this line using the 2nd part */
|
119 |
|
|
$split = preg_split("/[ ]+/i", $split[1]);
|
120 |
|
|
$channel = $split[1];
|
121 |
|
|
$rate = $split[2];
|
122 |
|
|
$rssi = $split[3];
|
123 |
|
|
$int = $split[4];
|
124 |
|
|
$caps = "$split[5] $split[6] $split[7] $split[8] $split[9] $split[10] $split[11] ";
|
125 |
1f3a3ed2
|
jim-p
|
?>
|
126 |
454f52f9
|
sbeaver
|
<tr>
|
127 |
|
|
<td>
|
128 |
|
|
<?=$ssid?>
|
129 |
|
|
</td>
|
130 |
|
|
<td>
|
131 |
|
|
<?=$bssid?>
|
132 |
|
|
</td>
|
133 |
|
|
<td>
|
134 |
|
|
<?=$channel?>
|
135 |
|
|
</td>
|
136 |
|
|
<td>
|
137 |
|
|
<?=$rate?>
|
138 |
|
|
</td>
|
139 |
|
|
<td>
|
140 |
|
|
<?=$rssi?>
|
141 |
|
|
</td>
|
142 |
|
|
<td>
|
143 |
|
|
<?=$int?>
|
144 |
|
|
</td>
|
145 |
|
|
<td>
|
146 |
|
|
<?=$caps?>
|
147 |
|
|
</td>
|
148 |
|
|
</tr>
|
149 |
|
|
<?php
|
150 |
|
|
} // e-o-foreach
|
151 |
|
|
?>
|
152 |
|
|
</tbody>
|
153 |
|
|
</table>
|
154 |
|
|
</div>
|
155 |
|
|
</div>
|
156 |
|
|
</div>
|
157 |
|
|
|
158 |
|
|
<div class="panel panel-default">
|
159 |
f17594c7
|
Sjon Hortensius
|
<div class="panel-heading"><h2 class="panel-title"><?=gettext("Associated or ad-hoc peers")?></h2></div>
|
160 |
454f52f9
|
sbeaver
|
<div class="panel-body">
|
161 |
|
|
<div class="table-responsive">
|
162 |
|
|
<table class="table table-striped table-hover table-condensed">
|
163 |
|
|
<thead>
|
164 |
|
|
<tr>
|
165 |
|
|
<th>ADDR</font></th>
|
166 |
|
|
<th>AID</font></th>
|
167 |
|
|
<th>CHAN</font></th>
|
168 |
|
|
<th>RATE</font></th>
|
169 |
|
|
<th>RSSI</font></th>
|
170 |
|
|
<th>IDLE</font></th>
|
171 |
|
|
<th>TXSEQ</font></th>
|
172 |
|
|
<th>RXSEQ</font></th>
|
173 |
|
|
<th>CAPS</font></th>
|
174 |
|
|
<th>ERP</font></th>
|
175 |
|
|
</tr>
|
176 |
|
|
</thead>
|
177 |
|
|
<tbody>
|
178 |
c29ad853
|
Scott Ullrich
|
|
179 |
1f3a3ed2
|
jim-p
|
<?php
|
180 |
105bb6a6
|
Seth Mos
|
$states = array();
|
181 |
64b2f3c8
|
Ermal Lu?i
|
exec("/sbin/ifconfig {$rwlif} list sta 2>&1", $states, $ret);
|
182 |
e2d90eac
|
Seth Mos
|
array_shift($states);
|
183 |
f2f0c37e
|
Scott Ullrich
|
|
184 |
|
|
$counter=0;
|
185 |
454f52f9
|
sbeaver
|
|
186 |
f2f0c37e
|
Scott Ullrich
|
foreach($states as $state) {
|
187 |
105bb6a6
|
Seth Mos
|
$split = preg_split("/[ ]+/i", $state);
|
188 |
454f52f9
|
sbeaver
|
?>
|
189 |
|
|
<tr>
|
190 |
|
|
<?php
|
191 |
105bb6a6
|
Seth Mos
|
/* Split the rest by using spaces for this line using the 2nd part */
|
192 |
454f52f9
|
sbeaver
|
for($idx=0; $idx<10; $idx++) {
|
193 |
|
|
?>
|
194 |
|
|
<td>
|
195 |
|
|
<?=$split[$idx]?>
|
196 |
|
|
</td>
|
197 |
|
|
<?php
|
198 |
|
|
}
|
199 |
|
|
?>
|
200 |
|
|
</tr>
|
201 |
|
|
<?php
|
202 |
f2f0c37e
|
Scott Ullrich
|
}
|
203 |
454f52f9
|
sbeaver
|
?>
|
204 |
|
|
</tbody>
|
205 |
|
|
</table>
|
206 |
|
|
</div>
|
207 |
|
|
</div>
|
208 |
|
|
</div>
|
209 |
351cbef7
|
Scott Ullrich
|
|
210 |
f2f0c37e
|
Scott Ullrich
|
|
211 |
454f52f9
|
sbeaver
|
<form action="status_wireless.php" method="post">
|
212 |
|
|
<nav class="action-buttons">
|
213 |
|
|
<input type="hidden" name="if" id="if" value="<?=htmlspecialchars($if)?>">
|
214 |
|
|
<input type="submit" class="btn btn-success" name="rescanwifi" id="rescanwifi" value="Rescan">
|
215 |
|
|
</nav>
|
216 |
|
|
</form>
|
217 |
|
|
|
218 |
|
|
<?php
|
219 |
|
|
print_info_box('<b>Flags:</b> A = authorized, E = Extended Rate (802.11g), P = Power saving mode<br />' .
|
220 |
|
|
'<b>Capabilities:</b> E = ESS (infrastructure mode), I = IBSS (ad-hoc mode), P = privacy (WEP/TKIP/AES), ' .
|
221 |
|
|
'S = Short preamble, s = Short slot time');
|
222 |
|
|
|
223 |
|
|
include("foot.inc");
|