修复多开微信无法获取key的bug

This commit is contained in:
xaoyaoo 2023-12-14 16:31:04 +08:00
parent 04dd574c0d
commit e59130b67b
3 changed files with 26 additions and 9 deletions

View File

@ -20,7 +20,7 @@
- ### 三、每台电脑上微信账户的key是不是永远不会变
1. 同一设备同一微信不删除数据情况下key密钥相同
1. 同一设备,同一微信不删除数据情况下key密钥相同
- ### 四、刚打开就闪退的问题

11
pywxdump/api/__init__.py Normal file
View File

@ -0,0 +1,11 @@
# -*- coding: utf-8 -*-#
# -------------------------------------------------------------------------------
# Name: __init__.py
# Description:
# Author: xaoyaoo
# Date: 2023/12/14
# -------------------------------------------------------------------------------
if __name__ == '__main__':
pass

View File

@ -157,7 +157,7 @@ def get_info_filePath(wxid="all"):
return filePath if os.path.exists(filePath) else "None"
def get_key(db_path, addr_len):
def get_key(pid, db_path, addr_len):
def read_key_bytes(h_process, address, address_len=8):
array = ctypes.create_string_buffer(address_len)
if ReadProcessMemory(h_process, void_p(address), array, address_len, 0) == 0: return "None"
@ -190,7 +190,7 @@ def get_key(db_path, addr_len):
phone_type2 = "android\x00"
phone_type3 = "ipad\x00"
pm = pymem.Pymem("WeChat.exe")
pm = pymem.Pymem(pid)
module_name = "WeChatWin.dll"
MicroMsg_path = os.path.join(db_path, "MSG", "MicroMsg.db")
@ -198,11 +198,17 @@ def get_key(db_path, addr_len):
type1_addrs = pm.pattern_scan_module(phone_type1.encode(), module_name, return_multiple=True)
type2_addrs = pm.pattern_scan_module(phone_type2.encode(), module_name, return_multiple=True)
type3_addrs = pm.pattern_scan_module(phone_type3.encode(), module_name, return_multiple=True)
type_addrs = type1_addrs if len(type1_addrs) >= 2 else type2_addrs if len(type2_addrs) >= 2 else type3_addrs if len(
type3_addrs) >= 2 else "None"
# print(type_addrs)
if type_addrs == "None":
return "None"
# print(type1_addrs, type2_addrs, type3_addrs)
type_addrs = []
if len(type1_addrs) >= 2: type_addrs += type1_addrs
if len(type2_addrs) >= 2: type_addrs += type2_addrs
if len(type3_addrs) >= 2: type_addrs += type3_addrs
if len(type_addrs) == 0: return "None"
type_addrs.sort() # 从小到大排序
for i in type_addrs[::-1]:
for j in range(i, i - 2000, -addr_len):
key_bytes = read_key_bytes(pm.process_handle, j, addr_len)
@ -269,7 +275,7 @@ def read_info(version_list, is_logging=False):
tmp_rd['wxid'] = get_info_wxid(Handle)
tmp_rd['filePath'] = get_info_filePath(tmp_rd['wxid']) if tmp_rd['wxid'] != "None" else "None"
tmp_rd['key'] = get_key(tmp_rd['filePath'], addrLen) if tmp_rd['filePath'] != "None" else "None"
tmp_rd['key'] = get_key(tmp_rd['pid'], tmp_rd['filePath'], addrLen) if tmp_rd['filePath'] != "None" else "None"
result.append(tmp_rd)
if is_logging: