From d5c097277df1522ebc28a81b1e0e22ceddd88c53 Mon Sep 17 00:00:00 2001 From: Yuxin Wu Date: Wed, 29 Nov 2017 02:33:15 -0800 Subject: [PATCH] update docs --- README.md | 24 +++++++++--------------- android-interact.sh | 17 +++++++++++------ count-message.sh | 6 +++--- list-chats.py | 2 +- 4 files changed, 24 insertions(+), 25 deletions(-) diff --git a/README.md b/README.md index 347a336..1e47842 100644 --- a/README.md +++ b/README.md @@ -65,29 +65,23 @@ pip install --user --pre pysox ./decrypt-db.py ``` - NOTE: you may need to try different ways to getting imei & uin, - because things behave differently on different phones. - Some phones may have multiple imei, you may need to try them all. See [#33](https://github.com/ppwwyyxx/wechat-dump/issues/33). + NOTE: you may need to try different ways to get imei, + because things behave differently on different phones. + Some phones may have multiple imei, you may need to try them all. + See [#33](https://github.com/ppwwyyxx/wechat-dump/issues/33). - If the decryption doesn't work, maybe try the version of sqlcipher in `legacy`. - If things still don't work, you can try the [password cracker](https://github.com/chg-hou/EnMicroMsg.db-Password-Cracker) + If decryption doesn't work, you can also try the [password cracker](https://github.com/chg-hou/EnMicroMsg.db-Password-Cracker) to brute-force the password. + Copy the WeChat user resource directory `/mnt/sdcard/tencent/MicroMsg/${userid}/{avatar,emoji,image2,sfs,video,voice2}` from the phone to the `resource` directory: + `./android-interact.sh res` + You might need to change `RES_DIR` in the script if the default is incorrect on your phone. - + This can take a __very long__ time. Some manual ways to do it faster: + + This script needs busybox and base64 on your phone. + If they are not available, there is a slow fallback method in the script you can use. + + This can take a few minutes. One way to do it faster: + If there's enough free space on your phone, you can log in and archive all required files via `busybox tar` with or without compression, and use `adb pull` to copy the archive. Note that `busybox` is needed as the Android system's `tar` may choke on long paths. - + Alternatively, you can use pipes. This is slower, but doesn't require any free space on your phone. - ```sh - # This will copy the whole 'MicroMsg' to the current directory: - adb shell 'cd /mnt/sdcard/tencent && - busybox tar czf - MicroMsg 2>/dev/null | busybox base64' | - base64 -di | tar xzf - - ``` - - + What you'll need in the end is a `resource` directory with the following subdir: `avatar,emoji,image2,sfs,video,voice2`. + + What you'll need in the end is a `resource` directory with the following subdir: `avatar,emoji,image2,sfs,video,voice2`. + (Optional) Download the emoji cache from [here](https://github.com/ppwwyyxx/wechat-dump/releases/download/0.1/emoji.cache.tar.bz2) and put it under `resource/emoji`. This will avoid downloading too many emojis during rendering. diff --git a/android-interact.sh b/android-interact.sh index 4b287b4..2cccb40 100755 --- a/android-interact.sh +++ b/android-interact.sh @@ -1,6 +1,6 @@ #!/bin/bash # File: android-interact.sh -# Date: Fri Jun 26 10:38:07 2015 +0800 +# 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"` @@ -31,7 +31,7 @@ elif [[ $1 == "imei" ]]; then 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, or report a bug." + >&2 echo "Failed to get imei. You can try other methods mentioned in README, or report a bug." exit 1 } echo "Got imei: $imei" @@ -51,12 +51,17 @@ elif [[ $1 == "db" || $1 == "res" ]]; then echo "Found $numUser user(s). User chosen: $chooseUser" if [[ $1 == "res" ]]; then - echo "Pulling resources... this might take a long time, because adb sucks..." mkdir -p resource; cd resource + echo "Pulling resources... " for d in avatar image2 voice2 emoji video sfs; do - mkdir -p $d; cd $d - adb pull "$RES_DIR/$chooseUser/$d" - cd .. + adb shell "cd $RES_DIR/$chooseUser && + busybox tar czf - $d 2>/dev/null | busybox base64" | + base64 -di | tar xzf - + + # Old Slow Way: + # mkdir -p $d; cd $d + # adb pull "$RES_DIR/$chooseUser/$d" + # cd .. [[ -d $d ]] || { >&2 echo "Failed to download resource directory: $RES_DIR/$chooseUser/$d" exit 1 diff --git a/count-message.sh b/count-message.sh index 3e8d42f..4d885dd 100755 --- a/count-message.sh +++ b/count-message.sh @@ -1,6 +1,6 @@ #!/bin/bash -e # File: count-message.sh -# Date: Sun Apr 12 21:01:01 2015 +0900 +# Date: Wed Nov 29 02:32:40 2017 -0800 # Author: Kangjing Huang @@ -11,7 +11,7 @@ then fi # TODO work on db directly -echo -e "Filename\tCounts of message\tCounts of chars\tCounts of words" +echo -e "Filename\t#Lines\t#Chars\t#Words" SAVEIFS=$IFS IFS=$(echo -en "\n\b") @@ -23,6 +23,6 @@ do CHARCOUNT=$(cat "$i"| sed 's/.*:[0-9][0-9]:\(.*\)/\1/g' | sed 's/\[.*\]//g' | grep -v img | wc -m) WORDCOUNT=$(cat "$i"| sed 's/.*:[0-9][0-9]:\(.*\)/\1/g' | sed 's/\[.*\]//g' | grep -v img | wc -w) echo -e "$LINECOUNT\t$CHARCOUNT\t$WORDCOUNT" -done +done | sort -t $'\t' -k 2 -n | column -t -s $'\t' IFS=$SAVEIFS diff --git a/list-chats.py b/list-chats.py index cc08447..e68fbd4 100755 --- a/list-chats.py +++ b/list-chats.py @@ -14,4 +14,4 @@ db_file = sys.argv[1] parser = WeChatDBParser(db_file) chats = parser.msgs_by_chat.keys() for k in chats: - print parser.contacts[k], '\t', k + print parser.contacts[k], '\t', k