diff --git a/README.md b/README.md index ae2fff3..71551a5 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,7 @@
更新日志(点击展开): +* 2023.11.15 添加test文件,添加自动构建可执行文件的脚本 * 2023.11.15 [v2.2.5变化较大]重构解密脚本的返回值,重构命令行参数 * 2023.11.15 修复无法获取wxid的bug * 2023.11.14 修复部分bug @@ -116,7 +117,7 @@ PyWxDump
-# 二、使用方法 +# 二、使用说明 ## 1. 安装 @@ -216,6 +217,8 @@ wxdump all -h ### 2.2 python API +更多使用方法参考[tests](./tests)文件夹下的[test_*.py](./tests/)文件 + ```python # 单独使用各模块,返回值一般为字典,参数参考命令行 import pywxdump diff --git a/tests/test_1.py b/tests/test_Bias.py similarity index 63% rename from tests/test_1.py rename to tests/test_Bias.py index 7940e22..d586b53 100644 --- a/tests/test_1.py +++ b/tests/test_Bias.py @@ -10,6 +10,12 @@ from pywxdump import VERSION_LIST_PATH, VERSION_LIST from pywxdump.bias_addr import BiasAddr from pywxdump.wx_info import read_info -# bias = BiasAddr("12345678901", "test", "test", "test", "test").run() -wx_info = read_info(VERSION_LIST) -print(wx_info) +mobile = '13800138000' +name = '张三' +account = 'xxxxxx' +key = None # "xxxxxx" +db_path = None # "xxxxxx" +vlp = None # VERSION_LIST_PATH +# 调用 run 函数,并传入参数 +rdata = BiasAddr(account, mobile, name, key, db_path).run(True, vlp) + diff --git a/tests/test_dbshow.py b/tests/test_dbshow.py new file mode 100644 index 0000000..92e26ea --- /dev/null +++ b/tests/test_dbshow.py @@ -0,0 +1,37 @@ +# -*- coding: utf-8 -*-# +# ------------------------------------------------------------------------------- +# Name: test_dbshow.py +# Description: 显示数据库聊天记录 +# Author: xaoyaoo +# Date: 2023/11/15 +# ------------------------------------------------------------------------------- +try: + from flask import Flask, request, jsonify, render_template, g + import logging + from pywxdump.show_chat.main_window import app_show_chat, get_user_list +except Exception as e: + print(e) + print("[-] 请安装flask( pip install flask )") + assert "[-] 请安装flask( pip install flask )" + +app = Flask(__name__, template_folder='./show_chat/templates') +app.logger.setLevel(logging.ERROR) + +msg_path = r"xxxxxx" +micro_path = r"xxxxxx" +media_path = r"xxxxxx" +filestorage_path = r"xxxxxx" + +@app.before_request +def before_request(): + g.MSG_ALL_db_path = msg_path + g.MicroMsg_db_path = micro_path + g.MediaMSG_all_db_path = media_path + g.FileStorage_path = filestorage_path + g.USER_LIST = get_user_list(msg_path, micro_path) + + +app.register_blueprint(app_show_chat) + +print("[+] 请使用浏览器访问 http://127.0.0.1:5000/ 查看聊天记录") +app.run(debug=False) diff --git a/tests/test_decrypt.py b/tests/test_decrypt.py new file mode 100644 index 0000000..fe6e506 --- /dev/null +++ b/tests/test_decrypt.py @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*-# +# ------------------------------------------------------------------------------- +# Name: test_decrypt.py +# Description: +# Author: xaoyaoo +# Date: 2023/11/15 +# ------------------------------------------------------------------------------- + +from pywxdump import VERSION_LIST_PATH, VERSION_LIST +from pywxdump import batch_decrypt + +key = "xxxxxx" # 解密密钥 +db_path = "xxxxxx" # 数据库路径(文件or文件list) +out_path = "xxxxxx" # 输出路径(目录) + +result = batch_decrypt(key, db_path, out_path, True) diff --git a/tests/test_2.py b/tests/test_read_info.py similarity index 62% rename from tests/test_2.py rename to tests/test_read_info.py index 0e819a0..7162e0e 100644 --- a/tests/test_2.py +++ b/tests/test_read_info.py @@ -5,6 +5,9 @@ # Author: xaoyaoo # Date: 2023/10/21 # ------------------------------------------------------------------------------- -from pywxdump import get_wechat_db -user_dirs = get_wechat_db(require_list=["MediaMSG", "MicroMsg", "FTSMSG", "MSG", "Sns", "Emotion"]) -print(user_dirs) \ No newline at end of file + +from pywxdump.wx_info import read_info + +from pywxdump import VERSION_LIST_PATH, VERSION_LIST + +result = read_info(VERSION_LIST, is_logging=True) # 读取微信信息