将整个项目作为包安装,增加命令行统一操作
This commit is contained in:
parent
1d2c002615
commit
e49bdb683e
56
README.md
56
README.md
@ -5,7 +5,7 @@
|
||||
[](https://github.com/xaoyaoo/PyWxDump)
|
||||
|
||||
#### 更新日志(发现[version_list.json](app/version_list.json)缺失或错误,请提交[issues](https://github.com/xaoyaoo/PyWxDump/issues)):
|
||||
|
||||
* 2023.10.15 将整个项目作为包安装,增加命令行统一操作
|
||||
* 2023.10.14 整体重构项目,优化代码,增加命令行统一操作
|
||||
* 2023.10.11 添加"3.9.5.81"版本的偏移地址[#10](https://github.com/xaoyaoo/PyWxDump/issues/10)
|
||||
,感谢@[sv3nbeast](https://github.com/sv3nbeast)
|
||||
@ -44,21 +44,30 @@ PyWxDump
|
||||
│ ├─ wx_info # 获取微信基本信息
|
||||
│ │ ├─ get_wx_info.py # 获取微信基本信息脚本
|
||||
│ │ └─ get_wx_db.py # 获取本地所有的微信相关数据库
|
||||
│ ├─ command.py # 命令行入口
|
||||
│ └─ version_list.json # 微信版本列表
|
||||
├─ doc # 项目文档
|
||||
│ ├─ wx数据库简述.md # wx数据库简述
|
||||
│ └─ CE获取基址.md # CE获取基址
|
||||
├─ main.py # 命令行入口
|
||||
├─ README.md
|
||||
├─ setup.py # 安装脚本
|
||||
└─ requirements.txt
|
||||
|
||||
```
|
||||
|
||||
# 二、使用方法
|
||||
|
||||
## 1. 安装依赖
|
||||
## 1. 安装
|
||||
|
||||
```shell script
|
||||
pip install -r requirements.txt
|
||||
cd PyWxDump
|
||||
python -m pip install -U .
|
||||
```
|
||||
|
||||
或者
|
||||
|
||||
```shell script
|
||||
pip install git+git://github.com/xaoyaoo/PyWxDump.git
|
||||
```
|
||||
|
||||
**说明**:
|
||||
@ -71,8 +80,10 @@ pip install -r requirements.txt
|
||||
|
||||
### 2.1 命令行
|
||||
|
||||
激活虚拟环境后(如果有的话),在项目根目录下运行:
|
||||
|
||||
```shell script
|
||||
python -m app.command 模式 [参数]
|
||||
wxdump 模式 [参数]
|
||||
# 运行模式(mode):
|
||||
# bias_addr 获取微信基址偏移
|
||||
# wx_info 获取微信信息
|
||||
@ -87,7 +98,7 @@ python -m app.command 模式 [参数]
|
||||
以下是示例命令:
|
||||
|
||||
```shell script
|
||||
python -m app.command bias_addr -h
|
||||
wxdump bias_addr -h
|
||||
#usage: main.py bias_addr [-h] --mobile MOBILE --name NAME --account ACCOUNT [--key KEY] [--db_path DB_PATH] [-vlp VLP]
|
||||
#options:
|
||||
# -h, --help show this help message and exit
|
||||
@ -98,13 +109,13 @@ python -m app.command bias_addr -h
|
||||
# --db_path DB_PATH (与key二选一)已登录账号的微信文件夹路径
|
||||
# -vlp VLP (可选)微信版本偏移文件路径
|
||||
|
||||
python -m app.command wx_info -h
|
||||
wxdump wx_info -h
|
||||
#usage: main.py wx_info [-h] [-vlp VLP]
|
||||
#options:
|
||||
# -h, --help show this help message and exit
|
||||
# -vlp VLP (可选)微信版本偏移文件路径
|
||||
|
||||
python -m app.command wx_db -h
|
||||
wxdump wx_db -h
|
||||
#usage: main.py wx_db [-h] [-r REQUIRE_LIST] [-wf WF]
|
||||
#options:
|
||||
# -h, --help show this help message and exit
|
||||
@ -112,7 +123,7 @@ python -m app.command wx_db -h
|
||||
# (可选)需要的数据库名称(eg: -r MediaMSG;MicroMsg;FTSMSG;MSG;Sns;Emotion )
|
||||
# -wf WF (可选)'WeChat Files'路径
|
||||
|
||||
python -m app.command decrypt -h
|
||||
wxdump decrypt -h
|
||||
#usage: main.py decrypt [-h] -k KEY -i DB_PATH -o OUT_PATH
|
||||
#options:
|
||||
# -h, --help show this help message and exit
|
||||
@ -122,13 +133,13 @@ python -m app.command decrypt -h
|
||||
# -o OUT_PATH, --out_path OUT_PATH
|
||||
# 输出路径(必须是目录),输出文件为 out_path/de_{original_name}
|
||||
|
||||
python -m app.command analyse -h
|
||||
wxdump analyse -h
|
||||
#usage: main.py analyse [-h] [--arg ARG]
|
||||
#options:
|
||||
# -h, --help show this help message and exit
|
||||
# --arg ARG 参数
|
||||
|
||||
python -m app.command all -h
|
||||
wxdump all -h
|
||||
#usage: main.py all [-h]
|
||||
#options:
|
||||
# -h, --help show this help message and exit
|
||||
@ -137,8 +148,29 @@ python -m app.command all -h
|
||||
### 2.2 python API
|
||||
|
||||
```python
|
||||
from app import *
|
||||
# 单独使用各模块,返回值一般为字典,参数参考命令行
|
||||
import pywxdump
|
||||
from pywxdump import VERSION_LIST_PATH, VERSION_LIST
|
||||
|
||||
# 1. 获取基址偏移
|
||||
from pywxdump.bias_addr import BiasAddr
|
||||
bias_addr = BiasAddr(VERSION_LIST_PATH, VERSION_LIST).run()
|
||||
|
||||
# 2. 获取微信信息
|
||||
from pywxdump.wx_info import read_info
|
||||
wx_info = read_info(VERSION_LIST)
|
||||
|
||||
# 3. 获取微信文件夹路径
|
||||
from pywxdump.wx_info import get_wechat_db
|
||||
wx_db = get_wechat_db()
|
||||
|
||||
# 4. 解密数据库
|
||||
from pywxdump.decrypted import batch_decrypt
|
||||
batch_decrypt("key", "db_path", "out_path")
|
||||
|
||||
# 5. 解析数据库
|
||||
from pywxdump.analyse import read_img_dat, read_emoji, decompress_CompressContent, read_audio_buf, read_audio
|
||||
pass
|
||||
```
|
||||
|
||||
【注】:
|
||||
|
@ -11,20 +11,8 @@ from .wx_info.get_wx_db import get_wechat_db
|
||||
from .decrypted.decrypt import batch_decrypt, decrypt
|
||||
from .decrypted.get_wx_decrypted_db import all_decrypt, merge_copy_msg_db, merge_msg_db, merge_media_msg_db
|
||||
from .analyse.parse import read_img_dat, read_emoji, decompress_CompressContent, read_audio_buf, read_audio
|
||||
import os,json
|
||||
|
||||
__all__ = [
|
||||
"BiasAddr",
|
||||
"read_info",
|
||||
"get_wechat_db",
|
||||
"batch_decrypt",
|
||||
"decrypt",
|
||||
"merge_copy_msg_db",
|
||||
"merge_msg_db",
|
||||
"merge_media_msg_db",
|
||||
"read_img_dat",
|
||||
"read_emoji",
|
||||
|
||||
"decompress_CompressContent",
|
||||
"read_audio_buf",
|
||||
"read_audio",
|
||||
]
|
||||
VERSION_LIST_PATH = os.path.join(os.path.dirname(__file__), "version_list.json")
|
||||
with open(VERSION_LIST_PATH, "r", encoding="utf-8") as f:
|
||||
VERSION_LIST = json.load(f)
|
@ -1,8 +1,8 @@
|
||||
# -*- coding: utf-8 -*-#
|
||||
# -------------------------------------------------------------------------------
|
||||
# Name: __init__.py.py
|
||||
# Description:
|
||||
# Description:
|
||||
# Author: xaoyaoo
|
||||
# Date: 2023/10/14
|
||||
# -------------------------------------------------------------------------------
|
||||
from .get_bias_addr import BiasAddr
|
||||
from .get_bias_addr import BiasAddr
|
@ -11,6 +11,8 @@ import os
|
||||
|
||||
from . import *
|
||||
|
||||
# version_list_path = os.path.join(os.path.dirname(__file__), "version_list.json")
|
||||
|
||||
|
||||
class MainBiasAddr():
|
||||
def init_parses(self, parser):
|
||||
@ -21,8 +23,8 @@ class MainBiasAddr():
|
||||
sb_bias_addr.add_argument("--account", type=str, help="微信账号", required=True)
|
||||
sb_bias_addr.add_argument("--key", type=str, help="(与db_path二选一)密钥")
|
||||
sb_bias_addr.add_argument("--db_path", type=str, help="(与key二选一)已登录账号的微信文件夹路径")
|
||||
sb_bias_addr.add_argument("-vlp", type=str, help="(可选)微信版本偏移文件路径",
|
||||
default="./app/version_list.json")
|
||||
sb_bias_addr.add_argument("-vlp", type=str, help="(可选)微信版本偏移文件路径,如有,则自动更新",
|
||||
default=None)
|
||||
self.sb_bias_addr = sb_bias_addr
|
||||
return sb_bias_addr
|
||||
|
||||
@ -37,15 +39,16 @@ class MainBiasAddr():
|
||||
account = args.account
|
||||
key = args.key
|
||||
db_path = args.db_path
|
||||
version_list_path = args.vlp
|
||||
vlp = args.vlp
|
||||
# 调用 run 函数,并传入参数
|
||||
rdata = BiasAddr(account, mobile, name, key, db_path).run()
|
||||
print(rdata)
|
||||
|
||||
# 添加到version_list.json
|
||||
version_list = json.load(open(version_list_path, "r", encoding="utf-8"))
|
||||
version_list.update(rdata)
|
||||
json.dump(version_list, open(version_list_path, "w", encoding="utf-8"), ensure_ascii=False, indent=4)
|
||||
if vlp is not None:
|
||||
# 添加到version_list.json
|
||||
version_list = json.load(open(vlp, "r", encoding="utf-8"))
|
||||
version_list.update(rdata)
|
||||
json.dump(version_list, open(vlp, "w", encoding="utf-8"), ensure_ascii=False, indent=4)
|
||||
|
||||
return rdata
|
||||
|
||||
@ -54,13 +57,13 @@ class MainWxInfo():
|
||||
def init_parses(self, parser):
|
||||
# 添加 'wx_info' 子命令解析器
|
||||
sb_wx_info = parser.add_parser("wx_info", help="获取微信信息")
|
||||
sb_wx_info.add_argument("-vlp", type=str, help="(可选)微信版本偏移文件路径", default="./app/version_list.json")
|
||||
sb_wx_info.add_argument("-vlp", type=str, help="(可选)微信版本偏移文件路径", default=VERSION_LIST_PATH)
|
||||
return sb_wx_info
|
||||
|
||||
def run(self, args):
|
||||
# 读取微信各版本偏移
|
||||
version_list_path = args.vlp
|
||||
version_list = json.load(open(version_list_path, "r", encoding="utf-8"))
|
||||
VERSION_LIST_PATH = args.vlp
|
||||
version_list = json.load(open(VERSION_LIST_PATH, "r", encoding="utf-8"))
|
||||
result = read_info(version_list) # 读取微信信息
|
||||
|
||||
print("=" * 32)
|
||||
@ -158,7 +161,7 @@ class MainAll():
|
||||
|
||||
def run(self, args):
|
||||
# 获取微信信息
|
||||
args.vlp = "./app/version_list.json"
|
||||
args.vlp = VERSION_LIST_PATH
|
||||
result_WxInfo = MainWxInfo().run(args)
|
||||
keys = [i.get('key', "") for i in result_WxInfo]
|
||||
|
@ -1,9 +1,9 @@
|
||||
# -*- coding: utf-8 -*-#
|
||||
# -------------------------------------------------------------------------------
|
||||
# Name: __init__.py.py
|
||||
# Description:
|
||||
# Description:
|
||||
# Author: xaoyaoo
|
||||
# Date: 2023/08/21
|
||||
# -------------------------------------------------------------------------------
|
||||
from .decrypt import batch_decrypt, decrypt
|
||||
from .get_wx_decrypted_db import all_decrypt, merge_copy_msg_db, merge_msg_db, merge_media_msg_db
|
||||
from .decrypt import batch_decrypt
|
||||
from .get_wx_decrypted_db import all_decrypt, merge_copy_msg_db, merge_msg_db, merge_media_msg_db
|
15
setup.py
15
setup.py
@ -3,7 +3,7 @@ from setuptools import setup, find_packages
|
||||
with open("README.md", "r", encoding="utf-8") as fh:
|
||||
long_description = fh.read()
|
||||
|
||||
version = "2.0.1"
|
||||
version = "2.0.8"
|
||||
setup(
|
||||
name="pywxdump",
|
||||
author="xaoyaoo",
|
||||
@ -15,9 +15,16 @@ setup(
|
||||
url="https://github.com/xaoyaoo/PyWxDump",
|
||||
license='MIT',
|
||||
|
||||
packages=find_packages(),
|
||||
packages=['pywxdump', 'pywxdump.bias_addr', 'pywxdump.wx_info', 'pywxdump.decrypted', 'pywxdump.analyse'],
|
||||
package_dir={'pywxdump': 'pywxdump',
|
||||
'pywxdump.bias_addr': 'pywxdump/bias_addr',
|
||||
'pywxdump.wx_info': 'pywxdump/wx_info',
|
||||
'pywxdump.decrypted': 'pywxdump/decrypted',
|
||||
'pywxdump.analyse': 'pywxdump/analyse',
|
||||
},
|
||||
|
||||
package_data={
|
||||
'app': ['version_list.json'],
|
||||
'pywxdump': ['version_list.json'],
|
||||
},
|
||||
classifiers=[
|
||||
"Programming Language :: Python :: 3",
|
||||
@ -32,7 +39,7 @@ setup(
|
||||
],
|
||||
entry_points={
|
||||
'console_scripts': [
|
||||
'wxdump = app.command:console_run',
|
||||
'wxdump = pywxdump.command:console_run',
|
||||
],
|
||||
},
|
||||
)
|
||||
|
11
tests/__init__.py
Normal file
11
tests/__init__.py
Normal file
@ -0,0 +1,11 @@
|
||||
# -*- coding: utf-8 -*-#
|
||||
# -------------------------------------------------------------------------------
|
||||
# Name: __init__.py.py
|
||||
# Description:
|
||||
# Author: xaoyaoo
|
||||
# Date: 2023/10/15
|
||||
# -------------------------------------------------------------------------------
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
pass
|
15
tests/test1.py
Normal file
15
tests/test1.py
Normal file
@ -0,0 +1,15 @@
|
||||
# -*- coding: utf-8 -*-#
|
||||
# -------------------------------------------------------------------------------
|
||||
# Name: test1.py
|
||||
# Description:
|
||||
# Author: xaoyaoo
|
||||
# Date: 2023/10/15
|
||||
# -------------------------------------------------------------------------------
|
||||
import pywxdump
|
||||
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)
|
Loading…
Reference in New Issue
Block a user