-
Notifications
You must be signed in to change notification settings - Fork 79
Description
本页面参考了此文档,可以作为一个更适合小白的教程指导
- Github 版本:Mythologyli/qq-nt-db
- 文档版本:NTQQ (Windows) | QQDecrypt
本文含有部分 Obsidian 的图片与 md 引用,这里暂不展示
反编译以读取登录 key
使用 IDA 等反编译工具打开验证程序
C:\Program Files\Tencent\QQNT\versions\9.9.17-30594\resources\app\wrapper.node第一次反编译时间会比较久
在 String View 中查找 sqlite3_key_v2 ,双击发现在如下汇编位置
.rdata:0000000183D406CE aNtSqlite3KeyV2 db 'nt_sqlite3_key_v2: db=%p zDb=%s',0
.rdata:0000000183D406CE ; DATA XREF: sub_182703A10+15↑o对这个位置 JumpOpXref 后发现在
.text:0000000182703A25 lea rdx, aNtSqlite3KeyV2 ; "nt_sqlite3_key_v2: db=%p zDb=%s"
# .text 地址段位置,lea 寄存器为有效地址而非内存地址,rdx 为 x64 寄存器,后面为变量名和注释按下 F5,会自动把汇编反编译成 C/C++ 函数,并在 Pseudocode-A 打开
我们在 sub_182703A25 处打个断点,此时这个 dll 我们已经注入进去了
接下来就是附着到 QQ.exe ,当发现 dll 被调用时停止程序,并获取当前的数据
我们重新打开 QQ,并打开 IDA Debug -> Attach to Process ,选择 QQ.exe
,些许等待后发现程序已经被停止了,卡在了登录界面,我们点一下继续,让它先跑起来
然后登录 QQ,此时成功在断点处停下,我们打开 Locals 就可以看到一些变量
右击变量 a3 并 Jump to ,可以获得参数值
这是一个 16 位的字符串,这是 passphrase
解密数据库
# 聊天记录数据库
C:\Users\Dao\Documents\Tencent Files\xxxxxxxxx\nt_qq\nt_db\nt_msg.db清理前 1024 位
python -c "open('nt_msg.clean.db','wb').write(open('nt_msg.db','rb').read()[1024:])"使用任意 SQLCipher 工具打开
比如:[[DB Browser for SQLite]]、[[SQLiteStudio]]、[[sqlcipher CLI]]
如果报错 file is not a database,则你的工具错了,不要用 SQLite,而是 SQLCipher,@ Issue #47 · QQBackup/qq-win-db-key
配置参考,也可以作为 sqlcipher CLI 命令
sqlcipher nt_msg.clean.db
PRAGMA key = 'xxxxxxxxxxxxxxxx';
PRAGMA cipher_page_size = 4096;
PRAGMA kdf_iter = '4000';
PRAGMA cipher_hmac_algorithm = HMAC_SHA1;
PRAGMA cipher_default_kdf_algorithm = PBKDF2_HMAC_SHA512;
PRAGMA cipher = 'aes-256-cbc';
.tables
.exit其中 cipher_hmac_algorithm 并不是 SHA1,在 2024-12 已变成了 SHA512,我因为这个错误困惑许久