From ee41ed7e0f51052910297da624e1fe91272af06f Mon Sep 17 00:00:00 2001 From: D9ping Date: Wed, 10 Oct 2018 20:11:10 +0200 Subject: [PATCH 1/3] Added support for hidding SSID. Implement idea from #247. Signed-off-by: D9ping --- includes/hostapd.php | 38 +++++++++++++++++++++++++++++++++----- 1 file changed, 33 insertions(+), 5 deletions(-) diff --git a/includes/hostapd.php b/includes/hostapd.php index 4314aaff..c162765d 100755 --- a/includes/hostapd.php +++ b/includes/hostapd.php @@ -183,18 +183,31 @@ if (in_array($arrConfig['country_code'], $countries_max11channels)) {

-
- + /> +
+
+
+
+
+ + /> +
@@ -538,6 +551,20 @@ function SaveHostAPDConfig($wpa_array, $enc_types, $modes, $interfaces, $status) $good_input = false; } + if (isset($_POST['hiddenSSID'])) { + if (!is_int((int)$_POST['hiddenSSID'])) { + $status->addMessage('Parameter hiddenSSID not a number.', 'danger'); + $good_input = false; + } elseif ((int)$_POST['hiddenSSID'] < 0 || (int)$_POST['hiddenSSID'] >= 3) { + $status->addMessage('Parameter hiddenSSID contains invalid configuratie value.', 'danger'); + $good_input = false; + } else { + $ignore_broadcast_ssid = $_POST['hiddenSSID']; + } + } else { + $ignore_broadcast_ssid = '0'; + } + if (! in_array($_POST['interface'], $interfaces)) { // The user is probably up to something here but it may also be a // genuine error. @@ -577,6 +604,7 @@ function SaveHostAPDConfig($wpa_array, $enc_types, $modes, $interfaces, $status) fwrite($tmp_file, 'wpa='.$_POST['wpa'].PHP_EOL); fwrite($tmp_file, 'wpa_pairwise='.$_POST['wpa_pairwise'].PHP_EOL); fwrite($tmp_file, 'country_code='.$_POST['country_code'].PHP_EOL); + fwrite($tmp_file, 'ignore_broadcast_ssid='.$ignore_broadcast_ssid.PHP_EOL); fclose($tmp_file); system( "sudo cp /tmp/hostapddata " . RASPI_HOSTAPD_CONFIG, $return ); From 2104f620bcbf8301aabecdea5b6f71a39afeebe4 Mon Sep 17 00:00:00 2001 From: D9ping Date: Fri, 12 Oct 2018 13:05:15 +0200 Subject: [PATCH 2/3] Allow creating not secured wi-fi. Fixes #208 Signed-off-by: D9ping --- includes/hostapd.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/includes/hostapd.php b/includes/hostapd.php index c162765d..d85d2184 100755 --- a/includes/hostapd.php +++ b/includes/hostapd.php @@ -14,7 +14,7 @@ function DisplayHostAPDConfig() $arrConfig = array(); $arr80211Standard = array('a','b','g','n'); - $arrSecurity = array( 1 => 'WPA', 2 => 'WPA2',3=> 'WPA+WPA2'); + $arrSecurity = array(1 => 'WPA', 2 => 'WPA2', 3 => 'WPA+WPA2', 'none' => _("None")); $arrEncType = array('TKIP' => 'TKIP', 'CCMP' => 'CCMP', 'TKIP CCMP' => 'TKIP+CCMP'); exec("ip -o link show | awk -F': ' '{print $2}'", $interfaces); @@ -139,7 +139,7 @@ if (in_array($arrConfig['country_code'], $countries_max11channels)) { $selectablechannels = range(1, 14); } } - SelectorOptions('channel', $selectablechannels, intval($arrConfig['channel']), 'cbxchannel') ?> + SelectorOptions('channel', $selectablechannels, intval($arrConfig['channel']), 'cbxchannel'); ?>
From 9f5cf8a069b9984e83377302fa82f6333e94c4cc Mon Sep 17 00:00:00 2001 From: D9ping Date: Sun, 14 Oct 2018 03:21:17 +0200 Subject: [PATCH 3/3] Allow empty passphrase to be entered on no security. #208 Signed-off-by: D9ping --- includes/hostapd.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/includes/hostapd.php b/includes/hostapd.php index d85d2184..20224812 100755 --- a/includes/hostapd.php +++ b/includes/hostapd.php @@ -546,7 +546,8 @@ function SaveHostAPDConfig($wpa_array, $enc_types, $modes, $interfaces, $status) $good_input = false; } - if (strlen($_POST['wpa_passphrase']) < 8 || strlen($_POST['wpa_passphrase']) > 63) { + if ($_POST['wpa'] !== 'none' && + (strlen($_POST['wpa_passphrase']) < 8 || strlen($_POST['wpa_passphrase']) > 63)) { $status->addMessage('WPA passphrase must be between 8 and 63 characters', 'danger'); $good_input = false; }