Project

General

Profile

Download (7.15 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 page
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
$ciflist = get_configured_interface_with_descr();
79
if (empty($if)) {
80
	/* Find the first interface
81
	   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
		$tab_array[] = array(gettext("Status") . " ({$ifdescr})", $enabled, "status_wireless.php?if={$interface}");
99
	}
100
}
101

    
102
$rwlif = get_real_interface($if);
103

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

    
109
if ($savemsg)
110
	print_info_box($savemsg, 'success');
111

    
112
display_top_tabs($tab_array);
113
?>
114

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

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

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

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

    
210
	$counter=0;
211

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

    
236

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

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

    
252
include("foot.inc");
(185-185/234)