diff --git a/android-interact.sh b/android-interact.sh index 4704c55..c1b31cb 100755 --- a/android-interact.sh +++ b/android-interact.sh @@ -1,9 +1,9 @@ #!/bin/bash -e # File: android-interact.sh -# Date: Thu Dec 25 00:25:07 2014 +0800 +# Date: Thu Dec 25 23:26:56 2014 +0800 # Author: Yuxin Wu -# Please check that your path is the same, since this might be differnt on devices +# 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" @@ -43,17 +43,16 @@ elif [[ $1 == "db" || $1 == "res" ]]; then echo "Pulling resources... this might take a long time..." mkdir resource cd resource - adb pull $RES_DIR/$chooseUser/image2 - adb pull $RES_DIR/$chooseUser/voice2 - adb pull $RES_DIR/$chooseUser/emoji - adb pull $RES_DIR/$chooseUser/avatar - [[ -d image2 && -d voice2 && -d emoji && -d avatar ]] && { - echo "Resource pulled." - echo "Total size: $(du -sh $chooseUser | cut -f1)" - } || { - echo "Failed to download resource directory: $RES_DIR/$chooseUser" - exit 1 - } + for d in image2 voice2 emoji avatar; do + adb pull $RES_DIR/$chooseUser/$d + [[ -d $d ]] || { + echo "Failed to download resource directory: $RES_DIR/$chooseUser/$d" + exit 1 + } + done + cd .. + echo "Resource pulled at ./resource" + echo "Total size: $(du -sh resource | cut -f1)" else echo "Pulling database file..." adb pull $MM_DIR/MicroMsg/$chooseUser/EnMicroMsg.db diff --git a/decrypt_db.sh b/decrypt_db.sh index 6b27b0e..c03e7f1 100755 --- a/decrypt_db.sh +++ b/decrypt_db.sh @@ -1,11 +1,12 @@ #!/bin/bash -e # File: decrypt_db.sh -# Date: Thu Dec 25 00:30:10 2014 +0800 +# Date: Fri Dec 26 00:16:12 2014 +0800 # Author: Yuxin Wu -MMSGDB=$1 +MSGDB=$1 imei=$2 uin=$3 +output=decoded.db if [[ -z "$1" || -z "$2" || -z "$3" ]]; then echo "Usage: $0 " @@ -15,11 +16,21 @@ fi KEY=$(echo -n "$imei$uin" | md5sum | cut -b 1-7) echo "KEY: $KEY" -export LD_LIBRARY_PATH=./lib -./lib/sqlcipher $MMSGDB << EOF +uname -m | grep x86_64 > /dev/null || version=32bit && version=64bit +echo "Use $version sqlcipher." + +echo "Dump decoded database... " +echo "Don't worry about libcrypt.so version warning." + + +SQLCIPHER=./sqlcipher/$version +export LD_LIBRARY_PATH=$SQLCIPHER +$SQLCIPHER/sqlcipher $MSGDB << EOF PRAGMA key='$KEY'; PRAGMA cipher_use_hmac = off; -ATTACH DATABASE "decoded_database.db" AS decoded_db KEY ""; -SELECT sqlcipher_export("decoded_db"); -DETACH DATABASE decoded_db; +ATTACH DATABASE "$output" AS db KEY ""; +SELECT sqlcipher_export("db"); +DETACH DATABASE db; EOF + +echo "Database dumped to $output" diff --git a/lib/sqlcipher b/lib/sqlcipher deleted file mode 100755 index 4f3b3d4..0000000 Binary files a/lib/sqlcipher and /dev/null differ