[arch-projects] [netcfg] Fix passphrase dialog in wifi-menu
I didn't actually test this, but it adds support for hex psk in wifi-menu, which has been forgotten, as usual.
Text passphrases may contain spaces and should be quoted in the netcfg profile --- scripts/wifi-menu | 2 +- 1 Datei geändert, 1 Zeile hinzugefügt(+), 1 Zeile entfernt(-) diff --git a/scripts/wifi-menu b/scripts/wifi-menu index 10353f8..4b1db24 100755 --- a/scripts/wifi-menu +++ b/scripts/wifi-menu @@ -117,7 +117,7 @@ create_profile() key=$(wpa_passphrase "$1" "$key" | grep -m 1 "^[[:space:]]*psk=") key="KEY=${key#*psk=}" else - key="KEY=$(printf "%q" "$key")" + key="KEY='$(printf "%q" "$key")'" fi fi cat << EOF > "$PROFILE_DIR/$PROFILE" -- 1.7.11.4
On Tue, Aug 7, 2012 at 10:11 PM, Thomas Bächler <thomas@archlinux.org> wrote:
Text passphrases may contain spaces and should be quoted in the netcfg profile --- scripts/wifi-menu | 2 +- 1 Datei geändert, 1 Zeile hinzugefügt(+), 1 Zeile entfernt(-)
diff --git a/scripts/wifi-menu b/scripts/wifi-menu index 10353f8..4b1db24 100755 --- a/scripts/wifi-menu +++ b/scripts/wifi-menu @@ -117,7 +117,7 @@ create_profile() key=$(wpa_passphrase "$1" "$key" | grep -m 1 "^[[:space:]]*psk=") key="KEY=${key#*psk=}" else - key="KEY=$(printf "%q" "$key")" + key="KEY='$(printf "%q" "$key")'" fi fi cat << EOF > "$PROFILE_DIR/$PROFILE" -- 1.7.11.4
The %q already takes care of that.
Am 09.08.2012 17:24, schrieb Jouke Witteveen:
On Tue, Aug 7, 2012 at 10:11 PM, Thomas Bächler <thomas@archlinux.org> wrote:
Text passphrases may contain spaces and should be quoted in the netcfg profile --- scripts/wifi-menu | 2 +- 1 Datei geändert, 1 Zeile hinzugefügt(+), 1 Zeile entfernt(-)
diff --git a/scripts/wifi-menu b/scripts/wifi-menu index 10353f8..4b1db24 100755 --- a/scripts/wifi-menu +++ b/scripts/wifi-menu @@ -117,7 +117,7 @@ create_profile() key=$(wpa_passphrase "$1" "$key" | grep -m 1 "^[[:space:]]*psk=") key="KEY=${key#*psk=}" else - key="KEY=$(printf "%q" "$key")" + key="KEY='$(printf "%q" "$key")'" fi fi cat << EOF > "$PROFILE_DIR/$PROFILE" -- 1.7.11.4
The %q already takes care of that.
I see, it escapes. Alright, this means my second patch needs adjustment (the second patch is based on this). Should I resend it or can you fix it yourself?
WPA allows the use of 64 digit hex passphrases. Allow this in wifi-menu as well. --- scripts/wifi-menu | 15 ++++++++++----- 1 Datei geändert, 10 Zeilen hinzugefügt(+), 5 Zeilen entfernt(-) diff --git a/scripts/wifi-menu b/scripts/wifi-menu index 4b1db24..f5d4857 100755 --- a/scripts/wifi-menu +++ b/scripts/wifi-menu @@ -112,12 +112,17 @@ create_profile() [[ "$OBSCURE" ]] && box="--insecure --passwordbox" || box="--inputbox" msg="Enter $security security key for\n'$1'" key=$(dialog $box "$msg" 10 40 --stdout) || return $? - [[ "${#key}" -ge 8 && "${#key}" -le 63 ]] || return 4 - if [[ "$OBSCURE" ]]; then - key=$(wpa_passphrase "$1" "$key" | grep -m 1 "^[[:space:]]*psk=") - key="KEY=${key#*psk=}" + if [[ "${#key}" -ge 8 && "${#key}" -le 63 ]]; then + if [[ "$OBSCURE" ]]; then + key=$(wpa_passphrase "$1" "$key" | grep -m 1 "^[[:space:]]*psk=") + key="KEY=${key#*psk=}" + else + key="KEY='$(printf "%q" "$key")'" + fi + elif [[ "${#key}" -eq 64 && ${key} = +([0-9a-fA-F]) ]]; then + key="KEY=${key}" else - key="KEY='$(printf "%q" "$key")'" + return 4 fi fi cat << EOF > "$PROFILE_DIR/$PROFILE" -- 1.7.11.4
On Tue, Aug 7, 2012 at 10:11 PM, Thomas Bächler <thomas@archlinux.org> wrote:
I didn't actually test this, but it adds support for hex psk in wifi-menu, which has been forgotten, as usual.
Why would you want to enter your password in hex?! A WEP password already is within the allowed length range, if you want an obscured password, use the obscure parameter of wifi-menu.
Am 09.08.2012 17:27, schrieb Jouke Witteveen:
On Tue, Aug 7, 2012 at 10:11 PM, Thomas Bächler <thomas@archlinux.org> wrote:
I didn't actually test this, but it adds support for hex psk in wifi-menu, which has been forgotten, as usual.
Why would you want to enter your password in hex?! A WEP password already is within the allowed length range, if you want an obscured password, use the obscure parameter of wifi-menu.
Because the WPA standard says you can do it: It allows for entering a 32 Byte hex key directly (btw, this works on every divce I tried so far, including Windows, OS X, my cheap Sony Ericsson phone with proprietary firmware, the Amazon Kindle, ...). When you have a raw hex key, there is no way to determine the passphrase - it is not even clear that a passphrase exists that results in this key. For instance, on my home wireless network, there is no way to connect other than entering the hex key - there is no 8-63 passphrase that would allow you to connect.
On Thu, Aug 9, 2012 at 5:42 PM, Thomas Bächler <thomas@archlinux.org> wrote:
Am 09.08.2012 17:27, schrieb Jouke Witteveen:
On Tue, Aug 7, 2012 at 10:11 PM, Thomas Bächler <thomas@archlinux.org> wrote:
I didn't actually test this, but it adds support for hex psk in wifi-menu, which has been forgotten, as usual.
Why would you want to enter your password in hex?! A WEP password already is within the allowed length range, if you want an obscured password, use the obscure parameter of wifi-menu.
Because the WPA standard says you can do it: It allows for entering a 32 Byte hex key directly (btw, this works on every divce I tried so far, including Windows, OS X, my cheap Sony Ericsson phone with proprietary firmware, the Amazon Kindle, ...).
Never noticed this part of the standard... In that case it all makes sense and I'll merge your patch with the next version.
When you have a raw hex key, there is no way to determine the passphrase - it is not even clear that a passphrase exists that results in this key.
Since there are over 95^63 >> 2^64 passwords and the passwords are hashed before usage, there almost certainly is ;-).
For instance, on my home wireless network, there is no way to connect other than entering the hex key - there is no 8-63 passphrase that would allow you to connect.
Thanks for the contribution! - Jouke
participants (2)
-
Jouke Witteveen
-
Thomas Bächler