Crates.io | yara |
lib.rs | yara |
version | 0.29.0 |
source | src |
created_at | 2018-05-30 09:40:45.019741 |
updated_at | 2024-09-26 07:59:36.571917 |
description | Rust bindings for VirusTotal/yara |
homepage | |
repository | https://github.com/Hugal31/yara-rust |
max_upload_size | |
id | 67741 |
size | 187,705 |
Bindings for the Yara library from VirusTotal.
More documentation can be found on the Yara's documentation.
The implementation is inspired from yara-python.
const RULES: &str = r#"
rule contains_rust {
strings:
$rust = "rust" nocase
condition:
$rust
}
"#;
fn main() {
let compiler = Compiler::new().unwrap();
let compiler = compiler
.add_rules_str(RULES)
.expect("Should have parsed rule");
let 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().any(|r| r.identifier == "contains_rust"));
}
&[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
).AsRef<Path>
instead of &str
on multiple functions.Licensed under either of
at your option.
Please follow the conventional commit rules when committing to this repository.
If you add any new feature, add the corresponding unit/doc tests.