yara-rust

Build Status

Bindings for the Yara library from VirusTotal. Only works with Yara 3.7 for now.

More documentation can be found on the Yara's documentation.

Example

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());

Features

Crate features

By default, this crate use a pre-built bindings file for Yara 3.7, but you can use the feature bindgen to use on-the-fly generated bindings.

TODO

License

Licensed under either of

at your option.