Skip to main content

wxutil

微信3.x图片解密

import pathlib
from wxutil.dat import find_key, decrypt_dat

xor_key, aes_key = find_key(pathlib.Path(r"C:\Users\<username>\Documents\WeChat Files\<wxid>"), version=3)

data = decrypt_dat(
    r"C:\Users\<username>\Documents\WeChat Files\<wxid>\FileStorage\Image\2024-11\00f0395964ec76d2406f15cc69c4e566.dat",
    xor_key)
with open("00f0395964ec76d2406f15cc69c4e566.png", "wb") as f:
    f.write(data)

微信3.x消息监听

from wxutil.db.v3 import WeChatDB, ALL_MESSAGE

wechat_db = WeChatDB()


@wechat_db.handle(ALL_MESSAGE)
def _(wechat_db, event):
    print(event)


wechat_db.run()

微信4.x消息监听

from wxutil.db.v4 import WeChatDB, ALL_MESSAGE
from wxutil.utils import get_wechat4_key
import psutil


def get_wechat_pid():
    for proc in psutil.process_iter(["pid", "name"]):
        try:
            if proc.info["name"].lower() == "weixin.exe":
                return proc.info["pid"]
        except (psutil.NoSuchProcess, psutil.AccessDenied, psutil.ZombieProcess):
            pass
    return None


key = get_wechat4_key()

pid = get_wechat_pid()
if pid is None:
    raise Exception("未找到微信进程")

wechat_db = WeChatDB(
    pid=pid,
    key=key,
    data_dir=r"C:\Users\<username>\xwechat_files\<wxid>"
)


@wechat_db.handle(ALL_MESSAGE)
def _(wechat_db, event):
    print(event)


wechat_db.run()

Release files for wxutil 0.0.15

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for wxutil 0.0.15
File Size Uploaded
wxutil-0.0.15.tar.gz 1.5 MB Details

Release files / wxutil-0.0.15.tar.gz

Download URL wxutil-0.0.15.tar.gz
Size 1.5 MB
Tags Source
SHA-256 checksum
How to use checksums
e32dbdc2394278cbecd50116f9f19e665ed77efe206b9555e2fe20ff57b5d6ba
BLAKE2b-256 checksum
How to use checksums
f1923f20e37806ca7afed2733ac8b12d8f99653fc3ce4da900b304f633a41104
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.9

Release history Release notifications | RSS feed

This release

0.0.15 This release

1 release file

0.0.14

1 release file

0.0.13

1 release file

0.0.12

1 release file

0.0.11

1 release file

0.0.10

1 release file

0.0.9

1 release file

0.0.8

1 release file

0.0.7

1 release file

0.0.6

1 release file

0.0.5

1 release file

0.0.4

1 release file

0.0.3

1 release file

0.0.2

1 release file

0.0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page