将自动解密微信数据改为重新解密数据库,获取最新数据

This commit is contained in:
xaoyaoo 2024-02-04 15:56:38 +08:00
parent 955ced8173
commit 7e77c0016b

View File

@ -35,9 +35,11 @@ def init():
msg_path = request.json.get("msg_path", "").strip()
micro_path = request.json.get("micro_path", "").strip()
media_path = request.json.get("media_path", "").strip()
wx_path = request.json.get("wx_path", "").strip()
key = request.json.get("key", "").strip()
my_wxid = request.json.get("my_wxid", "").strip()
init_type = request.json.get("init_type", "").strip()
if init_type == "last":
@ -48,7 +50,7 @@ def init():
save_micro_path):
return ReJson(0, {"msg_path": save_msg_path, "micro_path": save_micro_path, "is_init": True})
else:
return ReJson(1002,body="上次初始化的路径不存在")
return ReJson(1002, body="上次初始化的路径不存在")
if key: # 如果key不为空表示是解密模式
if not wx_path:
@ -56,8 +58,10 @@ def init():
if not os.path.exists(wx_path):
return ReJson(1001, body=wx_path)
out_path = os.path.join(g.tmp_path, "decrypted", my_wxid) if my_wxid else os.path.join(g.tmp_path,
"decrypted")
out_path = os.path.join(g.tmp_path, "decrypted", my_wxid) if my_wxid else os.path.join(g.tmp_path, "decrypted")
if os.path.exists(out_path):
shutil.rmtree(out_path)
code, merge_save_path = decrypt_merge(wx_path=wx_path, key=key, outpath=out_path)
time.sleep(1)
if code: