js-deobfuscator-0.1.1 has been yanked.
JS-Deobfuscator
A high-performance JavaScript deobfuscator built on the OXC Rust AST library.
Features
- 3-Layer Architecture: ECMA → Runtime → Extensions
- V8 Sandbox: Safe execution for string decoding
- Convergence Loop: Iterates until no more transformations
- High Performance: Built on OXC's fast parser
Installation
Add to your Cargo.toml:
[]
= "0.1.1"
Quick Start
Simple API (Recommended)
use ;
One-liner Functions
use ;
// Standard (ECMA + Runtime)
let output = deobfuscate?;
// Full (all extensions enabled)
let output = deobfuscate_full?;
With Result Details
use ;
let result = new
.ecma
.runtime
.extensions
.max_iterations
.deobfuscate_with_result?;
println!;
println!;
println!;
println!;
Low-Level Engine API
For advanced use cases with full control:
use ;
use Allocator;
use Codegen;
use Parser;
use SourceType;
let allocator = default;
let mut program = new.parse.program;
let config = full.with_max_iterations;
let engine = with_config;
let result = engine.run?;
let output = new.build.code;
Configuration
Layers
| Layer | Description | Default |
|---|---|---|
ecma(true) |
Constant folding, dead code removal | ✅ Enabled |
runtime(true) |
atob, btoa, escape, unescape | ✅ Enabled |
extensions([...]) |
Obfuscator-specific patterns | ❌ Disabled |
Extensions
| Extension | Description |
|---|---|
Extension::StringRotator |
obfuscator.io style string arrays |
Extension::ControlFlow |
Control flow deflattening (WIP) |
Extension::Proxy |
Proxy function inlining (WIP) |
Architecture
┌─────────────────────────────────────────────────────────────┐
│ JS-Deobfuscator │
├─────────────────────────────────────────────────────────────┤
│ Layer 1: ECMA (ECMAScript standard) │
│ ├── Operators: +, -, *, /, %, **, &, |, ^, ~, <<, >> │
│ ├── Unary: !, +, -, ~, typeof, void │
│ ├── Comparison: ===, !==, <, >, <=, >= │
│ ├── Logical: &&, ||, ?? │
│ ├── Ternary: cond ? a : b │
│ ├── String: +, [], .length, .charAt, .slice, etc. │
│ ├── Array: .length, .join, .indexOf, etc. │
│ └── Number: parseInt, parseFloat, isNaN, isFinite │
├─────────────────────────────────────────────────────────────┤
│ Layer 2: Runtime (Browser/Node APIs) │
│ ├── Encoding: atob, btoa │
│ └── Deprecated: escape, unescape │
├─────────────────────────────────────────────────────────────┤
│ Layer 3: Extensions (Obfuscator patterns) │
│ └── String Rotator: obfuscator.io style string arrays │
└─────────────────────────────────────────────────────────────┘
Supported Transformations
Layer 1: ECMA
| Category | Transformations |
|---|---|
| Arithmetic | 1 + 2 → 3, 10 % 3 → 1, 2 ** 4 → 16 |
| Bitwise | 5 & 3 → 1, 5 | 3 → 7, ~0 → -1 |
| String | "a" + "b" → "ab", "abc"[1] → "b" |
| Logical | true && x → x, false || x → x |
| Ternary | true ? a : b → a |
| Typeof | typeof "x" → "string" |
| Comparison | 1 === 1 → true |
Layer 2: Runtime
| Function | Example |
|---|---|
atob |
atob("SGVsbG8=") → "Hello" |
btoa |
btoa("Hello") → "SGVsbG8=" |
escape |
escape("hello world") → "hello%20world" |
unescape |
unescape("hello%20world") → "hello world" |
Layer 3: Extensions
| Pattern | Description |
|---|---|
| String Rotator | Decodes obfuscator.io style string arrays with shuffler IIFE |
Examples
# Run examples
License
Apache-2.0 - see LICENSE