Skip to main content

Pyvmess

PyPI - Version PyPI - Python Version code style - black imports - isort License - MIT

Pyvmess is a naive implementation to parse raw vmess package in Python. Note: As vmess is such a complicated protocol, it's quite hard to implement full feature decoder. There are quite a lot of cases which are covered by Pyvmess.

As this package is likely to be outdated, you can refer to vmess source code server code and client code if needed.

Table of Contents

Installation

pip install pyvmess

Usage

Let's take one challenge dieyingchongchong from qwb2022 as an example. Pyvmess can parse meta data from header and decode data from body. The following example can be found in test cases.

from uuid import UUID

import pyvmess


client_uuid = UUID("b831381d-6324-4d53-ad4f-8cda48b30811")
with open("data/client.bin", "rb") as f:
    client_data = f.read()

client_package = pyvmess.ClientVmessPackage(client_uuid, client_data)

timestamp = client_package.auth(1615528982 + 100)

client_package.decode_header()

client_package.decode_body()

print(b"".join(client_package.body_data).decode())

with open("tests/data/server.bin", "rb") as f:
    server_data = f.read()

server_package = pyvmess.ServerVmessPackage(
    client_package.response_header,
    client_package.body_iv,
    client_package.body_key,
    client_package.option,
    client_package.security,
    server_data,
)

server_package.decode_header()

server_package.decode_body()

print(b"".join(server_package.body_data).decode())

Build

Pyvmess uses hatch as the project manager. You can use hatch or any other build tools compliant with PEP517 such as build.

# hatch
hatch build
# build
python -m build

Tests

Pyvmess uses pytest for testing. You can run tests as follows.

hatch run test

License

pyvmess is distributed under the terms of the MIT license.

Release files for pyvmess 0.0.1

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

Source distribution (sdist)

Source distribution for pyvmess 0.0.1
File Size Uploaded
pyvmess-0.0.1.tar.gz 1.7 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for pyvmess 0.0.1
File Interpreter ABI Platform
pyvmess-0.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 1.7 MB

Release files / pyvmess-0.0.1.tar.gz

Download URL pyvmess-0.0.1.tar.gz
Size 1.7 MB
Tags Source
SHA-256 checksum
How to use checksums
38fbdeb12885d67e0ed857aa7feab097af58a76ea7501ca3176f55b69c644b5a
BLAKE2b-256 checksum
How to use checksums
914098e1bf3f091acc861c3c9cb65c42fb15ef22985e7afeb941427619b28181
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.13

Release files / pyvmess-0.0.1-py3-none-any.whl

Download URL pyvmess-0.0.1-py3-none-any.whl
Size 6.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6717145b29353529f85814a1daa84f8ea1e62b8f7eeadabbd3bbb89652bdb67f
BLAKE2b-256 checksum
How to use checksums
8818a66b1183bbd6b575d2d0e60c71ad00fdc55ef3a80b1ef664f857cb36da26
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.13

Release history Release notifications | RSS feed

This release

0.0.1 This release

2 release files

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