whatwaf 1.10.6

Heuristic web application firewall (WAF) detector.
Documentation
use crate::detectors::Detector;
use crate::utils::http::HttpResponse;

inventory::collect!(&'static dyn Detector);

pub fn run_detectors(resp: &HttpResponse) -> Option<Vec<&'static str>> {
    let mut matches = Vec::new();
    for d in inventory::iter::<&'static dyn Detector> {
        if d.detect(resp) {
            matches.push(d.name());
        }
    }

    if matches.is_empty() {
        None
    } else {
        Some(matches)
    }
}