GitHunt
SA

samay825/Python-Deobfuscator

๐Ÿ”“ AI-Powered Python Deobfuscator - Auto-decode 500+ layers of obfuscation (Base64, Marshal, Zlib, XOR, exec wrappers & more). Built-in sandbox, forensic analyzer

What Is This?

Python Deobfuscator Suite is an enterprise-grade, AI-powered tool that automatically detects and decodes multi-layered obfuscated Python code โ€” with support for 500+ recursive layers, 30+ obfuscation types, AI fallback via OpenRouter, sandboxed execution, and deep forensic analysis โ€” all wrapped in a stunning Matrix-themed PyQt6 GUI.

Feature Arsenal

๐Ÿง  AI-Powered Decoding Engine

Feature Detail
๐Ÿค– AI Model arcee-ai/trinity-large-preview via OpenRouter
๐Ÿ”„ Auto Retry Up to 3 consecutive AI fallbacks per layer
๐ŸŽฏ Pattern-Aware Sends extracted lambda/exec patterns to AI
๐Ÿ“ Error Context AI receives previous failure info for smarter prompts
๐Ÿ“ฆ 8K Context Handles large obfuscated payloads

๐Ÿ” Sandbox Execution Engine

Feature Detail
๐Ÿ›ก๏ธ Namespace No os, sys, subprocess access
โฑ๏ธ Timeout 10-second execution limit per call
๐Ÿšซ Whitelist Only safe modules (base64, zlib, marshal...)
๐Ÿงช Isolation Each execution in daemon thread
๐Ÿ” Validation AST-based security scanning before exec

๐Ÿ” 30+ Obfuscation Type Detection

Category Types Detected
Standard Base64, Hex, Zlib, Marshal, LZMA, Gzip, ROT13
Exec Wrappers exec(), eval(), compile(), Lambda
Chained Marshal+Zlib+B64, LZMA+B64, B85
Tool-Specific PyArmor, Cython, Nuitka, PyInstaller
Advanced XOR, chr-join, Fernet, AES
Behavioral Variable rename, Dead code, Control flow
Custom Hyperion, Intensio, BlastObfuscator, Ninja

๐Ÿ•ต๏ธ Forensic Intelligence Extractor

Intelligence Extraction
๐ŸŒ Network IOCs URLs, IPs, Domains, Emails
๐Ÿ”‘ Credentials API Keys, Tokens, AWS/GitHub PATs
๐Ÿ“‚ File System File paths, Imports, Payloads
โš ๏ธ Behaviors Shell exec, Keylogger, Webhook
๐Ÿ”ฎ XOR Strings Lambda-encoded auto-resolution
๐Ÿ—๏ธ Structure Functions, Classes, Variables
๐Ÿ’ป Platform Architecture & OS markers
๐Ÿ“ฆ Binary ZIP, ELF, PE embedded data

UI Showcase

๐Ÿ–ฅ๏ธ Hacker-Themed Matrix GUI

Split-pane layout with INPUT / OUTPUT editors, real-time detection log, obfuscation scoring, theme selector, and drag-and-drop file support.


Main UI Screenshot

Toolbar: ๐Ÿ“‚ Load ยท ๐Ÿ“‹ Paste ยท โšก Auto Decode ยท ๐Ÿ”ง Manual ยท ๐Ÿ’พ Export ยท ๐Ÿ—‘ Clear ยท ๐Ÿ”‘ API Key

Panels:

Panel Description
โ–Ž INPUT Paste or drag-drop obfuscated .py files
โ–Ž OUTPUT Decoded clean source + forensic report
โ–Ž LOG Real-time layer-by-layer decode progress
Score Live obfuscation score 0-100 with color indicator
Depth Layer depth counter updated per decode step
๐ŸŽฌ Animated Splash Screen Features
Splash Screen

Effect Description
๐ŸŸข Matrix Rain Falling katakana + hex chars
๐Ÿ’ฅ Glitch Title RGB-split jitter text
โŒจ๏ธ Typing Boot messages + blinking cursor
๐Ÿ’ซ Neon Border Pulsing glow border
๐Ÿ”„ Spinner Arc + dot + percentage
๐Ÿ“Š Progress Gradient bar + glow tip
๐Ÿ“บ Scanlines CRT retro overlay
๐Ÿ”ฒ Corners Military-style brackets
๐Ÿ”ข Hex Dump Decorative hex addresses

Quick Start

Installation

Step Action
1 Go to Releases page
2 Download the latest .zip file
3 Unzip the downloaded archive
4 Run Python Deobfuscator.exe
5 Done โ€” start decoding! ๐ŸŽ‰

โšก No Python installation needed โ€” everything is bundled inside the .exe via PyInstaller.

Enable AI Fallback (Optional)

Click the ๐Ÿ”‘ API Key button inside the app and paste your OpenRouter API key.

๐Ÿ’ก Tip: Get a free API key at openrouter.ai โ€” the app uses the free arcee-ai/trinity-large-preview model.

โš™๏ธ Supported Obfuscation Types

CategoryTypeAuto DecodeAI Fallback
๐Ÿ”ค Standard
Encoding
Base64โœ…โœ…
Double Base64โœ…โœ…
Hex Encodedโœ…โœ…
ROT13โœ…โœ…
Base85 (b85/a85)โœ…โœ…
Unicode Escapeโœ…โœ…
Octal Escapeโœ…โœ…
๐Ÿ“ฆ Compression Zlibโœ…โœ…
Zlib + Base64โœ…โœ…
LZMAโœ…โœ…
LZMA + Base64โœ…โœ…
Gzipโœ…โœ…
Gzip + Base64โœ…โœ…
โš™๏ธ Exec/Eval
Wrappers
exec() Wrapperโœ…โœ…
eval() Wrapperโœ…โœ…
Lambda Wrapperโœ…โœ…
compile() Wrapperโœ…โœ…
__import__ based execโœ…โœ…
๐Ÿ”— Chained
Encoding
Marshal + Base64โœ…โœ…
Marshal + Zlib + Base64โœ…โœ…
exec(zlib(b64(...)))โœ…โœ…
exec(marshal(b64(...)))โœ…โœ…
exec(lzma(b64(...)))โœ…โœ…
๐Ÿ”’ Advanced XOR Encodedโœ…โœ…
chr/ord Chainโœ…โœ…
Reversed Stringโœ…โœ…
Stacked String Concatโœ…โœ…
XOR Lambda Encoded Stringsโœ…โœ…
๐Ÿ” Encrypted
(Undecryptable)
Fernet EncryptedโŒ๐Ÿ” Forensics
AES EncryptedโŒ๐Ÿ” Forensics
PyArmor ProtectedโŒ๐Ÿ” Forensics
SourceGuardian ProtectedโŒ๐Ÿ” Forensics
๐Ÿญ Tool-Specific Cython Compiled (.so/.pyd)โŒ๐Ÿ” Forensics
Nuitka CompiledโŒ๐Ÿ” Forensics
PyInstaller PackedโŒ๐Ÿ” Forensics
Hyperion Obfuscatedโœ…โœ…
Intensio Obfuscatedโœ…โœ…
BlastObfuscatorโœ…โœ…

๐ŸŽจ Themes

Theme Accent Color Preview
โฌข Hacker Green #00ff41 #00ff41
โฌข Dark Cyan #00e5ff #00e5ff
โฌข Red Alert #ff0040 #ff0040

All themes feature:

  • ๐Ÿ–ค Ultra-dark backgrounds (#0a0a0a)
  • ๐Ÿ’ก Neon accent colors with glow effects
  • ๐Ÿ”ค Monospace Consolas / Fira Code typography
  • ๐Ÿ“œ Custom scrollbars, tooltips, and combo boxes
  • โœจ Hover animations and pressed states

โŒจ๏ธ Keyboard Shortcuts

Shortcut Action
Ctrl + O Open / Load file
Ctrl + V Paste from clipboard
Ctrl + D Auto Decode (AI-assisted)
Ctrl + S Export decoded output
Ctrl + L Clear all panels

Entropy Analysis Engine

The built-in Shannon entropy analyzer provides real-time obfuscation scoring:

Entropy Range Classification Score Impact
< 2.0 ๐Ÿ’š Low โ€” Plain text 0-10
2.0 - 3.5 ๐Ÿ’› Medium-Low โ€” Structured code 10-25
3.5 - 4.5 ๐ŸŸก Medium โ€” Light obfuscation 25-40
4.5 - 5.5 ๐ŸŸ  High โ€” Likely encoded 40-60
5.5 - 6.5 ๐Ÿ”ด Very High โ€” Heavily encoded 60-80
> 6.5 โ›” Extreme โ€” Binary/encrypted 80-100

Additional metrics analyzed:

  • Printable ratio โ€” percentage of printable ASCII characters
  • Alpha ratio โ€” letter frequency for natural language detection
  • Base64 likelihood โ€” character set matching for Base64 detection
  • Hex likelihood โ€” hex character set ratio analysis

๐Ÿ”ง Configuration

Environment Variables

Variable Description Default
OPENROUTER_API_KEY API key for AI fallback engine (none)
QT_AUTO_SCREEN_SCALE_FACTOR High DPI scaling 1

Decoder Tuning Constants

Constant Value Description
MAX_DECODE_DEPTH 500 Maximum recursive decode layers
MAX_AI_RETRIES 3 Consecutive AI failures before abort
MAX_CAPTURE_DEPTH 500 Max depth in single capture call
CAPTURE_TIMEOUT 30s Max time per exec capture attempt
SANDBOX_TIMEOUT 10s Max time for sandbox execution
AI_CODE_WINDOW 8000 Max chars sent to AI model

๐Ÿ“ฆ Dependencies

Package Version Purpose
PyQt6 โ‰ฅ 6.5.0 Modern GUI framework with native rendering
python-dotenv โ‰ฅ 1.0.0 Environment variable management
requests โ‰ฅ 2.31.0 HTTP client for OpenRouter AI API

๐ŸงŠ Zero bloat โ€” only 3 dependencies. All decoding logic uses Python stdlib (base64, zlib, marshal, ast, re, etc.)

๐Ÿš€ Usage Examples

Auto Decode (One Click)

1. Launch the app:  python main.py
2. Paste obfuscated code or drag & drop a .py file
3. Click โšก Auto Decode
4. Watch the log as layers are peeled automatically
5. Export decoded output with ๐Ÿ’พ Export

Manual Decode

1. Paste code โ†’ Click ๐Ÿ”ง Manual Decode
2. Select the specific obfuscation type from 30+ options
3. View result in the output panel

With AI Fallback

1. Set API key: Click ๐Ÿ”‘ API Key โ†’ Enter your OpenRouter key
2. Paste deeply obfuscated code (custom encodings, nested lambdas)
3. Click โšก Auto Decode
4. When built-in decoders fail, AI automatically steps in
5. AI analyzes the code, generates a decode function, runs it in sandbox

๐Ÿงฉ API Reference (For Developers)

DecoderEngine
from core.decoder import DecoderEngine, DecodeResult
from core.ai_engine import AIEngine
from core.sandbox import Sandbox

# Initialize with AI support
ai = AIEngine()
sandbox = Sandbox()
engine = DecoderEngine(ai_engine=ai, sandbox=sandbox)

# Auto decode (all layers)
result: DecodeResult = engine.decode_auto(obfuscated_code)

print(result.decoded_code)       # Final decoded output
print(result.total_layers)       # Number of layers decoded
print(result.is_fully_decoded)   # Whether source code was reached
print(result.ai_used)            # Whether AI was involved
print(result.forensic_report)    # Forensic intelligence report
ObfuscationDetector
from core.detector import ObfuscationDetector

detector = ObfuscationDetector()

# Detect best matching obfuscation type
result = detector.detect_best(code)
print(result.obf_type)           # ObfuscationType enum
print(result.confidence)         # 0.0 to 1.0
print(result.description)        # Human-readable description

# Detect all matching types
results = detector.detect_all(code)
for r in results:
    print(f"{r.obf_type.value}: {r.confidence:.0%}")
ForensicAnalyzer
from core.forensics import ForensicAnalyzer

analyzer = ForensicAnalyzer()
report = analyzer.analyze(code)

print(report.urls)               # Extracted URLs
print(report.ips)                # IP addresses
print(report.api_keys)           # Potential API keys
print(report.suspicious)         # Suspicious behaviors
print(report.xor_decoded)        # XOR lambda decoded strings
print(report.to_report())        # Full formatted report
Sandbox
from core.sandbox import Sandbox

sandbox = Sandbox(timeout=10)

result = sandbox.execute_function(
    function_code="def decode(data): return data[::-1]",
    input_data="!dlroW olleH"
)

print(result["success"])  # True
print(result["result"])   # "Hello World!"

โ“ FAQ

Can it decode PyArmor / Cython / Nuitka protected files?
No. These use native compiled binaries or encryption keys. The tool will detect them and explain why they can't be decoded, plus run forensic analysis to extract any available intelligence (strings, URLs, API keys, etc.).
Is the AI fallback free?
Yes! The default model arcee-ai/trinity-large-preview:free on OpenRouter is free. You just need to create an account and get an API key.
How deep can it decode?
Up to 500 layers recursively. Each layer automatically selects the best decode strategy from 4 options: capture, AST extract, pattern match, or AI fallback.
Is it safe to decode malicious code?
The tool uses a sandboxed execution environment that blocks dangerous modules (os, sys, subprocess, socket, etc.). However, the initial exec/eval capture runs in a restricted but not fully sandboxed environment โ€” use caution with untrusted code.

๐Ÿ‘จโ€๐Ÿ’ป Developer

Developer



Tech Stack


     โญ If this tool helped you, consider giving it a star!

Python Deobfuscator Suite v2.0.0 โ€” 2026 Edition | AI-Powered Multi-Layer Decoder