js_deobfuscator/engine/config.rs
1//! Engine configuration.
2
3use std::collections::HashMap;
4
5/// Configuration for the deobfuscator engine.
6#[derive(Debug, Clone)]
7pub struct Config {
8 /// Maximum convergence iterations before stopping.
9 pub max_iterations: usize,
10
11 /// Enable static expression folding (fold/ layer).
12 pub static_eval: bool,
13
14 /// Enable dynamic evaluation via Node.js subprocess (eval/ layer).
15 pub dynamic_eval: bool,
16
17 /// Enable semantic transforms (transform/ layer).
18 pub transforms: bool,
19
20 /// Global values for resolving external references.
21 ///
22 /// Example: `{"window": {"secret": "abc123"}}` lets the deobfuscator
23 /// resolve `window.secret` → `"abc123"`.
24 pub globals: HashMap<String, serde_json::Value>,
25}
26
27impl Default for Config {
28 fn default() -> Self {
29 Self {
30 max_iterations: 50,
31 static_eval: true,
32 dynamic_eval: false,
33 transforms: true,
34 globals: HashMap::new(),
35 }
36 }
37}