diff --git a/pywxdump/api/api.py b/pywxdump/api/api.py index 9ef6d67..c50928b 100644 --- a/pywxdump/api/api.py +++ b/pywxdump/api/api.py @@ -11,7 +11,7 @@ import os import time import shutil -from flask import Flask, request, render_template, g, Blueprint, send_file, make_response, session,send_file +from flask import Flask, request, render_template, g, Blueprint, send_file, make_response, session from pywxdump import analyzer, read_img_dat, read_audio, get_wechat_db, get_core_db from pywxdump.api.rjson import ReJson, RqJson from pywxdump.api.utils import read_session, save_session, error9999 @@ -125,7 +125,7 @@ def contact_list(): limit = request.json.get("limit") contact_list = analyzer.get_contact_list(micro_path) - save_session(g.sf, "user_list", contact_list) + # save_session(g.sf, "user_list", contact_list) if limit: contact_list = contact_list[int(start):int(start) + int(limit)] return ReJson(0, contact_list) @@ -178,7 +178,7 @@ def contact_count_list(): # 降序 contact_list = sorted(contact_list, key=lambda x: x["chat_count"], reverse=True) - save_session(g.sf, "user_list", contact_list) + # save_session(g.sf, "user_list", contact_list) if word and word != "" and word != "undefined" and word != "null": contact_list = [contact for contact in contact_list if @@ -248,11 +248,12 @@ def get_img(): return ReJson(0, out_bytes) else: return ReJson(1001, body=img_path_all) - + + @api.route('/api/video/', methods=["GET", 'POST']) def get_video(videoPath): wx_path = read_session(g.sf, "wx_path") - all_video_path = os.path.join(wx_path, videoPath) + all_video_path = os.path.join(wx_path, videoPath) if not os.path.exists(all_video_path): return ReJson(5002) return send_file(all_video_path) diff --git a/pywxdump/server.py b/pywxdump/server.py index 08bf6e1..c4ce292 100644 --- a/pywxdump/server.py +++ b/pywxdump/server.py @@ -32,7 +32,7 @@ def start_falsk(merge_path="", msg_path="", micro_path="", media_path="", wx_pat os.makedirs(tmp_path) print(f"[+] 创建临时文件夹:{tmp_path}") - session_file = os.path.join(tmp_path, "session") # 用于存放各种基础信息 + session_file = os.path.join(tmp_path, "session.conf") # 用于存放各种基础信息 from flask import Flask, g from flask_cors import CORS diff --git a/pywxdump/wx_info/get_wx_info.py b/pywxdump/wx_info/get_wx_info.py index 99c67bb..c7e7c96 100644 --- a/pywxdump/wx_info/get_wx_info.py +++ b/pywxdump/wx_info/get_wx_info.py @@ -43,6 +43,21 @@ def get_info_wxid(h_process): return wxid +def get_info_filePath_base_wxid(h_process, wxid=""): + find_num = 10 + addrs = pattern_scan_all(h_process, wxid.encode() + br'\\Msg\\FTSContact', return_multiple=True, find_num=find_num) + filePath = [] + for addr in addrs: + win_addr_len = 260 + array = ctypes.create_string_buffer(win_addr_len) + if ReadProcessMemory(h_process, void_p(addr - win_addr_len + 50), array, win_addr_len, 0) == 0: return "None" + array = bytes(array).split(b"\\Msg")[0] + array = array.split(b"\00")[-1] + filePath.append(array.decode('utf-8', errors='ignore')) + filePath = max(filePath, key=filePath.count) if filePath else "None" + return filePath + + def get_info_filePath(wxid="all"): if not wxid: return "None" @@ -197,7 +212,9 @@ def read_info(version_list: dict = None, is_logging: bool = False, save_path: st addrLen = get_exe_bit(process.exe()) // 8 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['filePath'] = get_info_filePath_base_wxid(Handle, tmp_rd['wxid']) if tmp_rd['wxid'] != "None" else "None" + tmp_rd['filePath'] = get_info_filePath(tmp_rd['wxid']) if tmp_rd['wxid'] != "None" and tmp_rd[ + 'filePath'] == "None" else tmp_rd['filePath'] tmp_rd['key'] = get_key(tmp_rd['pid'], tmp_rd['filePath'], addrLen) if tmp_rd['filePath'] != "None" else "None" result.append(tmp_rd)