use crate::detectors::Detector;
use crate::utils::checks::MatchMode;
use crate::utils::http::HttpResponse;
use once_cell::sync::Lazy;
use regex::Regex;
pub struct FortiWeb;
static BODY: Lazy<Vec<Regex>> = Lazy::new(|| {
vec![Regex::new(r"Attack ID:\s*2(?:0*\d{2})").unwrap()] });
impl Detector for FortiWeb {
fn name(&self) -> &'static str {
"FortiWeb"
}
fn detect(&self, resp: &HttpResponse) -> bool {
resp.body_has(&["<h2 class=\"fgd_icon\">block</h2>"], MatchMode::Any)
&& resp.body_matches(&BODY, MatchMode::Any)
}
}
inventory::submit! {
&FortiWeb as &dyn Detector
}