Beispiel #1
0
 function getInfo()
 {
     $info = WifiBo::sendCommand("cat /etc/hostapd/hostapd.conf");
     $lines = explode("\n", $info);
     $infos = array();
     $infos["disabled"] = $this->isActive() ? 0 : 1;
     $infos["encryption"] = "none";
     foreach ($lines as $line) {
         if (strlen($line) > 0 && substr($line, 0, 1) == "#") {
             continue;
         }
         $explLine = explode("=", trim($line), 2);
         if (count($explLine) < 2) {
             continue;
         } else {
             $value = $explLine[1];
         }
         switch ($explLine[0]) {
             case "channel":
                 $infos["channel"] = $value;
                 break;
             case "ssid":
                 $infos["ssid"] = $value;
                 break;
             case "wpa_passphrase":
                 $infos["key"] = $value;
                 break;
             case "wpa_key_mgmt":
                 $infos["wpa_key_mgmt"] = $value;
                 break;
             case "wpa":
                 $infos["wpa"] = $value;
                 break;
             case "wpa_pairwise":
                 $infos["wpa_pairwise"] = $value;
                 break;
             case "rsn_pairwise":
                 $infos["rsn_pairwise"] = $value;
                 break;
         }
     }
     if (isset($infos["key"]) && $infos["key"] && isset($infos["wpa"])) {
         if ($infos["wpa"] == 1) {
             $infos["encryption"] = "psk";
         } else {
             if ($infos["wpa"] == 2) {
                 $infos["encryption"] = "psk2";
                 if ($infos["wpa_pairwise"] == "TKIP") {
                     $infos["encryption"] = "psk-mixed";
                 }
             }
         }
     }
     return $infos;
 }
Beispiel #2
0
    Parpaing is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    Parpaing is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with Parpaing.  If not, see <http://www.gnu.org/licenses/>.
*/
include_once "header.php";
require_once 'engine/bo/WifiBo.' . $config["parpaing"]["dialect"] . '.php';
$wifiBo = WifiBo::newInstance($config);
$info = $wifiBo->getInfo();
?>
<div class="container theme-showcase" role="main">
	<ol class="breadcrumb">
		<li><?php 
echo lang("breadcrumb_index");
?>
</li>
		<li class="active"><?php 
echo lang("breadcrumb_wifi");
?>
</li>
	</ol>

	<div class="panel panel-default">
Beispiel #3
0
 function setPower($txpower)
 {
     WifiBo::sendCommand("uci set wireless.radio0.txpower='{$txpower}'; uci commit wireless; wifi");
 }
Beispiel #4
0
 function setKey($key)
 {
     WifiBo::sendCommand("uci set wireless.@wifi-iface[0].key='{$key}'; uci commit wireless; wifi");
 }