From 652d261ee9851967477abee3869e88386d755237 Mon Sep 17 00:00:00 2001 From: Midgard <2885-Midgard@users.noreply.framagit.org> Date: Wed, 26 Jul 2023 17:24:49 +0200 Subject: [PATCH] [bin/qrwifi] Don't search passwords in other networks' sections --- bin/qrwifi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/qrwifi b/bin/qrwifi index 7e14950..bbb34b8 100755 --- a/bin/qrwifi +++ b/bin/qrwifi @@ -11,7 +11,7 @@ fi pw="${2:-}" if [ -z "$pw" ]; then - pw="$(sudo cat /etc/wpa_supplicant/wpa_supplicant.conf | sed -n '/^[\t ]*ssid="'"$ssid"'"$/{:findpsk;N;/\n[\t ]*psk=/!b findpsk;s/^\(\n\|.\)*[\t ]*psk="\(.*\)"$/\2/p; }')" + pw="$(sudo cat /etc/wpa_supplicant/wpa_supplicant.conf | sed -n '/^[\t ]*ssid="'"$ssid"'"$/{:findpsk;N;/}/d;/\n[\t ]*psk=/!b findpsk;s/^\(\n\|.\)*[\t ]*psk="\(.*\)"$/\2/p; }')" fi if [ -z "$pw" ]; then echo "Couldn't find password for network \`$ssid\`"