From abab101821234be13f4fc9489bef5a81b9044be2 Mon Sep 17 00:00:00 2001 From: STDquantum <405720329@qq.com> Date: Mon, 11 Dec 2023 12:52:44 +0800 Subject: [PATCH 1/2] =?UTF-8?q?html=E9=A1=B5=E9=9D=A2=E8=BE=93=E5=85=A5?= =?UTF-8?q?=E9=A1=B5=E7=A0=81=E5=8F=AF=E4=BB=A5=E5=9B=9E=E8=BD=A6=E8=B7=B3?= =?UTF-8?q?=E8=BD=AC=EF=BC=8C=E8=B7=B3=E8=BD=AC=E5=90=8E=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E6=BB=9A=E5=8A=A8=E5=88=B0=E9=A1=B5=E9=9D=A2=E9=A1=B6=E9=83=A8?= =?UTF-8?q?=E3=80=82=E7=BB=9F=E4=B8=80=E4=BA=86=E7=BC=A9=E8=BF=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/DataBase/output_pc.py | 573 +++++++++++++++++++------------------- 1 file changed, 288 insertions(+), 285 deletions(-) diff --git a/app/DataBase/output_pc.py b/app/DataBase/output_pc.py index 55bb67c..e4d5f72 100644 --- a/app/DataBase/output_pc.py +++ b/app/DataBase/output_pc.py @@ -518,234 +518,233 @@ html_head = ''' Chat Records -
+
昨天 12:35
你已添加了凡繁烦,现在可以开始聊天了。
@@ -779,65 +778,63 @@ input {
昨天 13:15
-
-
-
- - -
-
- - -
-
+
+ + +
+
+ + +
+
From 193ed08e037cc84b58e11aa57ce06e54d8e42b4f Mon Sep 17 00:00:00 2001 From: STDquantum <405720329@qq.com> Date: Mon, 11 Dec 2023 18:32:50 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=90=88=E5=B9=B6?= =?UTF-8?q?=E9=9F=B3=E9=A2=91=E6=95=B0=E6=8D=AE=E7=9A=84=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/DataBase/merge.py | 36 +++++++++++++++++++++++++ app/ui_pc/tool/pc_decrypt/pc_decrypt.py | 17 ++++++++++-- 2 files changed, 51 insertions(+), 2 deletions(-) diff --git a/app/DataBase/merge.py b/app/DataBase/merge.py index 27ea06b..2038a84 100644 --- a/app/DataBase/merge.py +++ b/app/DataBase/merge.py @@ -1,6 +1,42 @@ import os import sqlite3 +def merge_MediaMSG_databases(source_paths, target_path): + # 创建目标数据库连接 + target_conn = sqlite3.connect(target_path) + target_cursor = target_conn.cursor() + try: + # 开始事务 + target_conn.execute("BEGIN;") + for i, source_path in enumerate(source_paths): + if not os.path.exists(source_path): + break + db = sqlite3.connect(source_path) + db.text_factory = str + cursor = db.cursor() + sql = ''' + SELECT Key,Reserved0,Buf,Reserved1,Reserved2 FROM Media; + ''' + cursor.execute(sql) + result = cursor.fetchall() + # 附加源数据库 + target_cursor.executemany( + "INSERT INTO Media (Key,Reserved0,Buf,Reserved1,Reserved2)" + "VALUES(?,?,?,?,?)", + result) + cursor.close() + db.close() + # 提交事务 + target_conn.execute("COMMIT;") + + except Exception as e: + # 发生异常时回滚事务 + target_conn.execute("ROLLBACK;") + raise e + + finally: + # 关闭目标数据库连接 + target_conn.close() def merge_databases(source_paths, target_path): # 创建目标数据库连接 diff --git a/app/ui_pc/tool/pc_decrypt/pc_decrypt.py b/app/ui_pc/tool/pc_decrypt/pc_decrypt.py index d7723b7..85637e3 100644 --- a/app/ui_pc/tool/pc_decrypt/pc_decrypt.py +++ b/app/ui_pc/tool/pc_decrypt/pc_decrypt.py @@ -8,7 +8,7 @@ from PyQt5.QtGui import QDesktopServices from PyQt5.QtWidgets import QWidget, QMessageBox, QFileDialog from app.DataBase import msg_db, misc_db -from app.DataBase.merge import merge_databases +from app.DataBase.merge import merge_databases, merge_MediaMSG_databases from app.decrypt import get_wx_info, decrypt from app.log import logger from app.util import path @@ -173,7 +173,7 @@ class DecryptControl(QWidget, decryptUi.Ui_Dialog): except: with open('./info.json', 'w', encoding='utf-8') as f: f.write(json.dumps(dic)) - # 目标数据库文件 + # 目标数据库文件 target_database = "app/DataBase/Msg/MSG.db" # 源数据库文件列表 source_databases = [f"app/DataBase/Msg/MSG{i}.db" for i in range(1, 20)] @@ -184,6 +184,19 @@ class DecryptControl(QWidget, decryptUi.Ui_Dialog): merge_databases(source_databases, target_database) except FileNotFoundError: QMessageBox.critical(self, "错误", "数据库不存在\n请检查微信版本是否为最新") + + # 音频数据库文件 + target_database = "app/DataBase/Msg/MediaMSG.db" + # 源数据库文件列表 + source_databases = [f"app/DataBase/Msg/MediaMSG{i}.db" for i in range(1, 20)] + import shutil + shutil.copy("app/DataBase/Msg/MediaMSG0.db", target_database) # 使用一个数据库文件作为模板 + # 合并数据库 + try: + merge_MediaMSG_databases(source_databases, target_database) + except FileNotFoundError: + QMessageBox.critical(self, "错误", "数据库不存在\n请检查微信版本是否为最新") + self.DecryptSignal.emit(True) self.close()