Skip to main content

VmmYara

Struct VmmYara 

Source
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:

  1. Acquire search object from vmm.search_yara() or vmmprocess.search_yara().
  2. Start the search and retrieve result (blocking) by calling vmmyara.result().

The asynchronous search workflow:

  1. Acquire search object from vmm.search_yara() or vmmprocess.search_yara().
  2. Start the search in the background using vmmyara.start().
  3. Optionally abort the search with vmmyara.abort().
  4. Optionally poll status or result (if completed) using vmmyara.poll().
  5. Optionally retrieve result (blocking) by calling vmmyara.result().
  6. 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<'_>

Source

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

pub fn abort(&mut self)

Abort an on-going yara search.

§Examples
vmmyara.abort();
Source

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

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

Trait Implementations§

Source§

impl<'a> Debug for VmmYara<'a>

Source§

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

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

impl Display for VmmYara<'_>

Source§

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

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

impl Drop for VmmYara<'_>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

Auto Trait Implementations§

§

impl<'a> !RefUnwindSafe for VmmYara<'a>

§

impl<'a> !Send for VmmYara<'a>

§

impl<'a> !Sync for VmmYara<'a>

§

impl<'a> !UnwindSafe for VmmYara<'a>

§

impl<'a> Freeze for VmmYara<'a>

§

impl<'a> Unpin for VmmYara<'a>

§

impl<'a> UnsafeUnpin for VmmYara<'a>

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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
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.