VMP — Virtual Machine Protection for Python. Code obfuscator with register-based VM opcodes, hidden imports, anti-debug, and more.
Project description
VMP — Virtual Machine Protection for Python
pip install vmp-protector
Code protector similar to pyarmor, but fully dependent on the PyPI package — no standalone runtime folders.
Quick Start
Install
pip install vmp-protector
Build (obfuscate) a file
vmp build input.py
vmp build input.py -o output.py --level 4
Use in code
import vmp
from vmp import *
# Register opcodes
mov(r1, 42)
add(r1, r2)
cmp(r1, 10)
jne(label("skip"))
# Hidden imports — no module name in source
tk = getuid("0x00004823F5", "0x000384F7") # -> tkinter
os_mod = getuid("0x0000112233", "0x0000445566") # -> os
# Generate UIDs for any module
from vmp.getuid import generate_uids, register_uid
uids = generate_uids("my_module")
register_uid(uids, "my_module")
# String vault
vault = StringVault(secret="key")
vault.set("api", "sk-123")
vault.get("api")
# Anti-debug decorator
@anti_debug
def my_func():
return 42
# License system
key = generate_license(secret="my-secret", user="alice", days=30)
check_license(key, secret="my-secret") # True
# Runtime shield
s = shield(anti_debug=True, anti_vm=True)
# Code protection decorator
@protect(level=3)
def secret_algo():
return "hidden"
# JIT obfuscation
@jit_obfuscate
def another():
pass
# Integrity seal
@seal_code
def sealed():
return 1
verify_seal(sealed) # True
# Environment check
report = check_environment()
Protection Levels (vmp build)
| Level | Features |
|---|---|
| 1 | String encryption + variable renaming |
| 2 | + Control flow flattening + dead code injection |
| 3 | + Opaque predicates + anti-debug + watermark |
| 4 | Maximum — all of the above + extra junk code |
How It Works
Unlike pyarmor which creates a dist/ folder with a standalone runtime, VMP:
- Obfuscates your
.pyfile in-place - Adds
import vmp._runtime as _vmp_rtat the top - Encrypts all string literals → decrypted at runtime via
_vmp_rt.ds() - Resolves
getuid()calls at runtime via_vmp_rt.gui() - Requires
pip install vmp-protectorto run the protected file
No extra folders. No standalone runtime. Just the obfuscated .py + the PyPI package.
CLI Commands
vmp build input.py # Build with default level 3
vmp build input.py -o out.py -l 4 # Maximum protection
vmp build input.py --fingerprint me # Custom watermark
vmp info # Show VMP info
vmp uid numpy # Generate UIDs for numpy
vmp check # Check for VM/sandbox
vmp check -v # Verbose environment report
All Features
- Register-based VM — 16 general-purpose registers + PC/SP/FLAGS, 28 opcodes
- Hidden imports —
getuid()resolves modules by hex UID, no name in source - String encryption — XOR + zlib + base64, per-file key
- Anti-debug — IsDebuggerPresent, TracerPid, timing checks, background monitor
- Anti-tamper — File checksum verification, continuous monitoring
- Control flow obfuscation — Flattening, dead code, opaque predicates
- String vault — Secure key-value string storage with encryption
- License system — HMAC-signed license keys with expiry
- Code integrity — Seal functions, detect in-memory patching
- JIT obfuscation — Runtime wrapper generation with randomized names
- Stealth imports — Hide module names from
sys.modules - Anti-VM/sandbox — MAC prefix checks, process detection, DMI data
- Watermarking — Zero-width character fingerprints in source
- Runtime shield — One-call activation of multiple protections
PyPI Upload
pip install build twine
python -m build
twine upload dist/*
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file vmp_protector-1.0.0.tar.gz.
File metadata
- Download URL: vmp_protector-1.0.0.tar.gz
- Upload date:
- Size: 33.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d84296f254e848ead36afd47eec9754fb90697f213f29d8c381448166f077b52
|
|
| MD5 |
8b3a31035a986135ae74267d1f7c1884
|
|
| BLAKE2b-256 |
98f52db1babc7b5f11696a5ca49db29809c65bd16547747f63854871fe25e4a8
|
File details
Details for the file vmp_protector-1.0.0-py3-none-any.whl.
File metadata
- Download URL: vmp_protector-1.0.0-py3-none-any.whl
- Upload date:
- Size: 43.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
71cf1670820caf83727648953cce4043acc11fd9402cf83ed54f48673ace4184
|
|
| MD5 |
3252103b6d9a5c159a8bb459816c3c52
|
|
| BLAKE2b-256 |
7909d1e59c39bc7e5ffc6d13e2998e773678f0a5d5b412ad43d4b08fd063ef4f
|