Skip to main content

wechat utils.

Project description

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()

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

wxutil-0.0.15.tar.gz (1.5 MB view details)

Uploaded Source

File details

Details for the file wxutil-0.0.15.tar.gz.

File metadata

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

File hashes

Hashes for wxutil-0.0.15.tar.gz
Algorithm Hash digest
SHA256 e32dbdc2394278cbecd50116f9f19e665ed77efe206b9555e2fe20ff57b5d6ba
MD5 0a9466e2311a9356f8364007958ba1f5
BLAKE2b-256 f1923f20e37806ca7afed2733ac8b12d8f99653fc3ce4da900b304f633a41104

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