From b2468073045cc256f6f57cb7614eb66efef9c923 Mon Sep 17 00:00:00 2001 From: Yuxin Wu Date: Sat, 27 Jun 2020 01:49:45 -0700 Subject: [PATCH] update --- README.md | 6 +++--- decrypt-db.py | 10 ++++++---- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index cdd0392..5dc9adc 100644 --- a/README.md +++ b/README.md @@ -25,6 +25,7 @@ If it doesn't work, please leave an issue together with your phone/OS/wechat ver Decryption of database needs: + adb and rooted android phone connected to a Linux/Mac OSX/Win10+Bash. + If the phone does not come with adb support, you can download an app such as https://play.google.com/store/apps/details?id=eu.chainfire.adbd + Python3 with [PyQuery](https://pypi.python.org/pypi/pyquery/), [javaobj-py3](https://pypi.org/project/javaobj-py3), [sqlcipher](https://github.com/sqlcipher/sqlcipher) >= 4.1, [pysqlcipher3](https://pypi.python.org/pypi/pysqlcipher3). @@ -46,7 +47,6 @@ On Debian/Ubuntu systems, these dependencies can be installed via: + Get `/data/data/com.tencent.mm/MicroMsg/${userid}/{EnMicroMsg.db,sfs/avatar.index}` from the device. 2. Decrypt database file: + Automatic: `./decrypt-db.py decrypt --input EnMicroMsg.db` - + Requires rooted adb. If the OS distribution does not come with adb support, you can download an app such as https://play.google.com/store/apps/details?id=eu.chainfire.adbd + Manual: + Get WeChat uin (an integer), possible ways are: + `./decrypt-db.py uin`, which looks for uin in `/data/data/com.tencent.mm/shared_prefs/` @@ -55,10 +55,10 @@ On Debian/Ubuntu systems, these dependencies can be installed via: + `./decrypt-db.py imei` implements some ways to find device id. + Call `*#06#` on your phone + Find IMEI in system settings - + Decrypt database with combination of uin and imei: + + Decrypt database with combination of uin and device id: ``` - ./decrypt-db.py --input EnMicroMsg.db --imei --uin + ./decrypt-db.py decrypt --input EnMicroMsg.db --imei --uin ``` NOTE: you may need to try different ways to get device id and fine one that can decrypt the diff --git a/decrypt-db.py b/decrypt-db.py index 4de96f4..25afa2e 100755 --- a/decrypt-db.py +++ b/decrypt-db.py @@ -2,15 +2,17 @@ # -*- coding: utf-8 -*- import subprocess +import os import sys -import re, struct +import re +import struct import argparse import logging from pyquery import PyQuery from pysqlcipher3 import dbapi2 as sqlite from hashlib import md5 -import wechat +import wechat # noqa: setup logger color logger = logging.getLogger("wechat") @@ -106,7 +108,7 @@ def get_uin(): else: candidates.append(uin) logger.info(f"found uin={uin} in auth_info_key_prefs.xml") - candidates = list(set(x for x in candidates if x != 0)) + candidates = list({x for x in candidates if x != 0}) logger.info(f"Possible uin: {candidates}") return candidates @@ -118,7 +120,7 @@ def get_imei(): # https://gist.github.com/ktnr74/60ac7bcc2cd17b43f2cb def __init__(self, text): if text.startswith(b'Result: Parcel(') and text.endswith(b'\')'): - self.data = b''.join([ struct.pack('