Scanner

Struct Scanner 

Source
pub struct Scanner { /* private fields */ }
Expand description

configurable pattern scanner

uses SIMD acceleration (AVX2/SSE2) when available and alignment is 1

Implementations§

Source§

impl Scanner

Source

pub fn scan_module(&self, module: &Module<'_>) -> Result<Vec<ScanMatch>>

scan loaded module for pattern

Source

pub fn scan_module_first( &self, module: &Module<'_>, ) -> Result<Option<ScanMatch>>

scan module, returning first match

Source

pub fn scan_region(&self, region: &MemoryRegion) -> Result<Vec<ScanMatch>>

scan memory region for pattern

Source

pub fn scan_executable_regions(&self) -> Result<Vec<ScanMatch>>

scan all executable memory regions

Source

pub fn scan_all_regions(&self) -> Result<Vec<ScanMatch>>

scan all committed memory regions (more thorough, slower)

Source§

impl Scanner

Source

pub fn new(pattern: &str) -> Result<Self>

create scanner from pattern string (auto-detect format)

Source

pub fn from_pattern(pattern: Pattern) -> Self

create scanner from pre-parsed pattern

Source

pub fn alignment(self, align: usize) -> Self

set scan alignment (1, 2, 4, 8, 16)

patterns will only be checked at addresses aligned to this value note: SIMD acceleration is disabled when alignment > 1

Source

pub fn max_results(self, max: usize) -> Self

limit maximum number of results

Source

pub fn scan_slice(&self, data: &[u8]) -> Vec<usize>

scan byte slice for pattern, returning offsets

Source

pub fn scan_slice_first(&self, data: &[u8]) -> Option<usize>

scan byte slice, returning first match offset

Source

pub unsafe fn scan_range( &self, start: usize, size: usize, ) -> Result<Vec<ScanMatch>>

scan memory range for pattern

§Safety

caller must ensure the memory range [start, start+size) is readable

Source

pub unsafe fn scan_range_first( &self, start: usize, size: usize, ) -> Result<Option<ScanMatch>>

scan memory range, returning first match

§Safety

caller must ensure the memory range [start, start+size) is readable

Auto Trait Implementations§

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, 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.