Skip to content

Commit

Permalink
新增语音数据库查询模块
Browse files Browse the repository at this point in the history
  • Loading branch information
LC044 committed Dec 3, 2023
1 parent 292533b commit e281c08
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 6 deletions.
3 changes: 1 addition & 2 deletions app/DataBase/hard_link.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
from app.log import log

lock = threading.Lock()
DB = None
cursor = None

db_path = "./app/Database/Msg/HardLinkImage.db"
root_path = 'FileStorage/MsgAttach/'

Expand Down
58 changes: 58 additions & 0 deletions app/DataBase/media_msg.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import os.path
import sqlite3
import threading

lock = threading.Lock()
db_path = "./app/Database/Msg/MediaMSG3.db"


def singleton(cls):
_instance = {}

def inner():
if cls not in _instance:
_instance[cls] = cls()
return _instance[cls]

return inner


@singleton
class MediaMsg:
def __init__(self):
self.DB = None
self.cursor: sqlite3.Cursor = None
self.open_flag = False
self.init_database()

def init_database(self):
if not self.open_flag:
if os.path.exists(db_path):
self.DB = sqlite3.connect(db_path, check_same_thread=False)
# '''创建游标'''
self.cursor = self.DB.cursor()
self.open_flag = True
if lock.locked():
lock.release()

def get_media_buffer(self, reserved0):
pass
sql = '''
select Buf
from Media
where Reserved0 = ?
'''
try:
lock.acquire(True)
self.cursor.execute(sql, [reserved0])
return self.cursor.fetchone()
finally:
lock.release()


if __name__ == '__main__':
db_path = './Msg/MediaMSG3.db'
media_msg_db = MediaMsg()
reserved = '823076859361714342'
buf = media_msg_db.get_media_buffer(reserved)
print(buf)
4 changes: 2 additions & 2 deletions app/DataBase/msg.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def get_messages(self, username_):
if not self.open_flag:
return None
sql = '''
select localId,TalkerId,Type,SubType,IsSender,CreateTime,Status,StrContent,strftime('%Y-%m-%d %H:%M:%S',CreateTime,'unixepoch','localtime') as StrTime
select localId,TalkerId,Type,SubType,IsSender,CreateTime,Status,StrContent,strftime('%Y-%m-%d %H:%M:%S',CreateTime,'unixepoch','localtime') as StrTime,MsgSvrID
from MSG
where StrTalker=?
order by CreateTime
Expand All @@ -65,7 +65,7 @@ def get_messages(self, username_):

def get_messages_all(self):
sql = '''
select localId,TalkerId,Type,SubType,IsSender,CreateTime,Status,StrContent,strftime('%Y-%m-%d %H:%M:%S',CreateTime,'unixepoch','localtime') as StrTime
select localId,TalkerId,Type,SubType,IsSender,CreateTime,Status,StrContent,strftime('%Y-%m-%d %H:%M:%S',CreateTime,'unixepoch','localtime') as StrTime,MsgSvrID
from MSG
order by CreateTime
'''
Expand Down
4 changes: 2 additions & 2 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@

## 🍉功能

- 获得📱手机本地微信数据库的使用权🐶
- 获得💻PC端本地微信数据库的使用权🐶
- 解密📱手机本地微信数据库🐶
- 解密💻PC端本地微信数据库🐶
- 还原微信聊天界面
- 🗨文本✅
- 🏝图片✅
Expand Down

0 comments on commit e281c08

Please sign in to comment.