/
netwifi-test.php
69 lines (30 loc) · 958 Bytes
/
netwifi-test.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
<?php
require_once 'Net/Wifi.php';
$wifi = new Net_Wifi();
//get all wireless interfaces
$interfaces = $wifi->getSupportedInterfaces();
$raw = shell_exec("/var/www/wificonfig/test.sh");
echo "RAW=<PRE>" . $raw . " </PRE>- end raw <BR>";
if (count($interfaces) == 0) {
echo 'No wireless interfaces found!' . "\r\n";
exit();
}
foreach ($interfaces as $interface) {
echo 'Wireless interface: ' . $interface . "\r\n";
}
echo "========================\r\n";
//get the current configuration of the first interface
echo "Current configuration of first interface:\n";
var_dump($wifi->getCurrentConfig($interfaces[0]));
echo "========================\r\n";
//scan for available networks
echo "Available networks:\n";
$networks = $wifi->scan($interfaces[0]);
if (count($networks) == 0) {
echo 'No wireless networks available.' . "\r\n";
exit();
}
echo "<pre>";
var_dump($networks);
echo "</pre>";
?>