Skip to main content

wafrift_strategy/
lib.rs

1//! wafrift-strategy — Evasion strategy pipeline.
2//!
3//! The orchestrator that wires all WAF Rift modules into a coherent
4//! evasion flow: request → fingerprint → grammar → encoding →
5//! header → content-type → result.
6//!
7//! # Examples
8//!
9//! Per-host adaptation: the strategy keeps a [`HostState`] for each
10//! target. As blocks pile up the engine escalates encoding choices;
11//! once a technique consistently bypasses, it gets promoted to a
12//! "proven winner" and the engine rotates through the winner pool
13//! instead of re-discovering from scratch.
14//!
15//! ```
16//! use wafrift_strategy::HostState;
17//! use wafrift_types::technique::Technique;
18//!
19//! let mut state = HostState::default();
20//! assert!(!state.waf_confirmed);
21//! assert_eq!(state.blocks, 0);
22//!
23//! // Three confirmed blocks — strategy now knows escalation is needed.
24//! state.record_block();
25//! state.record_block();
26//! state.record_block();
27//! assert_eq!(state.blocks, 3);
28//! assert!(state.needs_evasion());
29//!
30//! // After a single technique succeeds, last_success is populated and
31//! // the per-technique success rate gets tracked for future rotation.
32//! state.record_success(Technique::HeaderObfuscation("uppercase".into()));
33//! assert!(state.last_success.is_some());
34//! ```
35
36pub mod composition;
37pub mod cost;
38pub mod gene_bank;
39pub mod host_state;
40pub mod learning_cache;
41/// MCTS bridge for intelligent evasion trajectory optimization.
42pub mod mcts_bridge;
43pub mod pipeline;
44pub mod planner;
45pub mod strategy;
46/// WAF-specific evasion presets loaded from TOML rules.
47pub mod waf_presets;
48
49pub use host_state::HostState;
50pub use learning_cache::LearningCache;
51pub use pipeline::{EvasionPipeline, EvasionPlanOutput};
52pub use planner::plan_pipelines;
53pub use strategy::*;
54
55pub mod explain;