diff --git a/update_mad.sh b/update_mad.sh index aacb8bc..6d4de71 100644 --- a/update_mad.sh +++ b/update_mad.sh @@ -47,7 +47,17 @@ get_pd_user(){ user=$(awk -F'>' '/auth_username/{print $2}' "$pdconf"|awk -F'<' '{print $1}') pass=$(awk -F'>' '/auth_password/{print $2}' "$pdconf"|awk -F'<' '{print $1}') if [[ "$user" ]] ;then - printf "-u $user:$pass" + # decode xml entities in pass (thx to WinEunuuchs2Unix: https://stackoverflow.com/a/43058947) + pass="${pass// / }" + pass="${pass//&/&}" + pass="${pass//</<}" + pass="${pass//>/>}" + pass="${pass//"/'"'}" + pass="${pass//'/"'"}" + pass="${pass//“/'"'}" # TODO: ASCII/ISO for opening quote + pass="${pass//”/'"'}" # TODO: ASCII/ISO for closing quote + + printf %s "-u $user:$pass" fi } @@ -75,7 +85,7 @@ cast_alohomora(){ #update rgc using the wizard pserver=$(grep -v raw "$pdconf"|awk -F'>' '/post_destination/{print $2}'|awk -F'<' '{print $1}') origin=$(awk -F'>' '/post_origin/{print $2}' "$pdconf"|awk -F'<' '{print $1}') -newver="$(curl -s -L $(get_pd_user) -H "origin: $origin" "$pserver/mad_apk/rgc/noarch")" +newver="$(curl -s -k -L $(get_pd_user) -H "origin: $origin" "$pserver/mad_apk/rgc/noarch")" installedver="$(dumpsys package de.grennith.rgc.remotegpscontroller 2>/dev/null|awk -F'=' '/versionName/{print $2}'|head -n1)" if checkupdate "$newver" "$installedver" ;then echo "updating RGC..." @@ -93,7 +103,7 @@ cast_imperius(){ #update pogodroid using the wizard pserver=$(grep -v raw "$pdconf"|awk -F'>' '/post_destination/{print $2}'|awk -F'<' '{print $1}') origin=$(awk -F'>' '/post_origin/{print $2}' "$pdconf"|awk -F'<' '{print $1}') -newver="$(curl -s -L $(get_pd_user) -H "origin: $origin" "$pserver/mad_apk/pogodroid/noarch")" +newver="$(curl -s -k -L $(get_pd_user) -H "origin: $origin" "$pserver/mad_apk/pogodroid/noarch")" installedver="$(dumpsys package com.mad.pogodroid|awk -F'=' '/versionName/{print $2}'|head -n1)" if checkupdate "$newver" "$installedver" ;then echo "updating pogodroid..." @@ -110,7 +120,7 @@ reboot=1 update_pokemon(){ pserver=$(grep -v raw "$pdconf"|awk -F'>' '/post_destination/{print $2}'|awk -F'<' '{print $1}') origin=$(awk -F'>' '/post_origin/{print $2}' "$pdconf"|awk -F'<' '{print $1}') -newver="$(curl -s -L $(get_pd_user) -H "origin: $origin" "$pserver/mad_apk/pogo/armeabi-v7a")" +newver="$(curl -s -k -L $(get_pd_user) -H "origin: $origin" "$pserver/mad_apk/pogo/armeabi-v7a")" installedver="$(dumpsys package com.nianticlabs.pokemongo|awk -F'=' '/versionName/{print $2}')" [[ "$newver" == "$installedver" ]] && unset UpdatePoGo && echo "The madmin wizard has version $newver and so do we, doing nothing." && return 0 [[ "$newver" == "" ]] && unset UpdatePoGo && echo "The madmin wizard has no pogo in its system apks, or your pogodroid is not configured" && return 1