From 5ca0e4e90e596b79c7ab5506607d5341654182b7 Mon Sep 17 00:00:00 2001 From: ppwwyyxx Date: Sun, 30 Aug 2015 09:22:04 -0400 Subject: [PATCH] more logging in android-interact --- android-interact.sh | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/android-interact.sh b/android-interact.sh index b422dbc..04e20d3 100755 --- a/android-interact.sh +++ b/android-interact.sh @@ -20,7 +20,7 @@ if [[ $1 == "uin" ]]; then adb pull $MM_DIR/shared_prefs/system_config_prefs.xml 2>/dev/null uin=$(grep 'default_uin' system_config_prefs.xml | $GREP -o 'value="[0-9]*' | cut -c 8-) [[ -n $uin ]] || { - echo "Failed to get wechat uin. You can try other methods, or report a bug." + >&2 echo "Failed to get wechat uin. You can try other methods, or report a bug." exit 1 } rm system_config_prefs.xml @@ -28,7 +28,7 @@ if [[ $1 == "uin" ]]; then elif [[ $1 == "imei" ]]; then imei=$(adb shell dumpsys iphonesubinfo | grep 'Device ID' | $GREP -o '[0-9]\+') [[ -n $imei ]] || { - echo "Failed to get imei. You can try other methods, or report a bug." + >&2 echo "Failed to get imei. You can try other methods, or report a bug." exit 1 } echo "Got imei: $imei" @@ -41,7 +41,7 @@ elif [[ $1 == "db" || $1 == "res" ]]; then # choose the first user. chooseUser=$(echo $userList | head -n1) [[ -n $chooseUser ]] || { - echo "Could not find user. Please check whether your resource dir is $RES_DIR" + >&2 echo "Could not find user. Please check whether your resource dir is $RES_DIR" exit 1 } echo "Found $numUser user(s). User chosen: $chooseUser" @@ -54,7 +54,7 @@ elif [[ $1 == "db" || $1 == "res" ]]; then adb pull $RES_DIR/$chooseUser/$d cd .. [[ -d $d ]] || { - echo "Failed to download resource directory: $RES_DIR/$chooseUser/$d" + >&2 echo "Failed to download resource directory: $RES_DIR/$chooseUser/$d" exit 1 } done @@ -66,11 +66,11 @@ elif [[ $1 == "db" || $1 == "res" ]]; then adb pull $MM_DIR/MicroMsg/$chooseUser/EnMicroMsg.db [[ -f EnMicroMsg.db ]] && \ echo "File successfully downloaded to EnMicroMsg.db" || { - echo "Failed to pull database from adb" + >&2 echo "Failed to pull database from adb" exit 1 } fi -elif [[ $1 == "db_decrypt" ]]; then +elif [[ $1 == "db-decrypt" ]]; then echo "Getting uin..." $0 uin | tail -n1 | grep -o '[0-9]*' | tee /tmp/uin echo "Getting imei..." @@ -78,11 +78,17 @@ elif [[ $1 == "db_decrypt" ]]; then echo "Getting db..." $0 db echo "Decrypting db..." - ./decrypt-db.sh EnMicroMsg.db $(&2 echo "Failed to get imei or uin. See README for manual methods." + exit 1 + fi + ./decrypt-db.sh EnMicroMsg.db $imei $uin rm /tmp/{uin,imei} echo "Done. See decoded.db" else - echo "Usage: $0 " + echo "Usage: $0 " exit 1 fi