Cuckoo

Struct Cuckoo 

Source
pub struct Cuckoo;
Expand description

cuckoo module.

To use the module, the json report must be provided before the scan:

use boreal::module::{Cuckoo, CuckooData};
use boreal::compiler::CompilerBuilder;

let mut compiler = CompilerBuilder::new().add_module(Cuckoo).build();
compiler.add_rules_str(r#"
import "cuckoo"

rule a {
    condition: cuckoo.network.host(/crates.io/)
}"#).unwrap();
let mut scanner = compiler.finalize();

let report = r#"{ "network": { "hosts": ["crates.io"] } }"#;
let cuckoo_data = CuckooData::from_json_report(report).unwrap();
scanner.set_module_data::<Cuckoo>(cuckoo_data);

let result = scanner.scan_mem(b"").unwrap();
assert_eq!(result.rules.len(), 1);

Trait Implementations§

Source§

impl Debug for Cuckoo

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Module for Cuckoo

Source§

fn get_name(&self) -> &'static str

Name of the module, used in import clauses.
Source§

fn get_static_values(&self) -> HashMap<&'static str, StaticValue>

Static values exported by the module. Read more
Source§

fn get_dynamic_types(&self) -> HashMap<&'static str, Type>

Type of the dynamic values exported by the module. Read more
Source§

fn setup_new_scan(&self, data_map: &mut ModuleDataMap<'_>)

Setup data when a new scan is started. Read more
Source§

fn get_dynamic_values( &self, _ctx: &mut ScanContext<'_, '_, '_>, _values: &mut HashMap<&'static str, Value>, )

Values computed dynamically. Read more
Source§

impl ModuleData for Cuckoo

Source§

type PrivateData = ()

Private Data to associate with the module. Read more
Source§

type UserData = CuckooData

Data that the user can provide to the module. Read more

Auto Trait Implementations§

§

impl Freeze for Cuckoo

§

impl RefUnwindSafe for Cuckoo

§

impl Send for Cuckoo

§

impl Sync for Cuckoo

§

impl Unpin for Cuckoo

§

impl UnwindSafe for Cuckoo

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.