From 0f97ecc9f0917c079e6d5a7f261abc9bfb150a44 Mon Sep 17 00:00:00 2001 From: Yuxin Wu Date: Sat, 27 Jun 2020 01:45:15 -0700 Subject: [PATCH] rewrite decryption logic --- android-interact.sh | 44 ++--------------------------------------- compatibility.sh | 13 ------------ legacy/compatibility.sh | 14 ++++++++++++- 3 files changed, 15 insertions(+), 56 deletions(-) delete mode 100755 compatibility.sh mode change 120000 => 100755 legacy/compatibility.sh diff --git a/android-interact.sh b/android-interact.sh index 0be1601..c4b9d2d 100755 --- a/android-interact.sh +++ b/android-interact.sh @@ -1,14 +1,11 @@ #!/bin/bash # File: android-interact.sh # Date: Wed Nov 29 02:19:00 2017 -0800 -# Author: Yuxin Wu PROG_NAME=`python -c "import os, sys; print(os.path.realpath(sys.argv[1]))" "$0"` PROG_DIR=`dirname "$PROG_NAME"` cd "$PROG_DIR" -source compatibility.sh - # Please check that your path is the same, since this might be different among devices RES_DIR="/mnt/sdcard/tencent/MicroMsg" MM_DIR="/data/data/com.tencent.mm" @@ -16,26 +13,7 @@ MM_DIR="/data/data/com.tencent.mm" echo "Starting rooted adb server..." adb root -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 ]] || { - >&2 echo "Failed to get wechat uin. You can try other methods, or report a bug." - exit 1 - } - rm system_config_prefs.xml - echo "Got wechat uin: $uin" -elif [[ $1 == "imei" ]]; then - imei=$(adb shell dumpsys iphonesubinfo | $GREP 'Device ID' | $GREP -o '[0-9]+') - [[ -n $imei ]] || { - imei=$(adb shell service call iphonesubinfo 1 | awk -F "'" '{print $2}' | sed 's/[^0-9A-F]*//g' | tr -d '\n') - } - [[ -n $imei ]] || { - >&2 echo "Failed to get imei. You can try other methods mentioned in README, or report a bug." - exit 1 - } - echo "Got imei: $imei" -elif [[ $1 == "db" || $1 == "res" ]]; then +if [[ $1 == "db" || $1 == "res" ]]; then echo "Looking for user dir name..." sleep 1 # sometimes adb complains: device not found # look for dirname which looks like md5 (32 alpha-numeric chars) @@ -85,26 +63,8 @@ elif [[ $1 == "db" || $1 == "res" ]]; then exit 1 } fi -elif [[ $1 == "db-decrypt" ]]; then - set -e - echo "Getting uin..." - $0 uin | tail -n1 | $GREP -o '\-?[0-9]*' | tee /tmp/uin - echo "Getting imei..." - $0 imei | tail -n1 | $GREP -o '[0-9]*' | tee /tmp/imei - echo "Getting db..." - $0 db - echo "Decrypting db..." - imei=$(cat /tmp/imei) - uin=$(cat /tmp/uin) - if [[ -z $imei || -z $uin ]]; then - >&2 echo "Failed to get imei or uin. See README for manual methods." - exit 1 - fi - ./decrypt-db.py EnMicroMsg.db $imei $uin - rm /tmp/{uin,imei} - echo "Done. See decoded.db" else - echo "Usage: $0 " + echo "Usage: $0 " exit 1 fi diff --git a/compatibility.sh b/compatibility.sh deleted file mode 100755 index d910311..0000000 --- a/compatibility.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/bash -e -# $File: compatibility.sh -# $Date: Tue Jun 16 22:23:36 2015 +0800 -# Author: Vury Leo - -if [ `uname` = 'Darwin' ]; then - GREP='grep -E' - MD5SUM='md5' -else - GREP='grep -E' - MD5SUM='md5sum' -fi - diff --git a/legacy/compatibility.sh b/legacy/compatibility.sh deleted file mode 120000 index 8bcf3f5..0000000 --- a/legacy/compatibility.sh +++ /dev/null @@ -1 +0,0 @@ -../compatibility.sh \ No newline at end of file diff --git a/legacy/compatibility.sh b/legacy/compatibility.sh new file mode 100755 index 0000000..d910311 --- /dev/null +++ b/legacy/compatibility.sh @@ -0,0 +1,13 @@ +#!/bin/bash -e +# $File: compatibility.sh +# $Date: Tue Jun 16 22:23:36 2015 +0800 +# Author: Vury Leo + +if [ `uname` = 'Darwin' ]; then + GREP='grep -E' + MD5SUM='md5' +else + GREP='grep -E' + MD5SUM='md5sum' +fi +