Interface is up'; } else { $strStatus = 'Interface is down'; } if( isset($_POST['ifdown_wlan0']) ) { exec( 'ifconfig wlan0 | grep -i running | wc -l',$test ); if($test[0] == 1) { exec( 'sudo ifdown wlan0',$return ); } else { echo 'Interface already down'; } } elseif( isset($_POST['ifup_wlan0']) ) { exec( 'ifconfig wlan0 | grep -i running | wc -l',$test ); if($test[0] == 0) { exec( 'sudo ifup wlan0',$return ); } else { echo 'Interface already up'; } } ?>
Dashboard

Interface Information

Interface Name : wlan0
Interface Status :
IP Address :
Subnet Mask :
Mac Address :

Interface Statistics

Received Packets :
Received Bytes :

Transferred Packets :
Transferred Bytes :

Wireless Information

Connected To :
AP Mac Address :
Bitrate :
Transmit Power :
Frequency :
Link Quality :
%
Signal Level :
%
'; for($ssids = 0; $ssids < $numSSIDs; $ssids++) { $output .= '
Network '.$ssids.'
SSID :
PSK :
'; } $output .= '
'; echo $output; echo ''; if( isset($_POST['SaveWPAPSKSettings']) ) { $config = 'ctrl_interface=DIR='. RASPI_WPA_CTRL_INTERFACE .' GROUP=netdev update_config=1'; $networks = $_POST['Networks']; for( $x = 0; $x < $networks; $x++ ) { $network = ''; $ssid = escapeshellarg( $_POST['ssid'.$x] ); $psk = escapeshellarg( $_POST['psk'.$x] ); exec( 'wpa_passphrase '.$ssid. ' ' . $psk,$network ); foreach( $network as $b ) { $config .= "$b "; } } exec( "echo '$config' > /tmp/wifidata", $return ); system( 'sudo cp /tmp/wifidata ' . RASPI_WPA_SUPPLICANT_CONFIG, $returnval ); if( $returnval == 0 ) { echo "Wifi settings updated successfully"; } else { echo "Wifi settings failed to be updated"; } } elseif( isset($_POST['Scan']) ) { $return = ''; exec( 'sudo wpa_cli scan',$return ); sleep(5); exec( 'sudo wpa_cli scan_results',$return ); for( $shift = 0; $shift < 4; $shift++ ) { array_shift($return); } echo "Networks found :
"; foreach( $return as $network ) { $arrNetwork = preg_split("/[\t]+/",$network); $bssid = $arrNetwork[0]; $channel = ConvertToChannel($arrNetwork[1]); $signal = $arrNetwork[2] . " dBm"; $security = $arrNetwork[3]; $ssid = $arrNetwork[4]; echo '' . $ssid . " on channel " . $channel . " with " . $signal . "(".ConvertToSecurity($security)." Security)
"; } } } /** * * */ function DisplayHostAPDConfig(){ exec( 'cat '. RASPI_HOSTAPD_CONFIG, $return ); exec( 'pidof hostapd | wc -l', $hostapdstatus); if( $hostapdstatus[0] == 0 ) { $status = '
HostAPD is not running
'; } else { $status = '
HostAPD is running
'; } $arrConfig = array(); $arrChannel = array('a','b','g'); $arrSecurity = array( 1 => 'WPA', 2 => 'WPA2',3=> 'WPA+WPA2'); $arrEncType = array('TKIP' => 'TKIP', 'CCMP' => 'CCMP', 'TKIP CCMP' => 'TKIP+CCMP'); foreach( $return as $a ) { if( $a[0] != "#" ) { $arrLine = explode( "=",$a) ; $arrConfig[$arrLine[0]]=$arrLine[1]; } }; ?>
Configure hotspot

Basic settings

Security settings

Advanced settings

'; } else { echo ''; }; ?>
Dnsmasq is not running
'; } else { $status = '
Dnsmasq is running
'; } ?>
Configure DHCP

DHCP server settings

'; } else { echo ''; } ?>

Client list

Active DHCP leases
' . $lease_item . ''; } echo ''; }; ?>
Expire time MAC Address IP Address Host name Client ID
' /tmp/dhcpddata',$temp ); system( 'sudo cp /tmp/dhcpddata '. RASPI_DNSMASQ_CONFIG, $return ); if( $return == 0 ) { echo "Dnsmasq configuration updated successfully"; } else { echo "Dnsmasq configuration failed to be updated"; } } if( isset( $_POST['startdhcpd'] ) ) { $line = system('sudo /etc/init.d/dnsmasq start',$return); echo "Attempting to start dnsmasq"; } if( isset($_POST['stopdhcpd'] ) ) { $line = system('sudo /etc/init.d/dnsmasq stop',$return); echo "Stopping dnsmasq"; } ?>
OpenVPN is not running '; } else { $status = '
OpenVPN is running
'; } // parse client settings foreach( $returnClient as $a ) { if( $a[0] != "#" ) { $arrLine = explode( " ",$a) ; $arrClientConfig[$arrLine[0]]=$arrLine[1]; } } // parse server settings foreach( $returnServer as $a ) { if( $a[0] != "#" ) { $arrLine = explode( " ",$a) ; $arrServerConfig[$arrLine[0]]=$arrLine[1]; } } ?>
Configure OpenVPN

Client settings

Server settings

'; } else { echo ''; } ?>
TOR is not running
'; } else { $status = '
TOR is running
'; } foreach( $return as $a ) { if( $a[0] != "#" ) { $arrLine = explode( " ",$a) ; $arrConfig[$arrLine[0]]=$arrLine[1]; } } ?>
Configure TOR proxy

Basic settings

Relay settings

'; } else { echo ''; }; ?>
/tmp/hostapddata", $return ); system( "sudo cp /tmp/hostapddata " . RASPI_HOSTAPD_CONFIG, $return ); if( $return == 0 ) { echo "Wifi Hotspot settings saved"; } else { echo "Wifi Hotspot settings failed to be saved"; } } elseif( isset($_POST['SaveOpenVPNSettings']) ) { // TODO } elseif( isset($_POST['SaveTORProxySettings']) ) { // TODO } elseif( isset($_POST['StartHotspot']) ) { echo "Attempting to start hotspot"; exec( 'sudo /etc/init.d/hostapd start', $return ); foreach( $return as $line ) { echo $line."
"; } } elseif( isset($_POST['StopHotspot']) ) { echo "Attempting to stop hotspot"; exec( 'sudo /etc/init.d/hostapd stop', $return ); foreach( $return as $line ) { echo $line."
"; } } elseif( isset($_POST['StartOpenVPN']) ) { echo "Attempting to start openvpn"; exec( 'sudo /etc/init.d/openvpn start', $return ); foreach( $return as $line ) { echo $line."
"; } } elseif( isset($_POST['StopOpenVPN']) ) { echo "Attempting to stop openvpn"; exec( 'sudo /etc/init.d/openvpn stop', $return ); foreach( $return as $line ) { echo $line."
"; } } elseif( isset($_POST['StartTOR']) ) { echo "Attempting to start TOR"; exec( 'sudo /etc/init.d/tor start', $return ); foreach( $return as $line ) { echo $line."
"; } } elseif( isset($_POST['StopTOR']) ) { echo "Attempting to stop TOR"; exec( 'sudo /etc/init.d/tor stop', $return ); foreach( $return as $line ) { echo $line."
"; } } } ?>