Project

General

Profile

Download (5.42 KB) Statistics
| Branch: | Tag: | Revision:
1 d0330501 Scott Ullrich
<?php
2 5b237745 Scott Ullrich
/*
3 c5d81585 Renato Botelho
 * status_wireless.php
4 782922c2 Stephen Beaver
 *
5 c5d81585 Renato Botelho
 * part of pfSense (https://www.pfsense.org)
6 81299b5c Renato Botelho
 * Copyright (c) 2004-2016 Rubicon Communications, LLC (Netgate)
7 c5d81585 Renato Botelho
 * All rights reserved.
8 782922c2 Stephen Beaver
 *
9 b12ea3fb Renato Botelho
 * 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 782922c2 Stephen Beaver
 *
13 b12ea3fb Renato Botelho
 * http://www.apache.org/licenses/LICENSE-2.0
14 782922c2 Stephen Beaver
 *
15 b12ea3fb Renato Botelho
 * 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 782922c2 Stephen Beaver
 */
21 5b237745 Scott Ullrich
22 6b07c15a Matthew Grooms
##|+PRIV
23
##|*IDENT=page-diagnostics-wirelessstatus
24 5230f468 jim-p
##|*NAME=Status: Wireless
25 d1104fa6 Chris Buechler
##|*DESCR=Allow access to the 'Status: Wireless' page.
26 6b07c15a Matthew Grooms
##|*MATCH=status_wireless.php*
27
##|-PRIV
28
29 d0330501 Scott Ullrich
require_once("guiconfig.inc");
30 5b237745 Scott Ullrich
31 6c07db48 Phil Davis
$pgtitle = array(gettext("Status"), gettext("Wireless"));
32 b32dd0a6 jim-p
$shortcut_section = "wireless";
33 454f52f9 sbeaver
34 4df96eff Scott Ullrich
include("head.inc");
35
36 d0330501 Scott Ullrich
$if = $_POST['if'];
37 454f52f9 sbeaver
38 abe98adb Phil Davis
if ($_GET['if'] != "") {
39 d0330501 Scott Ullrich
	$if = $_GET['if'];
40 abe98adb Phil Davis
}
41 64b2f3c8 Ermal Lu?i
42
$ciflist = get_configured_interface_with_descr();
43 42b0c921 Phil Davis
if (empty($if)) {
44 abe98adb Phil Davis
	/* Find the first interface that is wireless */
45 42b0c921 Phil Davis
	foreach ($ciflist as $interface => $ifdescr) {
46
		if (is_interface_wireless(get_real_interface($interface))) {
47 64b2f3c8 Ermal Lu?i
			$if = $interface;
48 be2b47d5 Erik Fonnesbeck
			break;
49
		}
50 d0330501 Scott Ullrich
	}
51
}
52 5b237745 Scott Ullrich
53 d0330501 Scott Ullrich
$tab_array = array();
54 454f52f9 sbeaver
55 abe98adb Phil Davis
foreach ($ciflist as $interface => $ifdescr) {
56 88e9bceb smos
	if (is_interface_wireless(get_real_interface($interface))) {
57 64b2f3c8 Ermal Lu?i
		$enabled = false;
58 abe98adb Phil Davis
		if ($if == $interface) {
59 d0330501 Scott Ullrich
			$enabled = true;
60 abe98adb Phil Davis
		}
61 454f52f9 sbeaver
62 24357d92 jim-p
		$tab_array[] = array(gettext("Status") . " ({$ifdescr})", $enabled, "status_wireless.php?if={$interface}");
63 d0330501 Scott Ullrich
	}
64
}
65 454f52f9 sbeaver
66 72d2682c Erik Fonnesbeck
$rwlif = get_real_interface($if);
67 454f52f9 sbeaver
68 abe98adb Phil Davis
if ($_POST['rescanwifi'] != "") {
69 4362a612 Chris Buechler
	mwexec_bg("/sbin/ifconfig {$rwlif} scan 2>&1");
70 c3ff89b4 Renato Botelho
	$savemsg = gettext("Rescan has been initiated in the background. Refresh this page in 10 seconds to see the results.");
71 6f87ed42 Chris Buechler
}
72 454f52f9 sbeaver
73 abe98adb Phil Davis
if ($savemsg) {
74 454f52f9 sbeaver
	print_info_box($savemsg, 'success');
75 abe98adb Phil Davis
}
76 454f52f9 sbeaver
77 d0330501 Scott Ullrich
display_top_tabs($tab_array);
78
?>
79 454f52f9 sbeaver
80
<div class="panel panel-default">
81 3d7a8696 k-paulius
	<div class="panel-heading"><h2 class="panel-title"><?=gettext("Nearby Access Points or Ad-Hoc Peers")?></h2></div>
82 454f52f9 sbeaver
	<div class="panel-body">
83
		<div class="table-responsive">
84 10fe1eb5 Stephen Beaver
			<table class="table table-striped table-hover table-condensed sortable-theme-bootstrap" data-sortable>
85 454f52f9 sbeaver
				<thead>
86
					<tr>
87
						<th>SSID</th>
88
						<th>BSSID</th>
89
						<th>CHAN</th>
90
						<th>RATE</th>
91
						<th>RSSI</th>
92
						<th>INT</th>
93
						<th>CAPS</th>
94
					</tr>
95
				</thead>
96
				<tbody>
97 351cbef7 Scott Ullrich
<?php
98 64b2f3c8 Ermal Lu?i
	exec("/sbin/ifconfig {$rwlif} list scan 2>&1", $states, $ret);
99 e2d90eac Seth Mos
	/* Skip Header */
100
	array_shift($states);
101 d0330501 Scott Ullrich
102 6c07db48 Phil Davis
	$counter = 0;
103 42b0c921 Phil Davis
	foreach ($states as $state) {
104 e2d90eac Seth Mos
		/* Split by Mac address for the SSID Field */
105 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);
106
		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);
107 2bf0ada5 jim-p
		$ssid = htmlspecialchars($split[0]);
108 22275785 Seth Mos
		$bssid = $bssid[0];
109 e2d90eac Seth Mos
		/* Split the rest by using spaces for this line using the 2nd part */
110
		$split = preg_split("/[ ]+/i", $split[1]);
111
		$channel = $split[1];
112
		$rate = $split[2];
113
		$rssi = $split[3];
114
		$int = $split[4];
115
		$caps = "$split[5] $split[6] $split[7] $split[8] $split[9] $split[10] $split[11] ";
116 1f3a3ed2 jim-p
?>
117 454f52f9 sbeaver
					<tr>
118
						<td>
119
							<?=$ssid?>
120
						</td>
121
						<td>
122
							<?=$bssid?>
123
						</td>
124
						<td>
125
							<?=$channel?>
126
						</td>
127
						<td>
128
							<?=$rate?>
129
						</td>
130
						<td>
131
							<?=$rssi?>
132
						</td>
133
						<td>
134
							<?=$int?>
135
						</td>
136
						<td>
137
							<?=$caps?>
138
						</td>
139
					</tr>
140
<?php
141
	} // e-o-foreach
142
?>
143
				</tbody>
144
			</table>
145
		</div>
146
	</div>
147
</div>
148
149
<div class="panel panel-default">
150 3d7a8696 k-paulius
	<div class="panel-heading"><h2 class="panel-title"><?=gettext("Associated or Ad-Hoc Peers")?></h2></div>
151 454f52f9 sbeaver
	<div class="panel-body">
152
		<div class="table-responsive">
153 2f4e37b1 Stephen Beaver
			<table class="table table-striped table-hover table-condensed sortable-theme-bootstrap" data-sortable>
154 454f52f9 sbeaver
				<thead>
155
					<tr>
156 c3c2bd7a Colin Fleming
						<th>ADDR</th>
157
						<th>AID</th>
158
						<th>CHAN</th>
159
						<th>RATE</th>
160
						<th>RSSI</th>
161
						<th>IDLE</th>
162
						<th>TXSEQ</th>
163
						<th>RXSEQ</th>
164
						<th>CAPS</th>
165
						<th>ERP</th>
166 454f52f9 sbeaver
					</tr>
167
				</thead>
168
				<tbody>
169 c29ad853 Scott Ullrich
170 1f3a3ed2 jim-p
<?php
171 105bb6a6 Seth Mos
	$states = array();
172 64b2f3c8 Ermal Lu?i
	exec("/sbin/ifconfig {$rwlif} list sta 2>&1", $states, $ret);
173 e2d90eac Seth Mos
	array_shift($states);
174 f2f0c37e Scott Ullrich
175
	$counter=0;
176 454f52f9 sbeaver
177 abe98adb Phil Davis
	foreach ($states as $state) {
178 105bb6a6 Seth Mos
		$split = preg_split("/[ ]+/i", $state);
179 454f52f9 sbeaver
?>
180
					<tr>
181
<?php
182 105bb6a6 Seth Mos
		/* Split the rest by using spaces for this line using the 2nd part */
183 abe98adb Phil Davis
		for ($idx=0; $idx<10; $idx++) {
184 454f52f9 sbeaver
?>
185
						<td>
186
							<?=$split[$idx]?>
187
						</td>
188
<?php
189
		}
190
?>
191
					</tr>
192
<?php
193 f2f0c37e Scott Ullrich
	}
194 454f52f9 sbeaver
?>
195
				</tbody>
196
			</table>
197
		</div>
198
	</div>
199
</div>
200 351cbef7 Scott Ullrich
201 f2f0c37e Scott Ullrich
202 454f52f9 sbeaver
<form action="status_wireless.php" method="post">
203 c10cb196 Stephen Beaver
	<nav class="action-buttons">
204 782922c2 Stephen Beaver
		<input type="hidden" name="if" id="if" value="<?=htmlspecialchars($if)?>" />
205
		<button type="submit" class="btn btn-success" name="rescanwifi" id="rescanwifi" value="Rescan">
206 15b6dcac jim-p
			<i class="fa fa-refresh icon-embed-btn"></i>
207 782922c2 Stephen Beaver
			<?=gettext("Rescan")?>
208
		</button>
209 454f52f9 sbeaver
	</nav>
210
</form>
211 f78bbe16 Phil Davis
<div class="infoblock">
212 454f52f9 sbeaver
<?php
213 8545adde k-paulius
print_info_box(gettext('<b>Flags:</b> A = authorized, E = Extended Rate (802.11g), P = Power saving mode.<br />' .
214 454f52f9 sbeaver
			   '<b>Capabilities:</b> E = ESS (infrastructure mode), I = IBSS (ad-hoc mode), P = privacy (WEP/TKIP/AES), ' .
215 8545adde k-paulius
			   'S = Short preamble, s = Short slot time.'), 'info', false);
216 f78bbe16 Phil Davis
?>
217
</div>
218
<?php
219 c10cb196 Stephen Beaver
include("foot.inc");