Skip to main content

wechat database manager.

Project description

wxdb

项目介绍

wxdb是一个微信数据库管理工具,可以查询微信数据库数据,解密微信数据库文件。

安装

pip install wxdb

代码示例

查询微信数据库

from wxdb import get_wx_db

wx_db = get_wx_db()
conn = wx_db.connect(r"Msg\Multi\MSG0.db")
with conn:
    print(conn.execute("SELECT * FROM sqlite_master;").fetchall())
# 输出
# [('table', 'MSG', 'MSG', 2, 'CREATE TABLE MSG (localId INTEGER PRIMARY KEY AUTOINCREMENT,TalkerId INT DEFAULT 0,MsgSvrID INT,Type INT,SubType INT,IsSender INT,CreateTime INT,Sequence INT DEFAULT 0,StatusEx INT DEFAULT 0,FlagEx INT,Status INT,MsgServerSeq INT,MsgSequence INT,StrTalker TEXT,StrContent TEXT,DisplayContent TEXT,Reserved0 INT DEFAULT 0,Reserved1 INT DEFAULT 0,Reserved2 INT DEFAULT 0,Reserved3 INT DEFAULT 0,Reserved4 TEXT,Reserved5 TEXT,Reserved6 TEXT,CompressContent BLOB,BytesExtra BLOB,BytesTrans BLOB)'), ('table', 'sqlite_sequence', 'sqlite_sequence', 3, 'CREATE TABLE sqlite_sequence(name,seq)'), ('table', 'MSGTrans', 'MSGTrans', 4, 'CREATE TABLE MSGTrans(msgLocalId INTEGER PRIMARY KEY, talkerId INT)'), ('index', 'talkerIDIdx', 'MSGTrans', 5, 'CREATE INDEX talkerIDIdx ON MSGTrans(talkerId)'), ('index', 'MsgTalkerIdSeqIndex', 'MSG', 6, 'CREATE INDEX MsgTalkerIdSeqIndex ON MSG(talkerId,sequence DESC)'), ('index', 'MsgTalkerIdTypeSeqIndex', 'MSG', 7, 'CREATE INDEX MsgTalkerIdTypeSeqIndex ON MSG(talkerId,type,sequence DESC)'), ('index', 'SvrIdIndex', 'MSG', 8, 'CREATE INDEX SvrIdIndex ON MSG(MsgSvrID)'), ('table', 'Name2ID', 'Name2ID', 9, 'CREATE TABLE Name2ID(UsrName TEXT PRIMARY KEY)'), ('index', 'sqlite_autoindex_Name2ID_1', 'Name2ID', 10, None), ('table', 'DBInfo', 'DBInfo', 11, 'CREATE TABLE DBInfo (\t\t\t\t\t\t\ttableIndex INTEGER PRIMARY KEY,\t\t\t\t\t\t\ttableVersion INTERGER,\t\t\t\t\t\t\ttableDesc TEXT)'), ('index', 'versionIdx', 'DBInfo', 12, 'CREATE INDEX versionIdx ON DBInfo(tableIndex)')]

解密微信数据库文件

import os

from wxdb import decrypt_db_file_v3, decrypt_db_file_v4, get_wx_info

decrypt_db_file = decrypt_db_file_v3

wx_info = get_wx_info()

with open("MSG0.db", "wb") as f:
    data = decrypt_db_file(
        path=os.path.join(wx_info["data_dir"], r"Msg\Multi\MSG0.db"),
        pkey=wx_info["key"]
    )
    f.write(data)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

wxdb-0.0.4.tar.gz (1.0 MB view details)

Uploaded Source

File details

Details for the file wxdb-0.0.4.tar.gz.

File metadata

  • Download URL: wxdb-0.0.4.tar.gz
  • Upload date:
  • Size: 1.0 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for wxdb-0.0.4.tar.gz
Algorithm Hash digest
SHA256 5de0b993e48d2f6784066c004de471f934180c1c9a9564b39341d5d2d4bd434d
MD5 7ffcf0857a34bb5100b9871616e19af3
BLAKE2b-256 8cc9d8f5c5f65cd6647d4dec708bd0f3df97cedf474d56ea60e4b80dfb06d7d9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page