瑞星 发表于 2024-10-15 01:58:37

利用pysqlcipher3处理微信数据库

以下内容可在 Mac 的 M1 系列电脑上运行。
安装依赖

1
2
brew install sqlcipher
pip install rotki-pysqlcipher3
查询记载

参考这里,写 Python 代码。
[img=1
2
00,1
2
00]https://i-blog.csdnimg.cn/direct/bf0ba7e290bb4e20ac285ce8689e131f.png
[img=1
2
00,1
2
00]https://i-blog.csdnimg.cn/direct/b676dc54726f451992236f8e9d210c07.png
Key,为上一篇获取到的 key 信息。Chat_table 为上面数据库查到的表名,可以在微信聊天对话框中,任意选择一张图片,检察原文件,打开的文件夹 ID 即为 Table 的 ID。
1
2
345678910111
2
1314151617181920 import pandas as pd
import pysqlcipher3.dbapi2 as sqlite

key = '0x68*********************************'
chat_table = 'Chat_******************************'

db= sqlite.connect('WeChatDB/msg_1.db')
db_cursor = db.cursor()
db_cursor.execute(f"PRAGMA key='x''{key}''';")
db_cursor.execute("PRAGMA cipher_compatibility=3;")
db_cursor.execute("PRAGMA cipher_page_size=1024;")
db_cursor.execute("PRAGMA kdf_iter=64000;")
db_cursor.execute("PRAGMA cipher_hmac_algorithm=HMAC_SHA1;")
db_cursor.execute("PRAGMA cipher_kdf_algorithm=PBKDF2_HMAC_SHA1;")


resoverall = db_cursor.execute(f"SELECT * FROM {chat_table};")
data_list = resoverall.fetchall()
table_df = pd.DataFrame(data_list)
table_df.columns = for i in resoverall.description]
这样,就可以直接在步伐中导出 table_df 内容了。
Ref:
python - Issue in installing pysqlcipher3 - Stack Overflow
GitHub - rotki/pysqlcipher3: Configuration to build and publish pysqlcipher3 with wheels for rotki
【个人开辟】通过python导出微信聊天记载_如何利用python导出企业微信的聊天内容-CSDN博客

免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao1
2
3.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。
页: [1]
查看完整版本: 利用pysqlcipher3处理微信数据库