Pyraph
The Luraph of Python. Extreme Python obfuscation engine with custom VM virtualization, multi-layer encryption, and native compilation.
Installation
pip install pyraph
Usage
Protect a single .py file (outputs obfuscated .py)
pyraph app.py
pyraph app.py -o protected.py --vm-layers 3
pyraph app.py --one-liner
Protect a folder → native binary (.exe / ELF)
pyraph ./my_project -o ./dist
Options
| Flag | Description |
|---|---|
-o, --output |
Output path |
--vm-layers N |
Number of VM virtualization layers (default: 3) |
--one-liner |
Compress output into a single line |
--no-anti-debug |
Disable anti-debug protections |
--no-integrity |
Disable integrity checks |
How It Works
Pyraph applies multiple protection layers that make reverse engineering extremely difficult:
.py Mode (single file)
- MultiVirtual Engine — Code is fragmented into N micro-chunks. Each chunk is compiled to bytecode, marshalled, then encrypted with its own unique VM opcode table. Fake decoy chunks are mixed in.
- Multi-round Encryption — Each fragment is encrypted with 3 rounds of SHA256-derived XOR keys, bound to an irremovable watermark.
- Polymorphic Output — Every protection run generates completely different output: different variable names, different opcode mappings, different keys, different structure. No two outputs are alike.
- Anti-Debug — Continuous watchdog thread monitoring
sys.settrace/sys.getprofile, import hooking blocker,prctl(PR_SET_DUMPABLE, 0)on Linux,SetProcessMitigationPolicyon Windows. - Anti-Dump — GC disabled during execution, code object metadata stripped,
marshal.loadscalled via C API (ctypes.pythonapi.PyMarshal_ReadObjectFromString) to bypass Python-level hooks. - Junk Code Injection — Realistic-looking fake decrypt functions, hash checks, XOR loops, and dispatch tables that are indistinguishable from real protection logic.
Native Mode (folder → executable)
- Cython/C Compilation — All .py files compiled to C with encrypted source embedding.
- Anti-Trace —
sys.settrace(None)called at C level immediately afterPy_Initialize(),PYTHONPATHnuked to preventsitecustomize.pyinjection. - Anti-Ptrace —
ptrace(PTRACE_TRACEME),prctl(PR_SET_DUMPABLE, 0), TracerPid checking, timing checks. - String Obfuscation — All sensitive strings in the binary are assembled from char arrays at runtime, invisible to
stringscommand. - C-level Mutation — Junk code injected into compiled C functions.
- Memory Wipe — Source decrypted in memory → executed →
memset(0)→ freed.
Output Example
Input (readable Python):
def hello(name):
return f"Hello, {name}!"
print(hello("World"))
Output (protected):
import hashlib as _pyraph_h
_285000=__import__('base64').b85decode('^N*y~dZDPE0<<XyA^')
_513918=bytes.fromhex('a3f6d6b70ac9')+bytes([136, 232, 51, 154, 25, 41, 18])
_517821=bytes(_285000[_i]^_513918[_i] for _i in range(len(_285000)))
del _285000,_513918
_919520=_pyraph_h.sha256(_517821).digest()
if len(_919520)!=32:__import__('os')._exit(1)
del _pyraph_h,_517821,_919520
import sys as _sys
import os as _os
import threading as _th
...
exec(__import__('zlib').decompress(__import__('base64').b85decode(_a+_b+_c)).decode())
Compatibility
- Python 3.9+
- Linux, macOS, Windows
- Native mode requires
gccand Python dev headers
License
Proprietary. Closed source.
Release files for pyraph 1.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pyraph-1.1.0.tar.gz | 36.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pyraph-1.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 77.0 kB
Release files / pyraph-1.1.0.tar.gz
| Download URL | pyraph-1.1.0.tar.gz |
|---|---|
| Size | 36.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1f61babbe4f3d3b0cab0a9efbe7358c7aee60aa431ec60e0451280657de1958d
|
|
BLAKE2b-256 checksum How to use checksums |
730cee79e92b67554032c2f1f3f249539586867b445c78a5b173c806023e3967
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.1
|
Release files / pyraph-1.1.0-py3-none-any.whl
| Download URL | pyraph-1.1.0-py3-none-any.whl |
|---|---|
| Size | 40.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b13de1f658060375b0b37b0fc14a0a80e6ad4b72bd123f477bbd36c5b960aa38
|
|
BLAKE2b-256 checksum How to use checksums |
70b6a4afc84b4481b6d6ee68f6df9ef29a201b20d21cf45f9c1335a87106a8f2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.1
|