添加自动解密数据库的命令行操作
This commit is contained in:
parent
7eecfd521e
commit
78330e1655
@ -161,10 +161,10 @@ git clone https://github.com/xaoyaoo/PyWxDump.git
|
||||
python decrypt.py --key ******** --db_path ./decrypted/decrypted.db --out_path ./decrypted/decrypted.db
|
||||
```
|
||||
|
||||
自动读取本地微信聊天记录文件夹,解密后保存到当前目录下的decrypted文件夹中
|
||||
自动根据注册表读取本地微信聊天记录文件夹,解密后保存到当前目录下的decrypted文件夹中
|
||||
|
||||
```shell
|
||||
python get_wx_decrypted_db.py
|
||||
python get_wx_decrypted_db.py --key ********
|
||||
```
|
||||
|
||||
## 四、支持功能
|
||||
|
@ -5,6 +5,7 @@
|
||||
# Author: xaoyaoo
|
||||
# Date: 2023/08/25
|
||||
# -------------------------------------------------------------------------------
|
||||
import argparse
|
||||
import os
|
||||
import re
|
||||
import shutil
|
||||
@ -247,12 +248,14 @@ def merge_media_msg_db(db_path: list, save_path: str):
|
||||
return save_path
|
||||
|
||||
|
||||
def main(keys: list = None):
|
||||
def main(keys=None):
|
||||
decrypted_ROOT = os.path.join(os.getcwd(), "decrypted")
|
||||
|
||||
if keys is None:
|
||||
print("keys is None")
|
||||
return False
|
||||
if isinstance(keys, str):
|
||||
keys = [keys]
|
||||
|
||||
user_dirs = get_wechat_db()
|
||||
for user, db_path in user_dirs.items(): # 遍历用户
|
||||
@ -289,8 +292,23 @@ def main(keys: list = None):
|
||||
merge_copy_msg_db(EmotionDecryptPaths, EmmotionDbPath)
|
||||
|
||||
shutil.rmtree(decrypted_path_tmp) # 删除临时文件
|
||||
print(f"解密完成:{user}, {decrypted_path}")
|
||||
return True
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
# 创建命令行参数解析器
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument("-k", "--key", help="解密密钥", nargs="+", required=True)
|
||||
|
||||
# 解析命令行参数
|
||||
args = parser.parse_args()
|
||||
|
||||
# 检查是否缺少必要参数,并抛出错误
|
||||
if not args.key:
|
||||
raise ValueError("缺少必要的命令行参数!请提供密钥。")
|
||||
|
||||
# 从命令行参数获取值
|
||||
keys = args.key
|
||||
|
||||
main(keys)
|
||||
|
Loading…
Reference in New Issue
Block a user