From c5d4ee6e3fd760ee740855ff14672eac232fcea7 Mon Sep 17 00:00:00 2001
From: shuaikangzhou <863909694@qq.com>
Date: Sat, 9 Dec 2023 22:48:15 +0800
Subject: [PATCH] =?UTF-8?q?=E6=94=AF=E6=8C=81=E5=AF=BC=E5=87=BA=E8=A1=A8?=
=?UTF-8?q?=E6=83=85=E5=8C=85?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/DataBase/misc.py | 1 -
app/DataBase/msg.py | 1 -
app/DataBase/output_pc.py | 290 +--------
app/ui_pc/tool/pc_decrypt/decryptUi.py | 25 +-
app/ui_pc/tool/pc_decrypt/decryptUi.ui | 773 ++++++++++++------------
app/ui_pc/tool/pc_decrypt/pc_decrypt.py | 4 +-
app/util/emoji.py | 6 +-
app/util/path.py | 5 +-
app/web_ui/web.py | 3 +-
9 files changed, 443 insertions(+), 665 deletions(-)
diff --git a/app/DataBase/misc.py b/app/DataBase/misc.py
index 8691bae..c746247 100644
--- a/app/DataBase/misc.py
+++ b/app/DataBase/misc.py
@@ -54,7 +54,6 @@ class Misc:
lock.acquire(True)
self.cursor.execute(sql, [userName])
result = self.cursor.fetchall()
- # print(result[0][0])
if result:
return result[0][0]
finally:
diff --git a/app/DataBase/msg.py b/app/DataBase/msg.py
index d2bb742..c08c673 100644
--- a/app/DataBase/msg.py
+++ b/app/DataBase/msg.py
@@ -184,7 +184,6 @@ class Msg:
(msg1[4], msg1[5], msg1[7].split(keyword), msg1[8]),
(msg2[4], msg2[5], msg2[7], msg2[8])
))
-
return res
def get_messages_by_days(self, username_, year_='2023'):
diff --git a/app/DataBase/output_pc.py b/app/DataBase/output_pc.py
index 62b244f..d41eccb 100644
--- a/app/DataBase/output_pc.py
+++ b/app/DataBase/output_pc.py
@@ -10,6 +10,9 @@ from .package_msg import PackageMsg
from ..DataBase import hard_link_db
from ..person_pc import MePC
from ..util import path
+import shutil
+
+from ..util.emoji import get_emoji
os.makedirs('./data/聊天记录', exist_ok=True)
@@ -73,8 +76,9 @@ class Output(QThread):
def to_csv_all(self):
origin_docx_path = f"{os.path.abspath('.')}/data/聊天记录/"
os.makedirs(origin_docx_path, exist_ok=True)
- filename = QFileDialog.getSaveFileName(None, "save file", os.path.join(os.getcwd(),'messages.csv'), "csv files (*.csv);;all files(*.*)")
- if not filename:
+ filename = QFileDialog.getSaveFileName(None, "save file", os.path.join(os.getcwd(), 'messages.csv'),
+ "csv files (*.csv);;all files(*.*)")
+ if not filename[0]:
return
filename = filename[0]
# columns = ["用户名", "消息内容", "发送时间", "发送状态", "消息类型", "isSend", "msgId"]
@@ -93,12 +97,14 @@ class Output(QThread):
self.okSignal.emit(1)
def contact_to_csv(self):
- filename = QFileDialog.getSaveFileName(None, "save file", os.path.join(os.getcwd(),'contacts.csv'), "csv files (*.csv);;all files(*.*)")
- if not filename:
+ filename = QFileDialog.getSaveFileName(None, "save file", os.path.join(os.getcwd(), 'contacts.csv'),
+ "csv files (*.csv);;all files(*.*)")
+ if not filename[0]:
return
filename = filename[0]
# columns = ["用户名", "消息内容", "发送时间", "发送状态", "消息类型", "isSend", "msgId"]
- columns = ['UserName','Alias', 'Type', 'Remark', 'NickName', 'PYInitial', 'RemarkPYInitial', 'smallHeadImgUrl', 'bigHeadImgUrl']
+ columns = ['UserName', 'Alias', 'Type', 'Remark', 'NickName', 'PYInitial', 'RemarkPYInitial', 'smallHeadImgUrl',
+ 'bigHeadImgUrl']
contacts = micro_msg_db.get_contact()
# 写入CSV文件
with open(filename, mode='w', newline='', encoding='utf-8') as file:
@@ -212,263 +218,6 @@ class ChildThread(QThread):
writer.writerows(messages)
self.okSignal.emit(1)
- def to_html(self):
- origin_docx_path = f"{os.path.abspath('.')}/data/聊天记录/{self.contact.remark}"
- os.makedirs(origin_docx_path, exist_ok=True)
- messages = msg_db.get_messages(self.contact.wxid)
- filename = f"{os.path.abspath('.')}/data/聊天记录/{self.contact.remark}/{self.contact.remark}.html"
- f = open(filename, 'w', encoding='utf-8')
- html_head = '''
-
-
-
-
- Title
-
-
-
-
-
- '''
- f.write(html_head)
- MePC().avatar.save(os.path.join(origin_docx_path, 'myhead.png'))
- self.contact.avatar.save(os.path.join(origin_docx_path, 'tahead.png'))
- self.rangeSignal.emit(len(messages))
- for index, message in enumerate(messages):
- type_ = message[2]
- str_content = message[7]
- str_time = message[8]
- # print(type_, type(type_))
- is_send = message[4]
- avatar = MePC().avatar_path if is_send else self.contact.avatar_path
- timestamp = message[5]
- self.progressSignal.emit(index)
- if type_ == 1:
- if self.is_5_min(timestamp):
- f.write(
- f'''
-
{str_time}
- '''
- )
- if is_send:
- f.write(
- f'''
-
-
{str_content}
-
-

-
-
- '''
- )
- else:
- f.write(
- f'''
-
-
-

-
-
{str_content}
-
-
- '''
- )
- html_end = '''
-
-
-
-
-
-
- '''
- f.write(html_end)
- f.close()
- self.okSignal.emit(1)
-
def to_html_(self):
origin_docx_path = f"{os.path.abspath('.')}/data/聊天记录/{self.contact.remark}"
makedirs(origin_docx_path)
@@ -921,7 +670,12 @@ const chatMessages = [
)
elif type_ == 43:
video_path = hard_link_db.get_video(content=str_content, thumb=False)
- video_path = f'file:///{path.wx_path()}/{MePC().wxid}/{video_path}'
+ video_path = f'{MePC().wx_dir}/{video_path}'
+ if os.path.exists(video_path):
+ new_path = origin_docx_path + '/video/' + os.path.basename(video_path)
+ if not os.path.exists(new_path):
+ shutil.copy(video_path, os.path.join(origin_docx_path, 'video'))
+ video_path = f'./video/{os.path.basename(video_path)}'
video_path = video_path.replace('\\', '/')
if self.is_5_min(timestamp):
f.write(
@@ -930,6 +684,16 @@ const chatMessages = [
f.write(
f'''{{ type:{type_}, text: '{video_path}',is_send:{is_send},avatar_path:'{avatar}'}},'''
)
+ elif type_ == 47:
+ emoji_path = get_emoji(str_content, thumb=True, output_path=origin_docx_path + '/emoji')
+ emoji_path = './emoji/'+os.path.basename(emoji_path)
+ if self.is_5_min(timestamp):
+ f.write(
+ f'''{{ type:0, text: '{str_time}',is_send:0,avatar_path:''}},'''
+ )
+ f.write(
+ f'''{{ type:{3}, text: '{emoji_path}',is_send:{is_send},avatar_path:'{avatar}'}},'''
+ )
elif type_ == 10000:
str_content = escape_js_and_html(str_content.lstrip('').rstrip(''))
f.write(
diff --git a/app/ui_pc/tool/pc_decrypt/decryptUi.py b/app/ui_pc/tool/pc_decrypt/decryptUi.py
index 2593956..ac35c66 100644
--- a/app/ui_pc/tool/pc_decrypt/decryptUi.py
+++ b/app/ui_pc/tool/pc_decrypt/decryptUi.py
@@ -50,6 +50,10 @@ class Ui_Dialog(object):
self.label_3.setAlignment(QtCore.Qt.AlignCenter)
self.label_3.setObjectName("label_3")
self.verticalLayout.addWidget(self.label_3)
+ self.label_9 = QtWidgets.QLabel(Dialog)
+ self.label_9.setAlignment(QtCore.Qt.AlignCenter)
+ self.label_9.setObjectName("label_9")
+ self.verticalLayout.addWidget(self.label_9)
self.gridLayout_2 = QtWidgets.QGridLayout()
self.gridLayout_2.setObjectName("gridLayout_2")
self.gridLayout = QtWidgets.QGridLayout()
@@ -63,16 +67,16 @@ class Ui_Dialog(object):
self.gridLayout.addWidget(self.label_7, 1, 0, 1, 1)
self.lineEdit = QtWidgets.QLineEdit(Dialog)
self.lineEdit.setStyleSheet("background:transparent;\n"
- "\n"
- " border-radius:5px;\n"
- " border-top: 0px solid #b2e281;\n"
- " border-bottom: 2px solid black;\n"
- " border-right: 0px solid #b2e281;\n"
- " border-left: 0px solid #b2e281;\n"
- "\n"
- "\n"
- " border-style:outset\n"
- " ")
+"\n"
+" border-radius:5px;\n"
+" border-top: 0px solid #b2e281;\n"
+" border-bottom: 2px solid black;\n"
+" border-right: 0px solid #b2e281;\n"
+" border-left: 0px solid #b2e281;\n"
+"\n"
+"\n"
+" border-style:outset\n"
+" ")
self.lineEdit.setFrame(False)
self.lineEdit.setObjectName("lineEdit")
self.gridLayout.addWidget(self.lineEdit, 4, 1, 1, 1)
@@ -178,6 +182,7 @@ class Ui_Dialog(object):
Dialog.setWindowTitle(_translate("Dialog", "Dialog"))
self.btn_help.setText(_translate("Dialog", "使用说明"))
self.label_3.setText(_translate("Dialog", "解密数据库"))
+ self.label_9.setText(_translate("Dialog", "以下内容为自动获取,如获取失败请手动填写"))
self.label_7.setText(_translate("Dialog", "版本"))
self.label_5.setText(_translate("Dialog", "微信昵称"))
self.label_6.setText(_translate("Dialog", "密钥"))
diff --git a/app/ui_pc/tool/pc_decrypt/decryptUi.ui b/app/ui_pc/tool/pc_decrypt/decryptUi.ui
index 3890508..421bba9 100644
--- a/app/ui_pc/tool/pc_decrypt/decryptUi.ui
+++ b/app/ui_pc/tool/pc_decrypt/decryptUi.ui
@@ -1,141 +1,150 @@
- Dialog
-
-
-
- 0
- 0
- 611
- 519
-
-
-
+ Dialog
+
+
+
+ 0
+ 0
+ 611
+ 519
+
+
+
+
+ 微软雅黑
+
+
+
+ Dialog
+
+
+ Qt::LeftToRight
+
+
+ -
+
+
-
+
+
-
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+ -
+
+
+
+ 200
+ 16777215
+
+
+
+ 使用说明
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+
+
+ -
+
+
+ Qt::Vertical
+
+
+
+ 20
+ 40
+
+
+
+
+ -
+
+
-
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+ -
+
+
-
+
+
- 微软雅黑
+ 一纸情书
+ 20
-
-
- Dialog
-
-
- Qt::LeftToRight
-
-
-
-
-
-
-
-
-
-
-
-
- Qt::Horizontal
-
-
-
- 40
- 20
-
-
-
-
- -
-
-
-
- 200
- 16777215
-
-
-
- 使用说明
-
-
-
- -
-
-
- Qt::Horizontal
-
-
-
- 40
- 20
-
-
-
-
-
-
- -
-
-
- Qt::Vertical
-
-
-
- 20
- 40
-
-
-
-
- -
-
-
-
-
-
- Qt::Horizontal
-
-
-
- 40
- 20
-
-
-
-
- -
-
-
-
-
-
-
- 一纸情书
- 20
-
-
-
- 解密数据库
-
-
- Qt::AlignCenter
-
-
-
- -
-
-
-
-
-
-
-
-
-
-
-
-
- -
-
-
- 版本
-
-
-
- -
-
-
- background:transparent;
+
+
+ 解密数据库
+
+
+ Qt::AlignCenter
+
+
+
+ -
+
+
+ 以下内容为自动获取,如获取失败请手动填写
+
+
+ Qt::AlignCenter
+
+
+
+ -
+
+
-
+
+
-
+
+
+
+
+
+
+ -
+
+
+ 版本
+
+
+
+ -
+
+
+ background:transparent;
border-radius:5px;
border-top: 0px solid #b2e281;
@@ -146,253 +155,253 @@
border-style:outset
-
-
- false
-
-
-
- -
-
-
- 微信昵称
-
-
-
- -
-
-
- 密钥
-
-
-
- -
-
-
-
- 400
- 16777215
-
-
-
-
-
-
-
- -
-
-
- PID
-
-
-
- -
-
-
- 手机号
-
-
-
- -
-
-
-
-
-
-
- -
-
-
-
-
-
-
- -
-
-
- wxid
-
-
-
- -
-
-
-
-
-
-
- -
-
-
- 微信路径
-
-
-
- -
-
-
-
- 400
- 300
-
-
-
-
-
-
-
-
-
- -
-
-
-
- 0
- 60
-
-
-
- 获取信息
-
-
-
- -
-
-
-
-
-
-
- -
-
-
-
- 0
- 60
-
-
-
- 设置微信路径
-
-
-
- -
-
-
-
-
-
-
-
-
- -
-
-
-
-
-
- Qt::Horizontal
-
-
-
- 40
- 20
-
-
-
-
- -
-
-
-
- 0
- 60
-
-
-
-
- 100
- 16777215
-
-
-
- 开始启动
-
-
-
- -
-
-
- TextLabel
-
-
-
- -
-
-
- Qt::Horizontal
-
-
-
- 40
- 20
-
-
-
-
-
-
- -
-
-
-
-
-
- 未就绪
-
-
-
- -
-
-
- 50
-
-
-
-
-
-
-
- -
-
-
- Qt::Horizontal
-
-
-
- 40
- 20
-
-
-
-
-
-
- -
-
-
- Qt::Vertical
-
-
-
- 20
- 40
-
-
-
-
-
-
+
+
+ false
+
+
+
+ -
+
+
+ 微信昵称
+
+
+
+ -
+
+
+ 密钥
+
+
+
+ -
+
+
+
+ 400
+ 16777215
+
+
+
+
+
+
+
+ -
+
+
+ PID
+
+
+
+ -
+
+
+ 手机号
+
+
+
+ -
+
+
+
+
+
+
+ -
+
+
+
+
+
+
+ -
+
+
+ wxid
+
+
+
+ -
+
+
+
+
+
+
+ -
+
+
+ 微信路径
+
+
+
+ -
+
+
+
+ 400
+ 300
+
+
+
+
+
+
+
+
+
+ -
+
+
+
+ 0
+ 60
+
+
+
+ 获取信息
+
+
+
+ -
+
+
+
+
+
+
+ -
+
+
+
+ 0
+ 60
+
+
+
+ 设置微信路径
+
+
+
+ -
+
+
+
+
+
+
+
+
+ -
+
+
-
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+ -
+
+
+
+ 0
+ 60
+
+
+
+
+ 100
+ 16777215
+
+
+
+ 开始启动
+
+
+
+ -
+
+
+ TextLabel
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+
+
+ -
+
+
-
+
+
+ 未就绪
+
+
+
+ -
+
+
+ 50
+
+
+
+
+
-
-
-
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+
+
+ -
+
+
+ Qt::Vertical
+
+
+
+ 20
+ 40
+
+
+
+
+
+
+
+
+
+
diff --git a/app/ui_pc/tool/pc_decrypt/pc_decrypt.py b/app/ui_pc/tool/pc_decrypt/pc_decrypt.py
index c1c1555..d7723b7 100644
--- a/app/ui_pc/tool/pc_decrypt/pc_decrypt.py
+++ b/app/ui_pc/tool/pc_decrypt/pc_decrypt.py
@@ -125,7 +125,7 @@ class DecryptControl(QWidget, decryptUi.Ui_Dialog):
QMessageBox.critical(self, "错误", "文件夹选择错误\n一般以wxid_xxx结尾")
return
if self.info.get('key') == 'none':
- QMessageBox.critical(self, "错误", "密钥错误\n请检查微信版本是否为最新")
+ QMessageBox.critical(self, "错误", "密钥错误\n请检查微信版本是否为最新和微信路径是否正确")
self.label_tip.setVisible(True)
self.label_tip.setText('点我之后没有反应那就多等儿吧,不要再点了')
self.thread2 = DecryptThread(db_dir, self.info['key'])
@@ -133,7 +133,7 @@ class DecryptControl(QWidget, decryptUi.Ui_Dialog):
self.thread2.signal.connect(self.progressBar_view)
self.thread2.okSignal.connect(self.btnExitClicked)
self.thread2.errorSignal.connect(
- lambda x: QMessageBox.critical(self, "错误", "密钥错误\n请检查微信版本是否为最新")
+ lambda x: QMessageBox.critical(self, "错误", "密钥错误\n请检查微信版本是否为最新和微信路径是否正确")
)
self.thread2.start()
diff --git a/app/util/emoji.py b/app/util/emoji.py
index d1a2ee9..eeec30e 100644
--- a/app/util/emoji.py
+++ b/app/util/emoji.py
@@ -79,18 +79,18 @@ def download(url, output_dir, name, thumb=False):
return output_path
-def get_emoji(xml_string, thumb=True) -> str:
+def get_emoji(xml_string, thumb=True, output_path=root_path) -> str:
emoji_info = parser_xml(xml_string)
md5 = emoji_info['md5']
image_format = ['.png', '.gif', '.jpeg']
for f in image_format:
prefix = 'th_' if thumb else ''
- file_path = os.path.join(root_path, prefix + md5 + f)
+ file_path = os.path.join(output_path, prefix + md5 + f)
if os.path.exists(file_path):
return file_path
url = emoji_info['thumburl'] if thumb else emoji_info['cdnurl']
print("下载表情包ing:", url)
- return download(url, root_path, md5, thumb)
+ return download(url, output_path, md5, thumb)
if __name__ == '__main__':
diff --git a/app/util/path.py b/app/util/path.py
index 2b80bc9..1f2ddbd 100644
--- a/app/util/path.py
+++ b/app/util/path.py
@@ -17,11 +17,12 @@ def get_abs_path(path, base_path="/data/image"):
return ':/icons/icons/404.png'
-def get_relative_path(path, base_path):
+def get_relative_path(path, base_path, type_='image'):
if path:
base_path = os.getcwd() + base_path
output_path = dat2pic.decode_dat(os.path.join(MePC().wx_dir, path), base_path)
- relative_path = './image/'+os.path.basename(output_path) if output_path else 'https://www.bing.com/images/search?view=detailV2&ccid=Zww6woP3&id=CCC91337C740656E800E51247E928ACD3052FECF&thid=OIP.Zww6woP3Em49TdSG_lnggAHaEK&mediaurl=https%3a%2f%2fmeekcitizen.files.wordpress.com%2f2018%2f09%2f404.jpg%3fw%3d656&exph=360&expw=640&q=404&simid=608040792714530493&FORM=IRPRST&ck=151E7337A86F1B9C5C5DB08B15B90809&selectedIndex=21&itb=0'
+ relative_path = './image/' + os.path.basename(
+ output_path) if output_path else 'https://www.bing.com/images/search?view=detailV2&ccid=Zww6woP3&id=CCC91337C740656E800E51247E928ACD3052FECF&thid=OIP.Zww6woP3Em49TdSG_lnggAHaEK&mediaurl=https%3a%2f%2fmeekcitizen.files.wordpress.com%2f2018%2f09%2f404.jpg%3fw%3d656&exph=360&expw=640&q=404&simid=608040792714530493&FORM=IRPRST&ck=151E7337A86F1B9C5C5DB08B15B90809&selectedIndex=21&itb=0'
return relative_path
else:
return ':/icons/icons/404.png'
diff --git a/app/web_ui/web.py b/app/web_ui/web.py
index 1f48924..37e7d49 100644
--- a/app/web_ui/web.py
+++ b/app/web_ui/web.py
@@ -72,6 +72,7 @@ def set_text(text):
%s
+