OMG-Fuscator
Advanced Python obfuscator (renaming, string encryption, control-flow flattening)
Loading...
Searching...
No Matches
OMG-Fuscator

Advanced Python code obfuscator for renaming identifiers, encrypting strings, flattening control flow, and injecting junk code.

Quick start: use the CLI in main.py or the library API via AdvancedObfuscator().

Features

Requirements

  • Python 3.9+ (uses ast.unparse)
  • No external dependencies; standard library only

Installation

  • Clone or download this repository into a working directory.
  • Optional: create and activate a virtual environment.
  • There are no packages to install.

CLI usage

The CLI entrypoint is main.py with handler main().

Examples:

  • Test mode (prints and executes obfuscated sample code): python main.py –test
  • Obfuscate a file with verbose logging and default output name: python main.py -i path/to/app.py -v
  • Obfuscate to a specific file: python main.py -i path/to/app.py -o path/to/app_obf.py

Arguments:

  • -i, –input: Input .py file path
  • -o, –output: Output file path (default: input_stem_obfuscated.py)
  • -v, –verbose: Enable verbose console logs
  • –test: Run built-in demo

Library usage

Minimal flow: 1) Parse to AST: AdvancedObfuscator.obfuscate() 2) Rename + encrypt: AdvancedObfuscator._rename_and_encrypt(), RenameTransformer() 3) Flatten control flow: AdvancedObfuscator._flatten_control_flow(), ControlFlowFlattener() 4) Generate code and inject junk: AdvancedObfuscator._generate_final_code()

Project structure

Debugging and diagnostics

Notes and limitations

  • Control-flow flattening may increase code size and reduce performance for small functions; tiny functions are skipped in ControlFlowFlattener.visit_FunctionDef().
  • Obfuscation can impact reflection, dynamic imports, serialization, or frameworks that rely on exact names.
  • String encryption decrypts at runtime; extremely performance‑sensitive hot paths may incur overhead.
  • Avoid obfuscating code that uses eval/exec on source strings that expect original identifiers.

License

Specify a license for this project (e.g., MIT). If adding a LICENSE file, reference it here.

Documentation

Generate Doxygen HTML docs for this codebase.