PyInstaller 6 Removed --key & PyLingual Recovers 94% of Python .pyc Code: Building a 1.08s Rust + C Runtime Vault
If you ship a commercial Python CLI, desktop application, quantitative trading bot, or on-prem FastAPI appliance using pyinstaller --onefile, anyone with your executable can reconstruct ~94% of your original Python sourc
If you ship a commercial Python CLI, desktop application, quantitative trading bot, or on-prem FastAPI appliance using pyinstaller --onefile, anyone with your executable can reconstruct ~94% of your original Python source code, docstrings, and LLM system prompts in under 4 seconds.
Even worse:
-
PyInstaller 6.0+ permanently removed
--keyencryption (unrecognized arguments: --key) because itstinyaeskey sat in plaintext right insidepyimod00_crypto_key. -
Legacy obfuscators break constantly on Python 3.12–3.14, choke on Docker/GitHub Actions hardware sockets (
ERROR out of license/this license is not for this machine), and add 30–40% runtime overhead on tight loops. -
Cython / Nuitka take 10–25 minutes to link C++ templates on medium codebases and still export plaintext
PyObjectattribute/constant tables that Ghidra + LLM plugins (GhidraMCP) turn back into readable Python in minutes.
We built PyKevlar (pip install pykevlar) — a native Rust bundler + CPython 3.12–3.14 _PyObject_Vectorcall runtime vault — to solve both speed and adversarial reverse-engineering in one single binary.
1. Test Your Own Repo's Exposure in 50ms (Free, Zero Key Required)
Before changing anything in your build pipeline, you can run PyKevlar's local static exposure auditor on any Python project:
pip install -U pykevlar
pykevlar audit .
In ~50ms, pykevlar audit . scans your .py ASTs, PyInstaller .spec files, and Dockerfiles to report:
- How many function/class code objects (
co_code,co_consts,co_varnames)pyinstxtractor-ng+PyLingualwill recover verbatim - Exposed LLM system prompts, SQL queries, and proprietary pricing/signal constants
- Legacy
pyinstaller --keyor fragile CI obfuscator configs
(Prefer testing in the browser? Paste a pyproject.toml, Dockerfile, or .spec into our client-side *Python Exposure Scanner*).
2. How PyKevlar's 6-Layer Rust + C Vault Works
Instead of encrypting .pyc files only on disk and leaving decrypted module bytecode sitting in RAM, PyKevlar combines six layers in a single Rust + C pass:
-
SPZ2 Encrypted Archive + Zero
MEIPASSDisk Extraction: Standard extractors (pyinstxtractor,binwalk) find zeroMEImagic bytes and zero.pycheaders. -
Per-Function ChaCha20-Poly1305 Vectorcall Vault: Protected functions intercept CPython's C
_PyObject_Vectorcallslot, decrypt bytecode on the C stack with an ephemeral keystream, execute, and explicitly zeroize (memset_s) the buffer immediately on return. -
Native C Transpilation (
--enable-bcc): Sensitive math, licensing checks, and scoring logic transpile straight to stripped ARM64 / x86_64 machine code — leaving 0 bytes of Python bytecode to decompile. -
Anti-LLM Binary Stealth (
--anti-llm+--mix-str): Defeats AI-assisted Ghidra/IDA decompilers (GhidraMCP) using masked constant pools, opaque-predicate control-flow flattening, and decoy identifier graphs. -
Zero-Docker Mac → Linux Cross-Compilation: Build standalone
glibc 2.28+Linuxx86_64/arm64ELF64 binaries directly from an Apple Silicon MacBook in 1.63s. -
6ms Ed25519 Hardware-Locked Client Keys (
--outer): Distribute binaries to enterprise customers or bot subscribers with offline hardware-bound, expiringruntime.rkeyfiles — and run unlimited CI/Docker builds via a single statelessPYKEVLAR_LICENSEenv var.
3. Real-World Benchmarks (Apple M-Series, Python 3.12, 802 Modules)
| Metric | PyInstaller 6.x | Nuitka (--onefile) |
Legacy Obfuscator + Bundler | PyKevlar 2.0 |
|---|---|---|---|---|
Plain Onefile Build (--no-armor, Free) |
20.73s | 840s+ | — | 0.72s (28.8× faster) |
| Full Encrypted + C Vault Build | Removed (--key) |
Partial (symbols visible) | 26.40s | 1.08s |
| Hot-Loop Runtime Overhead | 1.00× | 0.92× | 1.37× (+37% slower) | 1.00× (Zero overhead) |
pyinstxtractor + PyLingual Recovery |
~94% source recovered | Strings/attrs visible | Version-fragile | 0% (0 .pyc headers) |
| GitHub Actions / Docker CI | Manual | Slow C++ cache | Socket / rate-limit errors | Stateless PYKEVLAR_LICENSE |
4. Built-In MCP Server for Claude Code, Cursor & Windsurf (pykevlar-mcp)
If you build with Claude Code, Cursor, Windsurf, or Codex, pykevlar ships a zero-dependency stdio MCP server right inside the PyPI package:
pip install -U pykevlar
claude mcp add pykevlar -- pykevlar-mcp
Once connected, your coding agent gets four native tools (audit_python_exposure, bundle_python_free, build_protected_release, and check_license_and_machine_id) so you can simply ask Claude:
"Audit this FastAPI repo for bytecode/prompt leaks and compile a hardened single-file Linux x86_64 release binary."
Try It Free (Plus 25% Off Launch Promo for Pro & Team)
-
Basic (
$0Forever, Zero Registration): Plain--no-armor0.72s Rust bundler (28.8×faster than PyInstaller),pykevlar audit .,pykevlar bench, andpykevlar-mcp. -
Pro & Team (Full ChaCha20 Vault + Native C
--enable-bcc+--anti-llm+ Hardware Keys + Offline CI): Starts at $39/yr ($29.25/yr for Year 1 with launch codeLAUNCH25, auto-applied on checkout, backed by a 14-day compatibility money-back guarantee).
Links to explore:
-
PyPI:
pip install pykevlar(pypi.org/project/pykevlar) - Interactive Exposure Scanner: https://pykevlar.com/scanner
- Architecture, Docs & Benchmarks: https://pykevlar.com/pyarmor-alternative
Happy to answer any deep-dive questions on CPython 3.12–3.14 _PyObject_Vectorcall internals, Mach-O/ELF single-binary linking, or Ghidra + LLM decompiler countermeasures in the comments!
Originally published by Dev.to Security. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.