Нет описания

Yuxin Wu be3009fbd2 Decode WXGF locally with ffmpeg 2 недель назад
WXGFDecoder a0d362d9f6 Move frida.md 1 год назад
legacy f6acd0b0bf move common/ into wechat/ 5 лет назад
screenshots cddca228b0 add screenshots 11 лет назад
tests be3009fbd2 Decode WXGF locally with ffmpeg 2 недель назад
third-party 20708ef755 update 1 год назад
wechat be3009fbd2 Decode WXGF locally with ffmpeg 2 недель назад
.gitattributes 4d13d287d0 add gitattr 10 лет назад
.gitignore eeba4b7e6c fix old avatar storage 5 лет назад
LICENSE.txt 442a3fc6fc add license 11 лет назад
README.md be3009fbd2 Decode WXGF locally with ffmpeg 2 недель назад
android-interact.sh 928b92ade1 To make it compatible with `user` (not `userdebug`) builds, use `adb shell su` instead of `adb root` whenever possible (#102) 5 месяцев назад
count-message.sh 5893e7c6e6 update docs 8 лет назад
dump-audio.py a38c12fe4b Fix dump-audio (#103) 8 месяцев назад
dump-html.py eedaa9c9e0 support downloading avatar 1 год назад
dump-msg.py f6acd0b0bf move common/ into wechat/ 5 лет назад
emoji-cache-tool.py 95826392df rewrite with python3 5 лет назад
list-chats.py 95826392df rewrite with python3 5 лет назад
plot-num-msg-by-time.py e1a1b0b946 remove ensure_unicode 1 год назад
requirements.txt be3009fbd2 Decode WXGF locally with ffmpeg 2 недель назад

README.md

Render WeChat Messages from Android

安卓微信消息记录分析工具

WeChat, as the most popular mobile IM app in China, doesn't provide any methods to read its message history. Customers are not able to analyze their own chat messages or interact with other data analysis tools.

We provide this tool that can parse WeChat messages from a rooted android phone. This is necessary to provide interoperability between WeChat messages and other message analysis tools. As examples, we provide sample scripts to obtain statistics of the message history and render the messages into self-contained html files including voice messages, images, emojis, videos, etc. Users can also write custom programs based on this tool to manage their chat messages.

The tool is last verified to work with latest version of WeChat on 2025/01/01. If the tool works for you, please take a moment to add your phone/OS to the wiki.

How to use:

Dependencies:

  • adb and rooted android phone connected to a Linux/Mac OSX/Win10+Bash.
  • Python >= 3.8
  • sox (command line tools)
  • Silk audio decoder (included; build it with ./third-party/compile_silk.sh)
  • ffmpeg (optional; to decode WXGF images locally)
  • Other python dependencies: pip install -r requirements.txt.

Get Necessary Data:

  1. Pull database file and (for older WeChat versions) avatar index:
    • Automatic: ./android-interact.sh db. It may use an incorrect userid.
    • Manual:
    • Figure out your ${userid} by inspecting the contents of /data/data/com.tencent.mm/MicroMsg on the root filesystem of the device. It should be a 32-character-long name consisting of hexadecimal digits.
    • Get /data/data/com.tencent.mm/MicroMsg/${userid}/EnMicroMsg.db from the device.
  2. Decode EnMicroMsg.db. We do not provide instructions to do that.
  3. Copy the unencrypted WeChat user resource directory /data/data/com.tencent.mm/MicroMsg/${userid}/{avatar,emoji,image2,sfs,video,voice2} from the phone to the resource directory:

    • ./android-interact.sh res
    • Change RES_DIR in the script if the location of these directories is different on your phone. For older version of WeChat, the directory may be /mnt/sdcard/tencent/MicroMsg/
    • This can take a while. It can be faster to first archive it with tar with or without compression, and then copy the archive, busybox tar is recommended as the Android system's tar may choke on long paths.
    • In the end, we need a resource directory with the following subdir: avatar,emoji,image2,sfs,video,voice2.
  4. (Optional) Decode WXGF images:

    • If ffmpeg/ffprobe are available, WXGF images/emojis are decoded locally when possible.
    • Otherwise, you can install and start a WXGF decoder server on an android device and pass --wxgf-server ws://xx.xx.xx.xx:xxxx. See WXGFDecoder for instructions.
  5. (Optional) Download the emoji cache from here and decompress it under wechat-dump. This will avoid downloading too many emojis during rendering.

    wget -c https://github.com/ppwwyyxx/wechat-dump/releases/download/0.1/emoji.cache.tar.bz2
    tar xf emoji.cache.tar.bz2
    

Run:

  • Parse and dump text messages of every chat (requires decoded database):

    ./dump-msg.py decoded.db output_dir
    
  • List all chats (required decoded database):

    ./list-chats.py decoded.db
    
  • Generate statistics report on text messages (requires output_dir from ./dump-msg.py):

    ./count-message.sh output_dir
    
  • Dump messages of one contact to html, containing voice messages, emojis, and images (requires decoded database and resource):

    ./dump-html.py "<contact_display_name>"
    
    • The output file is output.html. Check ./dump-html.py -h to use different input/output paths.
    • Add --wxgf-server ws://xx.xx.xx.xx:xxxx to use a WXGF decoder server.

Examples:

Screenshots of generated html:

byvoid

See here for an example html.

TODO List (help needed!)

  • After chat history migration, some emojis in the EmojiInfo table don't have corresponding URLs but only a md5 - they are not downloaded by WeChat until the message needs to be displayed. We don't know how to manually download these emojis.
  • Verify/improve host-side WXGF decoding coverage.
  • Fix rare unhandled message types: > 10000 and < 0
  • Better user experiences... see grep 'TODO' wechat -R

Donate!

[paypal]