pyRO
Shield and lock your Python source code in a vault, forever.
pyRO is a VS Code extension that obfuscates your Python source code — making it extremely difficult to read or reverse-engineer while keeping it fully functional.
Features
| Feature |
Description |
| Rename Identifiers |
Variables, functions, classes, and attributes become random names like _x3f9 |
| Encode Strings |
String literals are XOR-encoded with module-level caching variables |
| Encode Numbers |
Replace numeric literals with XOR expressions (e.g., 42 → (A ^ B ^ C)) |
| Strip Comments |
All comments, docstrings, and type annotations removed |
| Control Flow |
Inject dead if-statements and wrap conditions to obscure logic |
| Realistic Dead Code |
Inject realistic-looking dead code with generic variable names to confuse analysis |
| Dead Classes |
Inject unused classes to confuse analysis |
| Exception Flow |
Transform if-statements into try/except blocks |
| Flatten Functions |
Replace function bodies with a state-machine while-loop |
| Lambda Convert |
Convert simple single-return functions to lambda expressions |
| Transform Loops |
Restructure for loops to obscure iteration patterns |
| GetAttr Dispatch |
Replace obj.method() with getattr(obj, encoded_name)() calls |
| Bogus Flow |
Add fake else branches to conditionals |
| Folder Support |
Obfuscate entire projects at once |
| Configurable |
Toggle each technique on/off in Settings |
How to Use
Single File
Right-click any .py file → pyRO: Obfuscate Python File
Entire Folder
Right-click any folder → pyRO: Obfuscate All Python Files in Folder
Output
A new file is created alongside the original:
myfile.py → myfile_obfuscated.py
Settings
Open VS Code Settings and search for pyRO:
| Setting |
Default |
Description |
pyro.renameIdentifiers |
true |
Rename variables/functions/classes |
pyro.encodeStrings |
true |
XOR-encode string literals |
pyro.encodeNumbers |
true |
Replace numbers with XOR expressions |
pyro.stripComments |
true |
Remove comments/docstrings/type annotations |
pyro.controlFlow |
true |
Inject dead ifs and wrap conditions |
pyro.realisticDeadCode |
true |
Inject realistic-looking dead code |
pyro.deadClasses |
true |
Inject unused classes |
pyro.exceptionFlow |
true |
Transform if to try/except |
pyro.flattenFunctions |
true |
Flatten functions into state-machine loops |
pyro.lambdaConvert |
true |
Convert functions to lambdas |
pyro.transformLoops |
true |
Restructure loops |
pyro.getattrDispatch |
true |
Use getattr for method calls |
pyro.bogusFlow |
true |
Add fake else branches |
pyro.outputSuffix |
_obfuscated |
Output filename suffix |
Example
Before:
# Calculate discount
def calculate_discount(price, tier):
if tier == "premium":
return price * 0.80
return price * 0.95
result = calculate_discount(100, "premium")
After:
# Protected by pyRO
_a1b2="_x3f9"
_x3f9=lambda _b2a1,_k7e2:(_k7e2==_a1b2 and _b2a1*0.80 or _b2a1*0.95)
_=(_x3f9(100,"premium"),)
Important Note
Obfuscation is not encryption. A determined reverse engineer with enough time can still decode obfuscated code. pyRO significantly raises the difficulty — it does not make it impossible.
License
MIT
Made by Kashish Ahuja