diff --git a/includes/admin.php b/includes/admin.php
index 7e7e900f..ba927224 100755
--- a/includes/admin.php
+++ b/includes/admin.php
@@ -14,7 +14,7 @@ function DisplayAuthConfig($username, $password){
$status->addMessage('Username must not be empty', 'danger');
} else {
if ($auth_file = fopen(RASPI_ADMIN_DETAILS, 'w')) {
- fwrite($auth_file, $new_username.PHP_EOL);
+ fwrite($auth_file, $new_username.PHP_EOL);
fwrite($auth_file, password_hash($_POST['newpass'], PASSWORD_BCRYPT).PHP_EOL);
fclose($auth_file);
$username = $new_username;
diff --git a/includes/functions.php b/includes/functions.php
index 20a44d2f..eb76ffca 100755
--- a/includes/functions.php
+++ b/includes/functions.php
@@ -770,4 +770,39 @@ function DisplaySystem(){
";
+ }
+ } 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."
";
+ }
+ }
+}
?>
diff --git a/includes/hostapd.php b/includes/hostapd.php
index 1eb4aa6b..9d35785b 100755
--- a/includes/hostapd.php
+++ b/includes/hostapd.php
@@ -10,32 +10,16 @@ function DisplayHostAPDConfig(){
$status = new StatusMessages();
+ $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');
+ exec("ip -o link show | awk -F': ' '{print $2}'", $interfaces);
+
+
if( isset($_POST['SaveHostAPDSettings']) ) {
if (CSRFValidate()) {
- $config = 'driver=nl80211'.PHP_EOL
- .'ctrl_interface='.RASPI_HOSTAPD_CTRL_INTERFACE.PHP_EOL
- .'ctrl_interface_group=0'.PHP_EOL
- .'beacon_int=100'.PHP_EOL
- .'auth_algs=1'.PHP_EOL
- .'wpa_key_mgmt=WPA-PSK'.PHP_EOL;
-
- $config .= "interface=".$_POST['interface'].PHP_EOL;
- $config .= "ssid=".$_POST['ssid'].PHP_EOL;
- $config .= "hw_mode=".$_POST['hw_mode'].PHP_EOL;
- $config .= "channel=".$_POST['channel'].PHP_EOL;
- $config .= "wpa=".$_POST['wpa'].PHP_EOL;
- $config .='wpa_passphrase='.$_POST['wpa_passphrase'].PHP_EOL;
- $config .="wpa_pairwise=".$_POST['wpa_pairwise'].PHP_EOL;
- $config .="country_code=".$_POST['country_code'];
-
- exec( "echo '$config' > /tmp/hostapddata", $return );
- system( "sudo cp /tmp/hostapddata " . RASPI_HOSTAPD_CONFIG, $return );
-
- if( $return == 0 ) {
- $status->addMessage('Wifi Hotspot settings saved', 'success');
- } else {
- $status->addMessage('Wifi Hotspot settings failed to be saved', 'danger');
- }
+ SaveHostAPDConfig($arrSecurity, $arrEncType, $arrChannel, $interfaces, $status);
} else {
error_log('CSRF violation');
}
@@ -70,11 +54,6 @@ function DisplayHostAPDConfig(){
$status->addMessage('HostAPD is running', 'success');
}
- $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) ;
@@ -84,7 +63,7 @@ function DisplayHostAPDConfig(){
?>