添加test文件,添加自动构建可执行文件的脚本

This commit is contained in:
xaoyo 2023-11-15 15:25:02 +08:00
parent 342b323c12
commit 950ab10bef
5 changed files with 72 additions and 7 deletions

View File

@ -16,6 +16,7 @@
<details>
<summary><strong>更新日志(点击展开)</strong></summary>
* 2023.11.15 添加test文件添加自动构建可执行文件的脚本
* 2023.11.15 [v2.2.5变化较大]重构解密脚本的返回值,重构命令行参数
* 2023.11.15 修复无法获取wxid的bug
* 2023.11.14 修复部分bug
@ -116,7 +117,7 @@ PyWxDump
</details>
# 二、使用方法
# 二、使用说明
## 1. 安装
@ -216,6 +217,8 @@ wxdump all -h
### 2.2 python API
更多使用方法参考[tests](./tests)文件夹下的[test_*.py](./tests/)文件
```python
# 单独使用各模块,返回值一般为字典,参数参考命令行
import pywxdump

View File

@ -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)

37
tests/test_dbshow.py Normal file
View File

@ -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)

16
tests/test_decrypt.py Normal file
View File

@ -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)

View File

@ -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)
from pywxdump.wx_info import read_info
from pywxdump import VERSION_LIST_PATH, VERSION_LIST
result = read_info(VERSION_LIST, is_logging=True) # 读取微信信息