pyobfus
AST-based Python obfuscator with reverse stack-trace mapping — obfuscate before shipping and keep production tracebacks AI-debuggable. MCP + VS Code.
Install / Use
claude mcp add zhurong2020 -- npx -y github:zhurong2020/pyobfusIf the server publishes to npm under a different name, use that package instead — check the repo README.
MCP Server
Model Context Protocol server
Quality Score
Category
SecuritySupported Platforms
Our assessment of pyobfus
pyobfus scores 84/100 on our quality scale, 68th of 182 Security skills we index (top 38%).
Its MCP Server is 35 KB long, well organised into 90 sections with 18 code examples: a thorough specification that gives an agent plenty to work with.
It has 10 GitHub stars, so there is little community track record yet; judge it on its content.
Maintenance, license and trust
- The repository was last updated today, so pyobfus is actively maintained.
- Our last check on 2026-08-14 found the source still online.
- It is released under the Apache-2.0 license, a permissive license that allows use, modification and commercial use with attribution.
- Its trust signals score 97/100, with no cautions. These come from repository metadata, not a code audit — read the skill file before letting an agent act on it.
Safety scan
No issues foundOur scan of the first 100 KB of the file found no instruction hijacking, hidden characters, credential access, data exfiltration or destructive commands.
Automated pattern scan on 2026-09-24. It catches known dangerous patterns, not every risk — read a skill before letting an agent act on it.
pyobfus compared with similar skills
All 4 of these similar skills score higher than pyobfus; compare them before choosing.
| Skill | Score | Stars | Updated | Format |
|---|---|---|---|---|
| pyobfus (this skill)by zhurong2020 | 84 | 10 | today | MCP Server |
| Agent-Reachby Panniantong | 100 | 85.2k | 8d ago | CLAUDE.md |
| headroomby headroomlabs-ai | 100 | 73.7k | today | CLAUDE.md |
| rufloby ruvnet | 100 | 73.2k | today | CLAUDE.md |
| CowAgentby zhayujie | 100 | 47.1k | today | CLAUDE.md |
Frequently asked questions
- How do I install pyobfus?
- Run
claude mcp add zhurong2020 -- npx -y github:zhurong2020/pyobfus. The install tabs above show the steps for each supported agent. - Which AI agents does pyobfus work with?
- It is written for Claude Code, Claude Desktop, Cursor and GitHub Copilot, as a MCP Server file. Other agents that read the same format can often use it too.
- Is pyobfus safe to use?
- Our scan of the first 100 KB of the file found no instruction hijacking, hidden characters, credential access, data exfiltration or destructive commands. It is Apache-2.0-licensed and scores 97/100 on trust signals. Skills are instructions an agent will follow, so read the file before installing it and do not approve commands you do not understand.
- Is pyobfus still maintained?
- The repository was last updated today, so pyobfus is actively maintained.
Skill content
View source on GitHubpyobfus — the Python obfuscator
<p align="center"> <img src="https://raw.githubusercontent.com/zhurong2020/pyobfus/main/docs/assets/logo.jpeg" alt="pyobfus Logo" width="200"> </p>pyobfus (pronounced as "Python obfuscator") is a modern, AST-based python-obfuscator / code-obfuscator with framework-aware presets, reverse stack-trace mapping for AI-assisted debugging, and a machine-readable JSON CLI designed for Claude Code, Cursor, Codex, and MCP agents. A transparent, open-source alternative to PyArmor.
A Python code obfuscator built with AST-based transformations. Supports Python 3.9 through 3.14. Provides reliable name mangling, string encoding, control-flow flattening, AES-256 string encryption, and — unique to pyobfus — a reverse-mapping workflow that lets you (or your AI coding assistant) debug obfuscated stack traces without giving up the protection.
🔒 Pro Edition available — 6 patent-targeted protection mechanisms (Selective Opacity, forensic watermarking, Runtime String Vault, and more) layered on top of the free AST obfuscator, $45 one-time, no subscription. See Pro Edition below.
🔧 What's new in v0.5.13 —
--validate-configno longer false-warns onpreset(which--inititself writes into every config) or any Pro field added since v0.5.0; the validator's schema is now derived live fromObfuscationConfig's actual dataclass fields instead of a hand-maintained list that had silently drifted stale. v0.5.12 addedpyobfus-trial status --json/pyobfus-license status --jsonstructured JSON (the VS Code extension's status bar reads these). Full details in the CHANGELOG; see Pro Edition below.
🔌 Companion MCP server: pyobfus-mcp
This repository ships two installable packages:
| Package | What it is | Install |
|---|---|---|
| pyobfus | The Python obfuscator (CLI + library). | pip install pyobfus |
| pyobfus-mcp | A Model Context Protocol (MCP) server that exposes pyobfus's tools to AI coding agents. | uvx pyobfus-mcp (zero-install) or pip install pyobfus-mcp |
The MCP server lives in pyobfus_mcp/ and is built on the official Model Context Protocol Python SDK (FastMCP). It registers eight MCP tools so Claude Desktop, Claude Code, Cursor, Windsurf, Zed, and Codex can call pyobfus directly from agent conversations — no shelling out:
| MCP tool | Implementation | Purpose |
|---|---|---|
| protect_project | pyobfus_mcp/tools.py | One-call, self-verifying pipeline: scan → preset → obfuscate → byte-compile + import-smoke-test the output → return verified: true/false. The agent reports a green check instead of hoping the transform didn't break anything |
| check_obfuscation_risks | pyobfus_mcp/tools.py | Pre-flight risk scan (eval/exec, dynamic attribute, framework reflection) |
| generate_pyobfus_config | pyobfus_mcp/tools.py | Auto-detect framework → write a working pyobfus.yaml |
| unmap_stack_trace | pyobfus_mcp/tools.py | Reverse obfuscated identifiers in a production stack trace |
| list_presets | pyobfus_mcp/tools.py | Enumerate community / framework / Pro presets |
| explain_preset | pyobfus_mcp/tools.py | Describe what a named preset changes |
| recommend_tier | pyobfus_mcp/tools.py | Analyze a project and recommend community vs Pro tier, with reasoning |
| start_pro_trial | pyobfus_mcp/tools.py | Return structured guidance for starting the 5-day Pro trial |
The server is registered in the official MCP Registry under io.github.zhurong2020/pyobfus-mcp. The transport is stdio. See pyobfus_mcp/README.md for per-client configuration snippets.
🧩 Claude Code skill / plugin
This repo is also a Claude Code plugin marketplace. The pyobfus-protect skill teaches an agent the full "protect Python before shipping — obfuscate and verify it still runs" workflow (MCP-first, CLI fallback):
/plugin marketplace add zhurong2020/pyobfus
/plugin install pyobfus@pyobfus
See skills/ for the skill and install details. (This is distinct from templates/ai-integration/, which are copy-in rule files for your project.)
🧑💻 VS Code extension
pyobfus is also on the VS Code Marketplace (publisher zhurong2020) — the first obfuscation-focused extension in this category, since no competitor (PyArmor, Nuitka, Sourcedefender) has one. Inline obfuscation-risk diagnostics (pyobfus --check findings rendered via VS Code's native DiagnosticCollection API — squiggles + Problems panel, no separate linter to configure), a "Reverse Stack Trace" command, a status bar item showing your current tier with a one-click menu (Check Workspace / Generate Config / Start Trial / Unlock Pro), a "Generate pyobfus.yaml" command, and right-click "Obfuscate with pyobfus" from the Explorer or editor. Source and design rationale in vscode-extension/ and docs/VSCODE_EXTENSION_PLAN.md.
🤖 AI-native features
pyobfus --check src/— pre-flight risk scan: detectseval/exec, dynamic attribute access, and framework reflection points before you obfuscate. JSON output with anai_hinttelling your AI assistant what to run next.pyobfus --init src/— zero-config onboarding: scans the project, detects FastAPI/Django/Pydantic/Click/SQLAlchemy, and writes a ready-to-usepyobfus.yaml.pyobfus --unmap --trace error.log --mapping mapping.json— reverse obfuscated identifiers in a production stack trace so you can debug (or hand the trace to an AI assistant) without reversing the obfuscation itself.pyobfus … --save-mapping mapping.json --trace-marker— stamp each obfuscated file with a# pyobfus:obfuscatedheader (id + mapping filename + the exact--unmapcommand) so an AI agent that lands in an obfuscated file from a traceback immediately knows it's pyobfus output and how to reverse the names.pyobfus … --provenance-manifest provenance.json— write a local JSON manifest (obfuscated files, config hash, pyobfus version, mapping digest, and a self-consistency integrity digest — not a cryptographic signature) for offline build provenance.- Framework-aware presets —
--preset fastapi | django | flask | pydantic | click | sqlalchemy | mlwith built-in exclusions for dispatch methods, decorators, ORM fields, migrations, model-serving wrappers, and dependency-injection parameters. - Global
--json— every CLI mode (obfuscate,--check,--unmap,--init) emits the same structured schema with anai_hintfield, ready for Claude Code, Cursor, Windsurf, and MCP servers to consume.
Features
✅ Free Edition
The following features are fully implemented and available in the current version:
-
Cross-File Obfuscation: Consistent name obfuscation across multiple files
- Automatic import statement rewriting
__all__list updates with obfuscated names- Global symbol table with collision detection
- Two-phase obfuscation pipeline (Scan → Transform)
- Preview mode with
--dry-runflag
-
Name Mangling: Rename variables, functions, classes, and class attributes to obfuscated names (I0, I1, I2...)
-
Comment Removal: Strip comments and docstrings
-
String Encoding: Base64 encoding for string literals with automatic decoder injection
-
Parameter Preservation: Preserve function parameter names for keyword argument compatibility (
--preserve-param-names) -
Multi-file Support: Obfuscate entire projects with preserved import relationships
-
File Filtering: Exclude files using glob patterns (test files, config files, etc.)
-
Configuration Files: YAML-based configuration for repeatable builds
-
Selective Obfuscation: Preserve specific names (builtins, magic methods, custom exclusions)
-
Configuration Presets:
--preset safe | balanced | aggressivefor quick obfuscation-strength tradeoffs, plus framework-aware presets —--preset fastapi | django | flask | pydantic | click | sqlalchemy | ml— with built-in exclusions for dispatch methods, decorators, ORM fields, migrations, and dependency-injection parameters.--list-presetsshows them all -
Pre-flight Risk Scanning (
--check): detectseval/exec, dynamic attribute access, and framework reflection points before you obfuscate -
Reverse Stack-Trace Mapping (
--unmap): reverse obfuscated identifiers in a production stack trace, so you (or an AI coding assistant) can debug without un-obfuscating the shipped code -
Build Provenance (
--provenance-manifest, v0.5.5): local JSON manifest of an obfuscation run — output file hashes, config hash, pyobfus version, mapping digest — for offline build provenance, no network calls
🔒 Pro Edition
The following advanced features are available with a Pro license:
-
String Encryption
- AES-256 encryption for strings
- Runtime decryption with injected decoder
- Automatic key generation
-
Anti-Debugging
- Debugger detection checks injected into functions
- Four detection methods (v0.5.11):
sys.gettrace()(Python-level tracers/debuggers), TracerPid via/proc/self/status(native debuggers on Linux — gdb, strace), WinAPIIsDebuggerPresent()(native debuggers on Windows), and a timing-skew check (catches single-stepping regardless of platform) - Default OFF to protect AI-debuggability; opt-in via
--anti-debug - Heuristic, not a security boundary — documented in the CHANGELOG
-
Control Flow Flattening
- State machine transformation for if/else/elif
- For/while loop flattening
- Nested structure support
- CLI:
--control-flow
-
Dead Code Injection
- Insertion of unreachable code paths
- Four strategies: after-return, false branches, opaque predicates, decoy functions
- CLI:
--dead-code
-
License Embedding
- Embed expiration dates:
--expire 2025-12-31 - Machine binding:
--bind-machine - Run count limits:
--max-runs 100 - Offline verification - no external dependencies
- Embed expiration dates:
-
Runtime Policy (v0.5.9)
- Refuse to import outside a build-time platform allowlist — a pure-Python generalization of PyArmor BCC's platform restrictions
- OS allowlis
Truncated for display — read the full file on GitHub.
Related Skills
Agent-Reach
85.2kGive your AI agent eyes to see the entire internet. Read & search Twitter, Reddit, YouTube, GitHub, Bilibili, XiaoHongShu — one CLI, zero API fees.
headroom
73.7kCompress tool outputs, logs, files, and RAG chunks before they reach the LLM. 20% fewer tokens for coding agents, 60-95% fewer tokens for JSON, same answers. Library, proxy, MCP server.
ruflo
73.2k🌊 The original agent harness. Deploy intelligent multi-player swarms, coordinate autonomous workflows, and build conversational AI systems. Features adaptive memory, self-learning intelligence, federation, vector RAG integration, and native Claude Code / Codex / Hermes and many more Integrated
CowAgent
47.1kOpen-source super AI assistant & Agent Harness. Plans tasks, runs tools and skills, self-evolves with memory and knowledge. Multi-agent, multi-model, multi-channel. Lightweight, extensible, one-line install.
Languages
Trust signals
From repository metadata: license, adoption, age and documentation. Not a code audit — see the Safety scan above for what the skill file itself contains.
