Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

不用删除文件头,直接读取数据库的SQLite VFS扩展 #55

Open
artiga033 opened this issue Feb 13, 2025 · 0 comments
Open

不用删除文件头,直接读取数据库的SQLite VFS扩展 #55

artiga033 opened this issue Feb 13, 2025 · 0 comments

Comments

@artiga033
Copy link

由于db文件前面有1KB的文件头,导致通常的SQLite程序都无法识别,必须手动删除这些无用文件头。这导致一方面每次数据库变动都得为了这1KB的文件头而重新拆出一个非常大的数据库文件,也不能直接读写QQ数据目录下的db文件。

因此写了一个SQLite VFS扩展,检测到NTQQ数据库特征时自动追加一个1KB的偏移量。

命令行的用法已经在上面的链接里了,另外经测试 Windows 上的 DB Browser for SQLCipher 也可以使用。具体:

DBBrowser for SQLCipher (Windows) 作法
  1. 这个release下载sqlite_ext_ntqq_db-x86_64-pc-windows-msvc.zip,解压得到里面的dll文件,注意不要修改dll的文件名

  2. 打开 DB Browser for SQLCipher,选择文件->新建内存数据库,之后的弹窗直接关掉,然后点击工具->加载扩展,选择第1步中的dll文件。
    Image

  3. 提示“扩展已成功加载”,此时再打开数据库,直接选择 NTQQ 的.db文件,然后正常输入密码、加密方式即可直接打开数据库。
    Image

PS:如果不想每次都手动选择加载扩展,也可以到编辑->首选项->扩展 中,在“选择每个数据库要加载的扩展”一栏添加该DLL。不过要注意的是,即便这样也要先新建内存数据库,再去打开文件,因为 sqlbrowser 的设计是在连接建立后才加载扩展,因此必须先建一个memdb来触发扩展加载。

PS2:不建议处理正常数据库时也开着这个扩展,虽然会尽可能fallback到默认VFS,不过由于用于探测是否是QQ数据库的方法很原始,存在一定出错的可能。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant