pub struct Detector { /* private fields */ }Expand description
The ATLAS technique detector.
Thread-safe and cheap to clone. Create once and share across threads.
Implementations§
Source§impl Detector
impl Detector
Sourcepub fn new() -> Self
pub fn new() -> Self
Create a new detector. The regex set is compiled once and cached globally.
Sourcepub fn scan(&self, content: &str) -> Vec<Hit>
pub fn scan(&self, content: &str) -> Vec<Hit>
Scan content and return all matching ATLAS techniques.
Sourcepub fn scan_with_context(&self, ctx: &ScanContext) -> Vec<Hit>
pub fn scan_with_context(&self, ctx: &ScanContext) -> Vec<Hit>
Scan with context for improved accuracy and fewer false positives.
Sourcepub fn should_block(&self, hits: &[Hit]) -> bool
pub fn should_block(&self, hits: &[Hit]) -> bool
Returns true if any hit recommends blocking.
Sourcepub fn block_reasons<'a>(&self, hits: &'a [Hit]) -> Vec<&'a str>
pub fn block_reasons<'a>(&self, hits: &'a [Hit]) -> Vec<&'a str>
Returns the technique IDs that triggered a block recommendation.
Sourcepub fn all_techniques(&self) -> &'static [Rule]
pub fn all_techniques(&self) -> &'static [Rule]
Returns all techniques in the ruleset.
Sourcepub fn rule_count(&self) -> usize
pub fn rule_count(&self) -> usize
Returns the number of rules in the detector.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Detector
impl RefUnwindSafe for Detector
impl Send for Detector
impl Sync for Detector
impl Unpin for Detector
impl UnsafeUnpin for Detector
impl UnwindSafe for Detector
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more