request->action) { case 'getVersionInfo': $this->getVersionInfo(); break; case 'getWirelessInterfaces': $this->getWirelessInterfaces(); break; case 'getInterfaceScan': $this->getInterfaceScan(); break; case 'getInterfaceStatus': $this->getInterfaceStatus(); break; case 'toggleInterface': $this->toggleInterface(); break; } } protected function getVersionInfo() { $moduleInfo = @json_decode(file_get_contents("/pineapple/modules/SignalStrength/module.info")); $this->response = array('title' => $moduleInfo->title, 'version' => $moduleInfo->version); } protected function getInterfaceScan() { exec('iwlist "'.$this->request->selectedInterface.'" scanning | egrep "Cell |Channel|Quality|ESSID"', $interfaceScan); $interfaceScanArray = array(); for($x=0;$x $bssid, "channel" => $channel, "quality" => $quality, "strength" => $strength, "essid" => $essid)); } $this->response = array('interfaceScan' => $interfaceScanArray); } protected function getWirelessInterfaces() { exec("iwconfig 2> /dev/null | grep \"wlan*\" | awk '{print $1}'", $interfaces); $this->response = array('interfaces' => $interfaces); } protected function getInterfaceStatus() { exec("ifconfig -a | cut -c 1-19 | egrep 'wlan|UP|BROADCAST' | awk '{print $1}' | tail -n+4", $interfaceStatus); $interfaceStatusArray = array(); for ($y=0;$y $interface, "status" => $status)); } $this->response = array('interfaceStatus' => $interfaceStatusArray); } protected function toggleInterface() { $toggle = ($this->request->status == "Down") ? 'up' : 'down'; exec('ifconfig "'.$this->request->interface.'" "'.$toggle.'"', $toggleResponse); } }