rename core_db_type

This commit is contained in:
xaoyaoo 2024-08-18 10:50:20 +08:00
parent 9f1a7d3899
commit 0c56e20c9d
3 changed files with 7 additions and 7 deletions

View File

@ -15,7 +15,7 @@ from typing import List
from .decryption import batch_decrypt from .decryption import batch_decrypt
from .wx_info import get_core_db from .wx_info import get_core_db
from .utils import wx_core_loger, wx_core_error, DB_TYPE_CORE from .utils import wx_core_loger, wx_core_error, CORE_DB_TYPE
@wx_core_error @wx_core_error
@ -467,7 +467,7 @@ def all_merge_real_time_db(key, wx_path, merge_path: str, real_time_exe_path: st
from pywxdump import get_core_db from pywxdump import get_core_db
except ImportError: except ImportError:
return False, "未找到模块 pywxdump" return False, "未找到模块 pywxdump"
db_paths = get_core_db(wx_path, DB_TYPE_CORE) db_paths = get_core_db(wx_path, CORE_DB_TYPE)
if not db_paths[0]: if not db_paths[0]:
return False, db_paths[1] return False, db_paths[1]
db_paths = db_paths[1] db_paths = db_paths[1]

View File

@ -12,5 +12,5 @@ from .ctypes_utils import get_process_list, get_memory_maps, get_process_exe_pat
from .memory_search import search_memory from .memory_search import search_memory
from ._loger import wx_core_loger from ._loger import wx_core_loger
DB_TYPE_CORE = ["MicroMsg", "MSG", "MediaMSG", "OpenIMContact", "OpenIMMsg", "PublicMsg", "OpenIMMedia", CORE_DB_TYPE = ["MicroMsg", "MSG", "MediaMSG", "OpenIMContact", "OpenIMMsg", "PublicMsg", "OpenIMMedia",
"Favorite", "Sns"] "Favorite", "Sns"]

View File

@ -14,7 +14,7 @@ from typing import List, Union
from .utils import verify_key, get_exe_bit, wx_core_error from .utils import verify_key, get_exe_bit, wx_core_error
from .utils import get_process_list, get_memory_maps, get_process_exe_path, get_file_version_info from .utils import get_process_list, get_memory_maps, get_process_exe_path, get_file_version_info
from .utils import search_memory from .utils import search_memory
from .utils import wx_core_loger, DB_TYPE_CORE from .utils import wx_core_loger, CORE_DB_TYPE
import ctypes.wintypes as wintypes import ctypes.wintypes as wintypes
# 定义常量 # 定义常量
@ -415,15 +415,15 @@ def get_core_db(wx_path: str, db_types: list = None) -> [dict]:
""" """
获取聊天消息核心数据库路径 获取聊天消息核心数据库路径
:param wx_path: 微信文件夹路径 egC:\*****\WeChat Files\wxid******* :param wx_path: 微信文件夹路径 egC:\*****\WeChat Files\wxid*******
:param db_types: 数据库类型 eg: DB_TYPE_CORE中选择一个或多个 :param db_types: 数据库类型 eg: CORE_DB_TYPE中选择一个或多个
:return: 返回数据库路径 eg: [{"wxid": wxid, "db_type": db_type, "db_path": db_path, "wxid_dir": wxid_dir}, ...] :return: 返回数据库路径 eg: [{"wxid": wxid, "db_type": db_type, "db_path": db_path, "wxid_dir": wxid_dir}, ...]
""" """
if not os.path.exists(wx_path): if not os.path.exists(wx_path):
return False, f"[-] 目录不存在: {wx_path}" return False, f"[-] 目录不存在: {wx_path}"
if not db_types: if not db_types:
db_types = DB_TYPE_CORE db_types = CORE_DB_TYPE
db_types = [dt for dt in db_types if dt in DB_TYPE_CORE] db_types = [dt for dt in db_types if dt in CORE_DB_TYPE]
msg_dir = os.path.dirname(wx_path) msg_dir = os.path.dirname(wx_path)
my_wxid = os.path.basename(wx_path) my_wxid = os.path.basename(wx_path)
wxdbpaths = get_wx_db(msg_dir=msg_dir, db_types=db_types, wxids=my_wxid) wxdbpaths = get_wx_db(msg_dir=msg_dir, db_types=db_types, wxids=my_wxid)