From 67a3eb98bc3dfdf9191d75fbb2c1c5803ae1d1d5 Mon Sep 17 00:00:00 2001 From: xaoyaoo Date: Thu, 28 Dec 2023 21:15:01 +0800 Subject: [PATCH] =?UTF-8?q?ALL=E5=91=BD=E4=BB=A4=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E6=9F=A5=E7=9C=8B=E6=89=80=E6=9C=89=E7=9A=84=E6=9C=AC=E5=9C=B0?= =?UTF-8?q?=E8=81=8A=E5=A4=A9=E8=AE=B0=E5=BD=95=EF=BC=8C=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E5=90=88=E5=B9=B6=E6=89=80=E6=9C=89=E8=81=8A=E5=A4=A9=E8=AE=B0?= =?UTF-8?q?=E5=BD=95=E7=9B=B8=E5=85=B3=E6=95=B0=E6=8D=AE=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pywxdump/__init__.py | 2 +- pywxdump/cli.py | 38 ++++++++++++++++++++------------------ 2 files changed, 21 insertions(+), 19 deletions(-) diff --git a/pywxdump/__init__.py b/pywxdump/__init__.py index 3431e6a7..05ad008c 100644 --- a/pywxdump/__init__.py +++ b/pywxdump/__init__.py @@ -22,4 +22,4 @@ VERSION_LIST = {} VERSION_LIST_PATH = None -__version__ = "2.3.26" +__version__ = "2.3.27" diff --git a/pywxdump/cli.py b/pywxdump/cli.py index 210add4f..83c2a7e2 100644 --- a/pywxdump/cli.py +++ b/pywxdump/cli.py @@ -313,28 +313,32 @@ def run(self, args): print("[-] 未获取到数据库路径") return + wxdbpaths = [i for i in wxdbpaths if "Backup.db" not in i and "xInfo.db" not in i] # 过滤掉无需解密的数据库 wxdblen = len(wxdbpaths) print(f"[+] 共发现 {wxdblen} 个微信数据库") print("=" * 32) - out_path = os.path.join(os.getcwd(), "decrypted", wxid) if wxid else os.path.join(os.getcwd(), "decrypted") - print(f"[*] 解密后文件夹:{out_path} ") + decrypted_path = os.path.join(os.getcwd(), "decrypted") + print(f"[*] 解密后文件夹:{decrypted_path} ") print(f"[*] 解密中...(用时较久,耐心等待)") - if not os.path.exists(out_path): - os.makedirs(out_path) # 判断out_path是否为空目录 - if os.listdir(out_path): - isdel = input(f"[*] 输出文件夹不为空({out_path})\n 是否删除?(y/n):") + if os.path.exists(decrypted_path) and os.listdir(decrypted_path): + isdel = input(f"[*] 输出文件夹不为空({decrypted_path})\n 是否删除?(y/n):") if isdel.lower() == 'y' or isdel.lower() == 'yes': - for root, dirs, files in os.walk(out_path, topdown=False): + for root, dirs, files in os.walk(decrypted_path, topdown=False): for name in files: os.remove(os.path.join(root, name)) for name in dirs: os.rmdir(os.path.join(root, name)) + out_path = os.path.join(decrypted_path, wxid) if wxid else decrypted_path + if not os.path.exists(out_path): + os.makedirs(out_path) + # 调用 decrypt 函数,并传入参数 # 解密 code, ret = batch_decrypt(key, wxdbpaths, out_path, False) + if not code: print(ret) return @@ -361,19 +365,17 @@ def run(self, args): print("[-] 未获取到解密后的数据库路径") return + parpare_merge_db_path = [i for i in out_dbs if "de_MicroMsg" in i or "de_MediaMSG" in i or "de_MSG" in i] + # 合并所有的数据库 + print(f"[*] 合并数据库中...(用时较久,耐心等待)") + merge_save_path = merge_db(parpare_merge_db_path, os.path.join(out_path, "merge_all.db")) + FileStorage_path = os.path.join(filePath, "FileStorage") if filePath else "FileStorage" - # 查看聊天记录 - MSGDB = [i for i in out_dbs if "de_MSG" in i] - MSGDB = MSGDB[-1] if MSGDB else None - MicroMsgDB = [i for i in out_dbs if "de_MicroMsg" in i] - MicroMsgDB = MicroMsgDB[-1] if MicroMsgDB else None - MediaMSGDB = [i for i in out_dbs if "de_MediaMSG" in i] - MediaMSGDB = MediaMSGDB[-1] if MediaMSGDB else None - - args.msg_path = MSGDB - args.micro_path = MicroMsgDB - args.media_path = MediaMSGDB + # # 查看聊天记录 + args.msg_path = merge_save_path + args.micro_path =merge_save_path + args.media_path = merge_save_path args.filestorage_path = FileStorage_path MainShowChatRecords().run(args)