From 0472291ce398a130e507dcc99958ac8080cde4ce Mon Sep 17 00:00:00 2001 From: xaoyaoo Date: Mon, 3 Jun 2024 18:14:13 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=AE=B9=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pywxdump/wx_info/get_wx_info.py | 69 ++++++++++++++++++--------------- 1 file changed, 38 insertions(+), 31 deletions(-) diff --git a/pywxdump/wx_info/get_wx_info.py b/pywxdump/wx_info/get_wx_info.py index 6cd24bd..76ed67a 100644 --- a/pywxdump/wx_info/get_wx_info.py +++ b/pywxdump/wx_info/get_wx_info.py @@ -193,37 +193,11 @@ def get_key(pid, db_path, addr_len): return "None" -# 读取微信信息(account,mobile,name,mail,wxid,key) -def read_info(version_list: dict = None, is_logging: bool = False, save_path: str = None): - """ - 读取微信信息(account,mobile,name,mail,wxid,key) - :param version_list: 版本偏移量 - :param is_logging: 是否打印日志 - :param save_path: 保存路径 - :return: 返回微信信息 [{"pid": pid, "version": version, "account": account, - "mobile": mobile, "name": name, "mail": mail, "wxid": wxid, - "key": key, "filePath": filePath}, ...] - """ - if version_list is None: - version_list = {} - - wechat_process = [] - result = [] - error = "" - for process in psutil.process_iter(['name', 'exe', 'pid', 'cmdline']): - if process.name() == 'WeChat.exe': - wechat_process.append(process) - - if len(wechat_process) <= 0: - error = "[-] WeChat No Run" - if is_logging: print(error) - return error - - for process in wechat_process: - rd = {'pid': process.pid, 'version': get_exe_version(process.exe()), - "account": "None", "mobile": "None", "name": "None", "mail": "None", - "wxid": "None", "key": "None", "filePath": "None"} - +def get_details(process, version_list: dict = None, is_logging: bool = False): + rd = {'pid': process.pid, 'version': get_exe_version(process.exe()), + "account": "None", "mobile": "None", "name": "None", "mail": "None", + "wxid": "None", "key": "None", "filePath": "None"} + try: Handle = ctypes.windll.kernel32.OpenProcess(0x1F0FFF, False, process.pid) bias_list = version_list.get(rd['version'], None) @@ -266,7 +240,40 @@ def read_info(version_list: dict = None, is_logging: bool = False, save_path: st 'filePath'] != "None" else False if rd['filePath'] != "None" and rd['key'] == "None" and not isKey: rd['key'] = get_key(rd['pid'], rd['filePath'], addrLen) + except Exception as e: + error = f"[-] WeChat Get Info Error:{e}" + if is_logging: print(error) + return rd + +# 读取微信信息(account,mobile,name,mail,wxid,key) +def read_info(version_list: dict = None, is_logging: bool = False, save_path: str = None): + """ + 读取微信信息(account,mobile,name,mail,wxid,key) + :param version_list: 版本偏移量 + :param is_logging: 是否打印日志 + :param save_path: 保存路径 + :return: 返回微信信息 [{"pid": pid, "version": version, "account": account, + "mobile": mobile, "name": name, "mail": mail, "wxid": wxid, + "key": key, "filePath": filePath}, ...] + """ + if version_list is None: + version_list = {} + + wechat_process = [] + result = [] + error = "" + for process in psutil.process_iter(['name', 'exe', 'pid', 'cmdline']): + if process.name() == 'WeChat.exe': + wechat_process.append(process) + + if len(wechat_process) <= 0: + error = "[-] WeChat No Run" + if is_logging: print(error) + return error + + for process in wechat_process: + rd = get_details(process, version_list, is_logging) result.append(rd) if is_logging: