Skip to content

Instantly share code, notes, and snippets.

@veez21
Last active October 11, 2023 15:19
Show Gist options
  • Save veez21/4f2541d271809864411e3ffbbe8e3df9 to your computer and use it in GitHub Desktop.
Save veez21/4f2541d271809864411e3ffbbe8e3df9 to your computer and use it in GitHub Desktop.
View wifi passwords through Termux for Android Oreo+ (Root)
#!/system/bin/sh
[ "$(whoami)" != "root" ] && { echo "root required"; exit 1; }
configs=( /data/misc/wifi/WifiConfigStore.xml /data/misc/apexdata/com.android.wifi/WifiConfigStore.xml )
for z in ${configs[@]}; do
if [ -f $z ]; then
config=$z
break
fi
done
SSID=($(grep 'name="SSID"' $config | sed "s/.*>"//;s/".*//;s/ /-_-/g"))
PSK=($(grep 'name="PreSharedKey"' $config | sed "s/<null.*/\e[01;30mNONE\e[00;37;40m/;s/.*>&quot;/\e[01;32m/;s/&quot;.*/\e[00;37;40m/;s/ /-_-/g"))
echo "WiFi Password Viewer"
echo "veez21 @ xda-developers\n"
for i in ${!SSID[@]}; do
echo "\e[01;37m${SSID[$i]}\e[00;37;40m - ${PSK[$i]}" | sed "s/-_-/ /g"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment