作为包安装使用
This commit is contained in:
parent
7ac6888319
commit
5c64076f3e
14
README.md
14
README.md
@ -72,7 +72,7 @@ pip install -r requirements.txt
|
||||
### 2.1 命令行
|
||||
|
||||
```shell script
|
||||
python main.py [模式] [参数]
|
||||
python -m app.command 模式 [参数]
|
||||
# 运行模式(mode):
|
||||
# bias_addr 获取微信基址偏移
|
||||
# wx_info 获取微信信息
|
||||
@ -87,7 +87,7 @@ python main.py [模式] [参数]
|
||||
以下是示例命令:
|
||||
|
||||
```shell script
|
||||
python main.py bias_addr -h
|
||||
python -m app.command 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 +98,13 @@ python main.py bias_addr -h
|
||||
# --db_path DB_PATH (与key二选一)已登录账号的微信文件夹路径
|
||||
# -vlp VLP (可选)微信版本偏移文件路径
|
||||
|
||||
python main.py wx_info -h
|
||||
python -m app.command wx_info -h
|
||||
#usage: main.py wx_info [-h] [-vlp VLP]
|
||||
#options:
|
||||
# -h, --help show this help message and exit
|
||||
# -vlp VLP (可选)微信版本偏移文件路径
|
||||
|
||||
python main.py wx_db -h
|
||||
python -m app.command 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 +112,7 @@ python main.py wx_db -h
|
||||
# (可选)需要的数据库名称(eg: -r MediaMSG;MicroMsg;FTSMSG;MSG;Sns;Emotion )
|
||||
# -wf WF (可选)'WeChat Files'路径
|
||||
|
||||
python main.py decrypt -h
|
||||
python -m app.command 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 +122,13 @@ python main.py decrypt -h
|
||||
# -o OUT_PATH, --out_path OUT_PATH
|
||||
# 输出路径(必须是目录),输出文件为 out_path/de_{original_name}
|
||||
|
||||
python main.py analyse -h
|
||||
python -m app.command analyse -h
|
||||
#usage: main.py analyse [-h] [--arg ARG]
|
||||
#options:
|
||||
# -h, --help show this help message and exit
|
||||
# --arg ARG 参数
|
||||
|
||||
python main.py all -h
|
||||
python -m app.command all -h
|
||||
#usage: main.py all [-h]
|
||||
#options:
|
||||
# -h, --help show this help message and exit
|
||||
|
@ -5,7 +5,26 @@
|
||||
# Author: xaoyaoo
|
||||
# Date: 2023/10/14
|
||||
# -------------------------------------------------------------------------------
|
||||
from .bias_addr import *
|
||||
from .wx_info import *
|
||||
from .decrypted import *
|
||||
from .analyse import *
|
||||
from .bias_addr.get_bias_addr import BiasAddr
|
||||
from .wx_info.get_wx_info import read_info
|
||||
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
|
||||
|
||||
__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",
|
||||
]
|
||||
|
@ -9,7 +9,7 @@ import json
|
||||
import argparse
|
||||
import os
|
||||
|
||||
from app import *
|
||||
from . import *
|
||||
|
||||
|
||||
class MainBiasAddr():
|
||||
@ -23,12 +23,13 @@ class MainBiasAddr():
|
||||
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")
|
||||
self.sb_bias_addr = sb_bias_addr
|
||||
return sb_bias_addr
|
||||
|
||||
def run(self, args):
|
||||
# 判断是否至少输入一个参数
|
||||
if not args.key and not args.db_path:
|
||||
sb_bias_addr.error("必须至少指定 --key 或 --db_path 参数中的一个")
|
||||
self.sb_bias_addr.error("必须至少指定 --key 或 --db_path 参数中的一个")
|
||||
|
||||
# 从命令行参数获取值
|
||||
mobile = args.mobile
|
||||
@ -80,8 +81,9 @@ class MainWxDbPath():
|
||||
sb_wx_db_path = parser.add_parser("wx_db", help="获取微信文件夹路径")
|
||||
sb_wx_db_path.add_argument("-r", "--require_list", type=str,
|
||||
help="(可选)需要的数据库名称(eg: -r MediaMSG;MicroMsg;FTSMSG;MSG;Sns;Emotion )",
|
||||
default="all")
|
||||
sb_wx_db_path.add_argument("-wf", type=str, help="(可选)'WeChat Files'路径", default=None)
|
||||
default="all", metavar="")
|
||||
sb_wx_db_path.add_argument("-wf", "--wx_files", type=str, help="(可选)'WeChat Files'路径", default=None,
|
||||
metavar="")
|
||||
return sb_wx_db_path
|
||||
|
||||
def run(self, args):
|
||||
@ -112,10 +114,11 @@ class MainDecrypt():
|
||||
def init_parses(self, parser):
|
||||
# 添加 'decrypt' 子命令解析器
|
||||
sb_decrypt = parser.add_parser("decrypt", help="解密微信数据库")
|
||||
sb_decrypt.add_argument("-k", "--key", type=str, help="密钥", required=True)
|
||||
sb_decrypt.add_argument("-i", "--db_path", type=str, help="数据库路径(目录or文件)", required=True)
|
||||
sb_decrypt.add_argument("-k", "--key", type=str, help="密钥", required=True, metavar="")
|
||||
sb_decrypt.add_argument("-i", "--db_path", type=str, help="数据库路径(目录or文件)", required=True, metavar="")
|
||||
sb_decrypt.add_argument("-o", "--out_path", type=str,
|
||||
help="输出路径(必须是目录),输出文件为 out_path/de_{original_name}", required=True)
|
||||
help="输出路径(必须是目录),输出文件为 out_path/de_{original_name}", required=True,
|
||||
metavar="")
|
||||
return sb_decrypt
|
||||
|
||||
def run(self, args):
|
||||
@ -202,12 +205,12 @@ class MainAll():
|
||||
print("=" * 32)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
def console_run():
|
||||
# 创建命令行参数解析器
|
||||
parser = argparse.ArgumentParser(formatter_class=argparse.RawTextHelpFormatter)
|
||||
|
||||
# 添加子命令解析器
|
||||
subparsers = parser.add_subparsers(dest="mode", help="""运行模式:""")
|
||||
subparsers = parser.add_subparsers(dest="mode", help="""运行模式:""", required=True, metavar="mode")
|
||||
|
||||
# 添加 'bias_addr' 子命令解析器
|
||||
main_bias_addr = MainBiasAddr()
|
||||
@ -235,6 +238,8 @@ if __name__ == '__main__':
|
||||
|
||||
args = parser.parse_args() # 解析命令行参数
|
||||
|
||||
if not any(vars(args).values()):
|
||||
parser.print_help()
|
||||
# 根据不同的 'mode' 参数,执行不同的操作
|
||||
if args.mode == "bias_addr":
|
||||
main_bias_addr.run(args)
|
||||
@ -248,3 +253,7 @@ if __name__ == '__main__':
|
||||
main_parse_wx_db.run(args)
|
||||
elif args.mode == "all":
|
||||
main_all.run(args)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
console_run()
|
38
setup.py
Normal file
38
setup.py
Normal file
@ -0,0 +1,38 @@
|
||||
from setuptools import setup, find_packages
|
||||
|
||||
with open("README.md", "r", encoding="utf-8") as fh:
|
||||
long_description = fh.read()
|
||||
|
||||
version = "2.0.1"
|
||||
setup(
|
||||
name="pywxdump",
|
||||
author="xaoyaoo",
|
||||
version=version,
|
||||
author_email="xaoyaoo@gmail.com",
|
||||
description="微信信息获取工具",
|
||||
long_description=long_description,
|
||||
long_description_content_type="text/markdown",
|
||||
url="https://github.com/xaoyaoo/PyWxDump",
|
||||
license='MIT',
|
||||
|
||||
packages=find_packages(),
|
||||
package_data={
|
||||
'app': ['version_list.json'],
|
||||
},
|
||||
classifiers=[
|
||||
"Programming Language :: Python :: 3",
|
||||
"Operating System :: OS Independent",
|
||||
],
|
||||
python_requires='>=3.6, <4',
|
||||
install_requires=[
|
||||
"psutil",
|
||||
"pycryptodomex",
|
||||
"pywin32",
|
||||
"pymem",
|
||||
],
|
||||
entry_points={
|
||||
'console_scripts': [
|
||||
'wxdump = app.command:console_run',
|
||||
],
|
||||
},
|
||||
)
|
Loading…
Reference in New Issue
Block a user