Created
July 20, 2022 07:31
-
-
Save aloisdg/9caf881e7cde9058826f767aa1ba1d24 to your computer and use it in GitHub Desktop.
A small utility to print the password to the current or a given ssid
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
ssid="" | |
if [ $# -eq 0 ] || [ -z "$1" ] | |
then | |
current=$(iwgetid -r) | |
ssid="${current}.nmconnection" | |
else | |
ssid=$(sudo ls /etc/NetworkManager/system-connections/ | grep "$1") | |
fi | |
path="/etc/NetworkManager/system-connections/${ssid}" | |
pskLine=$(sudo grep -r '^psk=' "$path") | |
psk=${pskLine:4} | |
echo "$psk" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment