From 98430b75fe1a06d42aa558a6e5dfb9594ed0971f Mon Sep 17 00:00:00 2001 From: xaoyaoo Date: Mon, 11 Dec 2023 13:26:46 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dinfo=5FfilePath?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- doc/FAQ.md | 12 +++++++++++- pywxdump/wx_info/get_wx_info.py | 24 +++++++++++++++++++----- tests/flassk_demo.py | 31 +++++++++++++++++++++++++++++++ 3 files changed, 61 insertions(+), 6 deletions(-) create mode 100644 tests/flassk_demo.py diff --git a/doc/FAQ.md b/doc/FAQ.md index 7425eae3..e93646a9 100644 --- a/doc/FAQ.md +++ b/doc/FAQ.md @@ -78,4 +78,14 @@ - ### 十一、参数无效 1. 请检查参数是否正确,如果正确,请检查是否使用了中文输入法,如果使用了中文输入法,请切换为英文输入法 -2. 检查路径是否正确,如果路径中有空格,请使用英文双引号包裹路径 \ No newline at end of file +2. 检查路径是否正确,如果路径中有空格,请使用英文双引号包裹路径 + +- ### 十二、如何获取微信数据库路径/数据库目录是什么/数据库在哪 + +1. 打开微信电脑版,登录微信 +2. 打开微信 +3. 打开设置 +4. 选择文件管理 +5. 点打开文件夹 +6. 进入MSG文件夹 +7. 就是这个文件夹就是微信数据库目录 \ No newline at end of file diff --git a/pywxdump/wx_info/get_wx_info.py b/pywxdump/wx_info/get_wx_info.py index 8bcbe216..ede7dd7f 100644 --- a/pywxdump/wx_info/get_wx_info.py +++ b/pywxdump/wx_info/get_wx_info.py @@ -107,15 +107,29 @@ def get_info_wxid(h_process): def get_info_filePath(wxid="all"): if not wxid: return "None" + w_dir = "MyDocument:" + is_w_dir = False + try: - user_profile = os.environ.get("USERPROFILE") - path_3ebffe94 = os.path.join(user_profile, "AppData", "Roaming", "Tencent", "WeChat", "All Users", "config", - "3ebffe94.ini") - with open(path_3ebffe94, "r", encoding="utf-8") as f: - w_dir = f.read() + key = winreg.OpenKey(winreg.HKEY_CURRENT_USER, r"Software\Tencent\WeChat", 0, winreg.KEY_READ) + value, _ = winreg.QueryValueEx(key, "FileSavePath") + winreg.CloseKey(key) + w_dir = value + is_w_dir = True except Exception as e: w_dir = "MyDocument:" + if not is_w_dir: + try: + user_profile = os.environ.get("USERPROFILE") + path_3ebffe94 = os.path.join(user_profile, "AppData", "Roaming", "Tencent", "WeChat", "All Users", "config", + "3ebffe94.ini") + with open(path_3ebffe94, "r", encoding="utf-8") as f: + w_dir = f.read() + is_w_dir = True + except Exception as e: + w_dir = "MyDocument:" + if w_dir == "MyDocument:": try: # 打开注册表路径 diff --git a/tests/flassk_demo.py b/tests/flassk_demo.py new file mode 100644 index 00000000..d85a0418 --- /dev/null +++ b/tests/flassk_demo.py @@ -0,0 +1,31 @@ +# -*- coding: utf-8 -*-# +# ------------------------------------------------------------------------------- +# Name: flassk_demo.py +# Description: +# Author: xaoyaoo +# Date: 2023/12/11 +# ------------------------------------------------------------------------------- +from flask import Flask, jsonify + +app = Flask(__name__) + + +@app.route('/api/demo', methods=["get",'POST']) +def demo(): + # 模拟不同的API情况 + # 0: 请求成功 + r_data = { + 'code': 0, + 'body': { + 'message': 'Success!', + 'data': { + 'key': 'value' + } + }, + 'msg': 'success', + 'extra': {} + } + return jsonify(r_data) + +if __name__ == '__main__': + app.run(debug=True)