Bindings for the Yara library from VirusTotal.
More documentation can be found on the Yara's documentation.
The implementation is inspired from yara-python.
rust
let mut yara = Yara::create().unwrap();
let mut compiler = yara.new_compiler().unwrap();
compiler.add_rules_str("rule contains_rust {
strings:
$rust = \"rust\" nocase
condition:
$rust
}").expect("Should have parsed rule");
let mut rules = compiler.compile_rules().expect("Should have compiled rules");
let results = rules.scan_mem("I love Rust!".as_bytes(), 5).expect("Should have scanned");
assert!(results.iter().find(|r| r.identifier == "contains_rust").is_some());
&[u8]
) or files.Look at the yara-sys crate documentation for a list of feature flags and how to link to your Yara crate.
unwrap
on string conversions (currently this crate assume the rules, meta and namespace identifier are valid Rust's str
).mut
in some functions (as Yara::new_compiler
and Yara::load_rules
).Licensed under either of
at your option.