Advertisement
hmimzomatrix

wifi_password_viewer.sh

Mar 18th, 2025
324
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.86 KB | None | 0 0
  1. #!/system/bin/sh
  2. [ "$(whoami)" != "root" ] && {
  3.     echo "root required"
  4.     exit 1
  5. }
  6. configs=(/data/misc/wifi/WifiConfigStore.xml /data/misc/apexdata/com.android.wifi/WifiConfigStore.xml)
  7. for z in ${configs[@]}; do
  8.     if [ -f $z ]; then
  9.         config=$z
  10.         break
  11.     fi
  12. done
  13. echo "\n"
  14. SSID=($(grep 'name="SSID"' $config | sed "s/.*>"//;s/".*//;s/ /-_-/g"))
  15. if [ -z $MMRL ]; then
  16.     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"))
  17. else
  18.     PSK=($(grep 'name="PreSharedKey"' $config | sed "s/<null.*/NONE/;s/.*>&quot;//;s/&quot;.*//;s/ /-_-/g"))
  19. fi
  20. for i in ${!SSID[@]}; do
  21.     if [ -z $MMRL ]; then
  22.         echo "\e[01;37m${SSID[$i]}\e[00;37;40m - ${PSK[$i]}" | sed "s/-_-/ /g"
  23.     else
  24.         echo "   ${SSID[$i]} : ${PSK[$i]}" | sed "s/-_-/ /g"
  25.     fi
  26. done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement