添加自动解密数据库的命令行操作
This commit is contained in:
parent
0e87ff98ef
commit
bafd492868
10
README.md
10
README.md
@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
* 更新日志(如果有[version_list.json](./Program/version_list.json)缺少的版本,请帮忙添加。)
|
* 更新日志(如果有[version_list.json](./Program/version_list.json)缺少的版本,请帮忙添加。)
|
||||||
|
|
||||||
* 2023.09.28 增加了数据库部分解析
|
* 2023.09.28 增加了数据库部分解析
|
||||||
* 2023.09.15 增加了3.9.7.25版本的偏移地址
|
* 2023.09.15 增加了3.9.7.25版本的偏移地址
|
||||||
|
|
||||||
## 一、项目介绍
|
## 一、项目介绍
|
||||||
|
|
||||||
@ -11,10 +11,10 @@
|
|||||||
|
|
||||||
该分支是[SharpWxDump](https://github.com/AdminTest0/SharpWxDump)的经过重构python语言版本,同时添加了一些新的功能。
|
该分支是[SharpWxDump](https://github.com/AdminTest0/SharpWxDump)的经过重构python语言版本,同时添加了一些新的功能。
|
||||||
|
|
||||||
**如果觉得好用的话的话,帮忙点个[](https://github.com/xaoyaoo/PyWxDump/)
|
*
|
||||||
|
*如果觉得好用的话的话,帮忙点个[](https://github.com/xaoyaoo/PyWxDump/)
|
||||||
呗**
|
呗**
|
||||||
|
|
||||||
|
|
||||||
## 二、使用方法
|
## 二、使用方法
|
||||||
|
|
||||||
### 1. 安装依赖
|
### 1. 安装依赖
|
||||||
@ -161,6 +161,8 @@ git clone https://github.com/xaoyaoo/PyWxDump.git
|
|||||||
python decrypt.py --key ******** --db_path ./decrypted/decrypted.db --out_path ./decrypted/decrypted.db
|
python decrypt.py --key ******** --db_path ./decrypted/decrypted.db --out_path ./decrypted/decrypted.db
|
||||||
```
|
```
|
||||||
|
|
||||||
|
[注]:--key为数据库密钥,--db_path为数据库路径,--out_path为解密后的数据库路径(解密后的路径目录必须存在)
|
||||||
|
|
||||||
自动根据注册表读取本地微信聊天记录文件夹,解密后保存到当前目录下的decrypted文件夹中
|
自动根据注册表读取本地微信聊天记录文件夹,解密后保存到当前目录下的decrypted文件夹中
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import argparse
|
import argparse
|
||||||
import hmac
|
import hmac
|
||||||
import hashlib
|
import hashlib
|
||||||
|
import os
|
||||||
|
|
||||||
from Cryptodome.Cipher import AES
|
from Cryptodome.Cipher import AES
|
||||||
|
|
||||||
@ -13,6 +14,13 @@ DEFAULT_ITER = 64000
|
|||||||
|
|
||||||
# 通过密钥解密数据库
|
# 通过密钥解密数据库
|
||||||
def decrypt(key, db_path, out_path):
|
def decrypt(key, db_path, out_path):
|
||||||
|
if not os.path.exists(db_path):
|
||||||
|
print("[-] db_path File not found!")
|
||||||
|
return False
|
||||||
|
if not os.path.exists(os.path.dirname(out_path)):
|
||||||
|
print("[-] out_path File Path not found!")
|
||||||
|
return False
|
||||||
|
|
||||||
password = bytes.fromhex(key.strip())
|
password = bytes.fromhex(key.strip())
|
||||||
with open(db_path, "rb") as file:
|
with open(db_path, "rb") as file:
|
||||||
blist = file.read()
|
blist = file.read()
|
||||||
@ -49,6 +57,23 @@ def decrypt(key, db_path, out_path):
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
def batch_decrypt(key, db_path, out_path):
|
||||||
|
if not os.path.exists(db_path):
|
||||||
|
print("[-] db_path File not found!")
|
||||||
|
return False
|
||||||
|
if not os.path.exists(os.path.dirname(out_path)):
|
||||||
|
print("[-] out_path File Path not found!")
|
||||||
|
return False
|
||||||
|
|
||||||
|
if os.path.isfile(db_path) and not os.path.isdir(out_path):
|
||||||
|
return decrypt(key, db_path, out_path)
|
||||||
|
if os.path.isdir(db_path) and not os.path.isfile(out_path):
|
||||||
|
for root, dirs, files in os.walk(db_path):
|
||||||
|
for file in files:
|
||||||
|
decrypt(key, os.path.join(root, file), os.path.join(out_path, "decrypted" + file))
|
||||||
|
return True
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
# 创建命令行参数解析器
|
# 创建命令行参数解析器
|
||||||
parser = argparse.ArgumentParser()
|
parser = argparse.ArgumentParser()
|
||||||
@ -69,5 +94,5 @@ if __name__ == '__main__':
|
|||||||
out_path = args.out_path
|
out_path = args.out_path
|
||||||
|
|
||||||
# 调用 decrypt 函数,并传入参数
|
# 调用 decrypt 函数,并传入参数
|
||||||
result = decrypt(key, db_path, out_path)
|
result = batch_decrypt(key, db_path, out_path)
|
||||||
print(f"{result} done!")
|
print(f"{result} done!")
|
||||||
|
Loading…
Reference in New Issue
Block a user