ppwwyyxx / wechat-dump

Cracking encrypted wechat message history from android
GNU General Public License v3.0
1.66k stars 307 forks source link

能不使用adb直接本地解码EnMicroMsg.db吗 #67

Closed Huelse closed 4 years ago

Huelse commented 4 years ago

我已经将EnMicroMsg.db文件imei和uin全获取到,能否直接在电脑上解码?不链接手机用adb 直接运行时显示如下结果:

[20:18:01 31@procutil.py:wechat.common.procutil] Command 'adb root' failed, return code=1
Traceback (most recent call last):
  File "D:\HG\Downloads\SD\wechat-dump-master\wechat\common\procutil.py", line 21, in subproc_call
    shell=True, timeout=timeout)
  File "D:\Projects\Lib\Python\Python36\lib\subprocess.py", line 356, in check_output
    **kwargs).stdout
  File "D:\Projects\Lib\Python\Python36\lib\subprocess.py", line 438, in run
    output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command 'adb root' returned non-zero exit status 1.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "decrypt-db.py", line 153, in <module>
    subproc_succ("adb root")
  File "D:\HG\Downloads\SD\wechat-dump-master\wechat\common\procutil.py", line 43, in subproc_succ
    output, ret = subproc_call(cmd)
  File "D:\HG\Downloads\SD\wechat-dump-master\wechat\common\procutil.py", line 32, in subproc_call
    logger.warn(e.output.decode('utf-8'))
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb2 in position 6: invalid start byte
Huelse commented 4 years ago

我修改了下代码,发现uin编码有问题

Traceback (most recent call last):
  File "decrypt-db.py", line 184, in <module>
    key = get_key(imei, uin)
  File "decrypt-db.py", line 123, in get_key
    a = md5(imei + uin)
TypeError: must be str, not bytes
Huelse commented 4 years ago

问题解决,167行改key = get_key(str(imei).encode('ascii'), uin)

ppwwyyxx commented 4 years ago

./decrypt-db.py decrypt --uin xxx --imei xxx --input xxx.db works after https://github.com/ppwwyyxx/wechat-dump/commit/9b64982af0c2cfe849fe789de838dcc0395ee21a