Created
September 12, 2016 10:35
-
-
Save Pierozi/370fe35a075494ed2cc7946b1411bb3e to your computer and use it in GitHub Desktop.
Show the current password of wifi ssid connected | under Ubuntu / Debian based system
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/sh | |
myWifiPassword() { | |
SSID=`iwgetid -r` | |
FILE=/etc/NetworkManager/system-connections/$SSID | |
if [ ! -f "$FILE" ]; | |
then | |
FILE="/etc/NetworkManager/system-connections/Auto $SSID" | |
fi | |
sudo cat "$FILE" | sed -rn '/psk=([0-9A-Za-z]+)/p' | awk '{print substr($1,5)}' | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment