pub struct VmmYara<'a> { /* private fields */ }Expand description
Yara Search API.
Search for yara signatures in physical or virtual memory.
Yara rules may be in either the form of:
- one (1) compiled yara rules file.
- multiple yara source rules files.
- multiple yara source rules strings.
The VmmYara must be used as mut. Also see VmmYaraResult.
The synchronous search workflow:
- Acquire search object from
vmm.search_yara()orvmmprocess.search_yara(). - Start the search and retrieve result (blocking) by calling
vmmyara.result().
The asynchronous search workflow:
- Acquire search object from
vmm.search_yara()orvmmprocess.search_yara(). - Start the search in the background using
vmmyara.start(). - Optionally abort the search with
vmmyara.abort(). - Optionally poll status or result (if completed) using
vmmyara.poll(). - Optionally retrieve result (blocking) by calling
vmmyara.result(). - Yara Search goes out of scope and is cleaned up. Any on-going searches may take a short while to terminate gracefully.
§Created By
§Examples
// Fetch yara search struct for entire process virtual address space.
// Max 256 search hits and avoid using the cache in this example.
let yara_rule = " rule mz_header { strings: $mz = \"MZ\" condition: $mz at 0 } ";
let yara_rules = vec![yara_rule];
let mut vmmyara = vmmprocess.search_yara(yara_rules, 0, 0, 256, FLAG_NOCACHE);
// Start search in async mode.
vmmyara.start();
// Search is now running - it's possible to do other actions here.
// It's possible to poll() to see current progress (or if finished).
// It's possible to abort() to stop search.
// It's possible to fetch result() which will block until search is finished.
let yara_result = vmmyara.result();Implementations§
Source§impl VmmYara<'_>
impl VmmYara<'_>
Sourcepub fn start(&mut self)
pub fn start(&mut self)
Start a yara search in asynchronous background thread.
This is useful since the yara search may take some time and other work may be done while waiting for the result.
The search will start immediately and the progress (and result, if
finished) may be polled by calling poll().
The result may be retrieved by a call to poll() or by a blocking
call to result() which will return when the
search is completed.
§Examples
vmmyara.start();Sourcepub fn poll(&mut self) -> VmmYaraResult
pub fn poll(&mut self) -> VmmYaraResult
Poll an on-going yara search for the status/result.
Also see VmmYara and VmmYaraResult.
§Examples
let yara_status_and_result = vmmyara.poll();Sourcepub fn result(&mut self) -> VmmYaraResult
pub fn result(&mut self) -> VmmYaraResult
Retrieve the yara search result.
The function is blocking and will wait for the search to complete before the results are returned.
Also see VmmYara and VmmYaraResult.
§Examples
let yara_status_and_result = vmmyara.result();