Project

General

Profile

Download (7.2 KB) Statistics
| Branch: | Tag: | Revision:
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
	pfSense_MODULE: interfaces
57
*/
58

    
59
##|+PRIV
60
##|*IDENT=page-diagnostics-wirelessstatus
61
##|*NAME=Status: Wireless
62
##|*DESCR=Allow access to the 'Status: Wireless' page.
63
##|*MATCH=status_wireless.php*
64
##|-PRIV
65

    
66
require_once("guiconfig.inc");
67

    
68
$pgtitle = array(gettext("Status"), gettext("Wireless"));
69
$shortcut_section = "wireless";
70

    
71
include("head.inc");
72

    
73
$if = $_POST['if'];
74

    
75
if ($_GET['if'] != "") {
76
	$if = $_GET['if'];
77
}
78

    
79
$ciflist = get_configured_interface_with_descr();
80
if (empty($if)) {
81
	/* Find the first interface that is wireless */
82
	foreach ($ciflist as $interface => $ifdescr) {
83
		if (is_interface_wireless(get_real_interface($interface))) {
84
			$if = $interface;
85
			break;
86
		}
87
	}
88
}
89

    
90
$tab_array = array();
91

    
92
foreach ($ciflist as $interface => $ifdescr) {
93
	if (is_interface_wireless(get_real_interface($interface))) {
94
		$enabled = false;
95
		if ($if == $interface) {
96
			$enabled = true;
97
		}
98

    
99
		$tab_array[] = array(gettext("Status") . " ({$ifdescr})", $enabled, "status_wireless.php?if={$interface}");
100
	}
101
}
102

    
103
$rwlif = get_real_interface($if);
104

    
105
if ($_POST['rescanwifi'] != "") {
106
	mwexec_bg("/sbin/ifconfig {$rwlif} scan 2>&1");
107
	$savemsg = gettext("Rescan has been initiated in the background. Refresh this page in 10 seconds to see the results.");
108
}
109

    
110
if ($savemsg) {
111
	print_info_box($savemsg, 'success');
112
}
113

    
114
display_top_tabs($tab_array);
115
?>
116

    
117
<div class="panel panel-default">
118
	<div class="panel-heading"><h2 class="panel-title"><?=gettext("Nearby access points or ad-hoc peers")?></h2></div>
119
	<div class="panel-body">
120
		<div class="table-responsive">
121
			<table class="table table-striped table-hover table-condensed sortable-theme-bootstrap" data-sortable>
122
				<thead>
123
					<tr>
124
						<th>SSID</th>
125
						<th>BSSID</th>
126
						<th>CHAN</th>
127
						<th>RATE</th>
128
						<th>RSSI</th>
129
						<th>INT</th>
130
						<th>CAPS</th>
131
					</tr>
132
				</thead>
133
				<tbody>
134
<?php
135
	exec("/sbin/ifconfig {$rwlif} list scan 2>&1", $states, $ret);
136
	/* Skip Header */
137
	array_shift($states);
138

    
139
	$counter = 0;
140
	foreach ($states as $state) {
141
		/* Split by Mac address for the SSID Field */
142
		$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);
143
		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);
144
		$ssid = htmlspecialchars($split[0]);
145
		$bssid = $bssid[0];
146
		/* Split the rest by using spaces for this line using the 2nd part */
147
		$split = preg_split("/[ ]+/i", $split[1]);
148
		$channel = $split[1];
149
		$rate = $split[2];
150
		$rssi = $split[3];
151
		$int = $split[4];
152
		$caps = "$split[5] $split[6] $split[7] $split[8] $split[9] $split[10] $split[11] ";
153
?>
154
					<tr>
155
						<td>
156
							<?=$ssid?>
157
						</td>
158
						<td>
159
							<?=$bssid?>
160
						</td>
161
						<td>
162
							<?=$channel?>
163
						</td>
164
						<td>
165
							<?=$rate?>
166
						</td>
167
						<td>
168
							<?=$rssi?>
169
						</td>
170
						<td>
171
							<?=$int?>
172
						</td>
173
						<td>
174
							<?=$caps?>
175
						</td>
176
					</tr>
177
<?php
178
	} // e-o-foreach
179
?>
180
				</tbody>
181
			</table>
182
		</div>
183
	</div>
184
</div>
185

    
186
<div class="panel panel-default">
187
	<div class="panel-heading"><h2 class="panel-title"><?=gettext("Associated or ad-hoc peers")?></h2></div>
188
	<div class="panel-body">
189
		<div class="table-responsive">
190
			<table class="table table-striped table-hover table-condensed sortable-theme-bootstrap" data-sortable>
191
				<thead>
192
					<tr>
193
						<th>ADDR</font></th>
194
						<th>AID</font></th>
195
						<th>CHAN</font></th>
196
						<th>RATE</font></th>
197
						<th>RSSI</font></th>
198
						<th>IDLE</font></th>
199
						<th>TXSEQ</font></th>
200
						<th>RXSEQ</font></th>
201
						<th>CAPS</font></th>
202
						<th>ERP</font></th>
203
					</tr>
204
				</thead>
205
				<tbody>
206

    
207
<?php
208
	$states = array();
209
	exec("/sbin/ifconfig {$rwlif} list sta 2>&1", $states, $ret);
210
	array_shift($states);
211

    
212
	$counter=0;
213

    
214
	foreach ($states as $state) {
215
		$split = preg_split("/[ ]+/i", $state);
216
?>
217
					<tr>
218
<?php
219
		/* Split the rest by using spaces for this line using the 2nd part */
220
		for ($idx=0; $idx<10; $idx++) {
221
?>
222
						<td>
223
							<?=$split[$idx]?>
224
						</td>
225
<?php
226
		}
227
?>
228
					</tr>
229
<?php
230
	}
231
?>
232
				</tbody>
233
			</table>
234
		</div>
235
	</div>
236
</div>
237

    
238

    
239
<form action="status_wireless.php" method="post">
240
	<nav class="action-buttons">
241
		<input type="hidden" name="if" id="if" value="<?=htmlspecialchars($if)?>" />
242
		<button type="submit" class="btn btn-success" name="rescanwifi" id="rescanwifi" value="Rescan">
243
			<i class="fa fa-undo icon-embed-btn"></i>
244
			<?=gettext("Rescan")?>
245
		</button>
246
	</nav>
247
</form>
248

    
249
<?php
250
print_info_box('<b>Flags:</b> A = authorized, E = Extended Rate (802.11g), P = Power saving mode<br />' .
251
			   '<b>Capabilities:</b> E = ESS (infrastructure mode), I = IBSS (ad-hoc mode), P = privacy (WEP/TKIP/AES), ' .
252
			   'S = Short preamble, s = Short slot time', info);
253

    
254
include("foot.inc");
(185-185/228)