Skip to content

Instantly share code, notes, and snippets.

@zmarffy
Last active May 23, 2020 17:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zmarffy/dfc3536c809151cfc00d259d9d292e57 to your computer and use it in GitHub Desktop.
Save zmarffy/dfc3536c809151cfc00d259d9d292e57 to your computer and use it in GitHub Desktop.
Display SSIDs and their entered passwords on Ubuntu
#!/usr/bin/env bash
shopt -s nullglob
ssids=("/etc/NetworkManager/system-connections/*")
for ssid in ${ssids[@]}; do
ssid_name=${ssid##*/}
printf "\e[1m$ssid_name\e[0m : "
password=$(cat "$ssid" | grep "psk=" | cut -c 5-)
if [ -z "$password" ]; then
echo -e "\e[91mNo password\e[39m"
else
echo $password
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment