Beispiel #1
1
<?php

//shell_exec("iwlist wlan0 scanning; sleep 4;");
require_once 'Net/Wifi.php';
$wifi = new Net_Wifi();
//get all wireless interfaces
$interface = "wlan0";
include 'netwifi-interfaces.php';
include 'netwifi-nets.php';
echo "<!-- networks size " . $interface . " count = " . count($networks) . " --!>" . "\r\n";
session_start();
//...your code
$ssid = $_SESSION['ssid'];
//$newssid = shell_exec("iwlist wlan0 scanning | awk '/ESSID:/ { print $1;}' | cut -d ':' -f 2- | sed -e 's/^\"//'  -e 's/\"$//' ; sleep 3;");
$wificonfig = $wifi->getCurrentConfig($interface);
$currentwifi = $wificonfig->ssid;
//echo $currentwifi;
//echo strcmp("linksys",$currentwifi); // needed trim command to be equal
//...
$_SESSION['ssid'] = $networks;
$_SESSION['currentwifi'] = $currentwifi;
//    echo '<pre>';
//     echo '' . json_encode(get_object_vars($networks) );
//     echo '</pre>';
?>
 	<?php 
foreach ($networks as $line) {
    //     echo '<pre>';
    //     echo '' . json_encode(get_object_vars($line) );
    //     echo '</pre>';
    ?>
Beispiel #2
0
<?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>";
?>
Beispiel #3
0
<?php

// get networks on $interface
require_once 'Net/Wifi.php';
$wifi = new Net_Wifi();
if (is_null($interface) || $interface == "") {
    $interface = "wlan0";
}
$outnet = shell_exec("sudo iwlist wlan0 scan; sleep 1;");
//$networks = $wifi->parseScan($outnet);
//echo "debug=" . $outnet . " <hr> networks=" . $networks . " size=" . count($networks);
$networks = $wifi->scan($interface);
if (is_null($networks) || count($networks) == 0) {
    echo '<div class="ERROR"> No wireless networks available.</div>' . "\r\n";
    exit;
} else {
    //echo 'attitude=' . count($networks) . ' <br> ' . "\r\n";
    //echo 'dog whisper:' . get_object_vars($networks) . '<br>' . "\r\n";
    echo '<!--   networks available. ' . count($networks) . ' --!>' . "\r\n";
    foreach ($networks as $network) {
        echo '' . strval(json_encode(get_object_vars($network))) . "\r\n";
    }
}
?>

<?php

require_once 'Net/Wifi.php';
$wifi = new Net_Wifi();
//get all wireless interfaces
$interfaces = $wifi->getSupportedInterfaces();
if (count($interfaces) == 0) {
    echo '<div class="Error"> No wireless interfaces found! </div>' . "\r\n";
    exec("iwlist wlan0 scanning");
    exit;
}
$wlanvalid = false;
foreach ($interfaces as $interface1) {
    if (strcmp($interface1, "wlan0") == 0) {
        echo '<!---  Wireless interface: ' . $interface1 . "  FOUND! --!>";
        $wlanvalid = true;
        break;
    }
}
?>