This commit is contained in:
Yuxin Wu
2020-06-27 01:49:45 -07:00
parent 23b797b1f6
commit b246807304
2 changed files with 9 additions and 7 deletions
+3 -3
View File
@@ -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 <imei> --uin <uin>
./decrypt-db.py decrypt --input EnMicroMsg.db --imei <device id> --uin <uin>
```
NOTE: you may need to try different ways to get device id and fine one that can decrypt the
+6 -4
View File
@@ -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('<L', int(x, 16)) for x in re.findall(b'([0-9a-f]{8}) ', text)])
self.data = b''.join([struct.pack('<L', int(x, 16)) for x in re.findall(b'([0-9a-f]{8}) ', text)])
self.resultcode = self.get_int(0)
else:
raise Exception('Unexpected input!')