ALL命令自动查看所有的本地聊天记录,自动合并所有聊天记录相关数据库

This commit is contained in:
xaoyaoo 2023-12-28 21:15:01 +08:00
parent bd9bc2bfb2
commit 67a3eb98bc
2 changed files with 21 additions and 19 deletions

View File

@ -22,4 +22,4 @@ except:
VERSION_LIST = {} VERSION_LIST = {}
VERSION_LIST_PATH = None VERSION_LIST_PATH = None
__version__ = "2.3.26" __version__ = "2.3.27"

View File

@ -313,28 +313,32 @@ class MainAll():
print("[-] 未获取到数据库路径") print("[-] 未获取到数据库路径")
return return
wxdbpaths = [i for i in wxdbpaths if "Backup.db" not in i and "xInfo.db" not in i] # 过滤掉无需解密的数据库
wxdblen = len(wxdbpaths) wxdblen = len(wxdbpaths)
print(f"[+] 共发现 {wxdblen} 个微信数据库") print(f"[+] 共发现 {wxdblen} 个微信数据库")
print("=" * 32) print("=" * 32)
out_path = os.path.join(os.getcwd(), "decrypted", wxid) if wxid else os.path.join(os.getcwd(), "decrypted") decrypted_path = os.path.join(os.getcwd(), "decrypted")
print(f"[*] 解密后文件夹:{out_path} ") print(f"[*] 解密后文件夹:{decrypted_path} ")
print(f"[*] 解密中...(用时较久,耐心等待)") print(f"[*] 解密中...(用时较久,耐心等待)")
if not os.path.exists(out_path):
os.makedirs(out_path)
# 判断out_path是否为空目录 # 判断out_path是否为空目录
if os.listdir(out_path): if os.path.exists(decrypted_path) and os.listdir(decrypted_path):
isdel = input(f"[*] 输出文件夹不为空({out_path})\n 是否删除?(y/n):") isdel = input(f"[*] 输出文件夹不为空({decrypted_path})\n 是否删除?(y/n):")
if isdel.lower() == 'y' or isdel.lower() == 'yes': 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: for name in files:
os.remove(os.path.join(root, name)) os.remove(os.path.join(root, name))
for name in dirs: for name in dirs:
os.rmdir(os.path.join(root, name)) 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 函数,并传入参数 # 解密 # 调用 decrypt 函数,并传入参数 # 解密
code, ret = batch_decrypt(key, wxdbpaths, out_path, False) code, ret = batch_decrypt(key, wxdbpaths, out_path, False)
if not code: if not code:
print(ret) print(ret)
return return
@ -361,19 +365,17 @@ class MainAll():
print("[-] 未获取到解密后的数据库路径") print("[-] 未获取到解密后的数据库路径")
return 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" FileStorage_path = os.path.join(filePath, "FileStorage") if filePath else "FileStorage"
# 查看聊天记录 # # 查看聊天记录
MSGDB = [i for i in out_dbs if "de_MSG" in i] args.msg_path = merge_save_path
MSGDB = MSGDB[-1] if MSGDB else None args.micro_path =merge_save_path
MicroMsgDB = [i for i in out_dbs if "de_MicroMsg" in i] args.media_path = merge_save_path
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.filestorage_path = FileStorage_path args.filestorage_path = FileStorage_path
MainShowChatRecords().run(args) MainShowChatRecords().run(args)