fix cli
This commit is contained in:
parent
a27f95ff78
commit
5e34b5870f
@ -155,7 +155,7 @@ class MainWxDbPath(BaseSubMainClass):
|
|||||||
# 添加 'wx_db_path' 子命令解析器
|
# 添加 'wx_db_path' 子命令解析器
|
||||||
parser.add_argument("-r", "--db_types", type=str,
|
parser.add_argument("-r", "--db_types", type=str,
|
||||||
help="(可选)需要的数据库名称(eg: -r MediaMSG;MicroMsg;FTSMSG;MSG;Sns;Emotion )",
|
help="(可选)需要的数据库名称(eg: -r MediaMSG;MicroMsg;FTSMSG;MSG;Sns;Emotion )",
|
||||||
default="all", metavar="")
|
default=None, metavar="")
|
||||||
parser.add_argument("-wf", "--wx_files", type=str, help="(可选)'WeChat Files'路径", default=None,
|
parser.add_argument("-wf", "--wx_files", type=str, help="(可选)'WeChat Files'路径", default=None,
|
||||||
metavar="")
|
metavar="")
|
||||||
parser.add_argument("-id", "--wxid", type=str, help="(可选)wxid_,用于确认用户文件夹",
|
parser.add_argument("-id", "--wxid", type=str, help="(可选)wxid_,用于确认用户文件夹",
|
||||||
@ -163,11 +163,11 @@ class MainWxDbPath(BaseSubMainClass):
|
|||||||
return parser
|
return parser
|
||||||
|
|
||||||
def run(self, args):
|
def run(self, args):
|
||||||
|
print(f"[*] PyWxDump v{pywxdump.__version__}")
|
||||||
# 从命令行参数获取值
|
# 从命令行参数获取值
|
||||||
db_types = args.require_list
|
db_types = args.db_types
|
||||||
msg_dir = args.wx_files
|
msg_dir = args.wx_files
|
||||||
wxid = args.wxid
|
wxid = args.wxid
|
||||||
|
|
||||||
ret = get_wx_db(msg_dir=msg_dir, db_types=db_types, wxids=wxid)
|
ret = get_wx_db(msg_dir=msg_dir, db_types=db_types, wxids=wxid)
|
||||||
for i in ret: print(i)
|
for i in ret: print(i)
|
||||||
return ret
|
return ret
|
||||||
@ -243,7 +243,7 @@ class MainMerge(BaseSubMainClass):
|
|||||||
print(f"[+] 创建输出文件夹:{out_path}")
|
print(f"[+] 创建输出文件夹:{out_path}")
|
||||||
|
|
||||||
print(f"[*] 合并中...(用时较久,耐心等待)")
|
print(f"[*] 合并中...(用时较久,耐心等待)")
|
||||||
|
dbpaths = [{"db_path": i} for i in dbpaths if os.path.exists(i)] # 去除不存在的路径
|
||||||
result = merge_db(dbpaths, out_path)
|
result = merge_db(dbpaths, out_path)
|
||||||
|
|
||||||
print(f"[+] 合并完成:{result}")
|
print(f"[+] 合并完成:{result}")
|
||||||
|
@ -45,6 +45,7 @@ def start_falsk(merge_path="", wx_path="", key="", my_wxid="", port=5000, online
|
|||||||
print(f"[+] 创建临时文件夹:{work_path}")
|
print(f"[+] 创建临时文件夹:{work_path}")
|
||||||
|
|
||||||
conf_auto_file = os.path.join(work_path, "conf_auto.json") # 用于存放各种基础信息
|
conf_auto_file = os.path.join(work_path, "conf_auto.json") # 用于存放各种基础信息
|
||||||
|
at = "auto_setting"
|
||||||
|
|
||||||
from flask import Flask, g
|
from flask import Flask, g
|
||||||
from flask_cors import CORS
|
from flask_cors import CORS
|
||||||
@ -85,14 +86,21 @@ def start_falsk(merge_path="", wx_path="", key="", my_wxid="", port=5000, online
|
|||||||
def before_request():
|
def before_request():
|
||||||
g.work_path = work_path # 临时文件夹,用于存放图片等-新版本
|
g.work_path = work_path # 临时文件夹,用于存放图片等-新版本
|
||||||
g.caf = conf_auto_file # 用于存放各种基础信息-新版本
|
g.caf = conf_auto_file # 用于存放各种基础信息-新版本
|
||||||
g.at = "auto_setting" # 用于默认设置-新版本
|
g.at = at # 用于默认设置-新版本
|
||||||
|
|
||||||
if merge_path: set_conf(conf_auto_file, g.at, "merge_path", merge_path)
|
if merge_path:
|
||||||
if wx_path: set_conf(conf_auto_file, g.at, "wx_path", wx_path)
|
set_conf(conf_auto_file, at, "merge_path", merge_path)
|
||||||
if key: set_conf(conf_auto_file, g.at, "key", key)
|
db_config = {
|
||||||
if my_wxid: set_conf(conf_auto_file, g.at, "my_wxid", my_wxid)
|
"key": "merge_all",
|
||||||
|
"type": "sqlite",
|
||||||
|
"path": "D:\\_code\\py_code\\pywxdumpProject\\z_test\\wxdump_work\\wxid_zh12s67kxsqs22\\merge_all.db"
|
||||||
|
}
|
||||||
|
set_conf(conf_auto_file, at, "db_config", db_config)
|
||||||
|
if wx_path: set_conf(conf_auto_file, at, "wx_path", wx_path)
|
||||||
|
if key: set_conf(conf_auto_file, at, "key", key)
|
||||||
|
if my_wxid: set_conf(conf_auto_file, at, "my_wxid", my_wxid)
|
||||||
if not os.path.exists(conf_auto_file):
|
if not os.path.exists(conf_auto_file):
|
||||||
set_conf(conf_auto_file, g.at, "last", my_wxid)
|
set_conf(conf_auto_file, at, "last", my_wxid)
|
||||||
|
|
||||||
app.register_blueprint(rs_api)
|
app.register_blueprint(rs_api)
|
||||||
app.register_blueprint(ls_api)
|
app.register_blueprint(ls_api)
|
||||||
|
@ -384,12 +384,12 @@ def get_wx_db(msg_dir: str = None,
|
|||||||
wxids = wxids.split(";") if isinstance(wxids, str) else wxids
|
wxids = wxids.split(";") if isinstance(wxids, str) else wxids
|
||||||
if not isinstance(wxids, list) or len(wxids) <= 0:
|
if not isinstance(wxids, list) or len(wxids) <= 0:
|
||||||
wxids = None
|
wxids = None
|
||||||
db_types = db_types.split(";") if isinstance(db_types, str) else db_types
|
db_types = db_types.split(";") if isinstance(db_types, str) and db_types else db_types
|
||||||
if not isinstance(db_types, list) or len(db_types) <= 0:
|
if not isinstance(db_types, list) or len(db_types) <= 0:
|
||||||
db_types = None
|
db_types = None
|
||||||
|
|
||||||
wxid_dirs = {} # wx用户目录
|
wxid_dirs = {} # wx用户目录
|
||||||
if "All Users"in os.listdir(msg_dir) or "Applet"in os.listdir(msg_dir) or "WMPF"in os.listdir(msg_dir):
|
if "All Users" in os.listdir(msg_dir) or "Applet" in os.listdir(msg_dir) or "WMPF" in os.listdir(msg_dir):
|
||||||
for sub_dir in os.listdir(msg_dir):
|
for sub_dir in os.listdir(msg_dir):
|
||||||
if os.path.isdir(os.path.join(msg_dir, sub_dir)) and sub_dir not in ["All Users", "Applet", "WMPF"]:
|
if os.path.isdir(os.path.join(msg_dir, sub_dir)) and sub_dir not in ["All Users", "Applet", "WMPF"]:
|
||||||
wxid_dirs[os.path.basename(sub_dir)] = os.path.join(msg_dir, sub_dir)
|
wxid_dirs[os.path.basename(sub_dir)] = os.path.join(msg_dir, sub_dir)
|
||||||
|
Loading…
Reference in New Issue
Block a user