Struct scanner::Scanner [] [src]

pub struct Scanner<'a> { /* fields omitted */ }

Pattern scan context.

Methods

impl<'a> Scanner<'a>
[src]

Create a new Scanner from raw components.

Arguments

  • haystack

    Slice of valid memory to scan inside. Any time the scan goes outside this slice, the match has failed.

    A reference to the haystack is kept, tying the Scanner's lifetime to the haystack.

  • scan

    Check only for matches within this range, but allow patterns to chase pointers in the whole haystack.

  • vbase

    Code might not be at the place where it's actually being executed, this would make it impossible to chase absolute pointers.

    This is where vbase comes in, it translates absolute addresses to offsets within the haystack by simply subtracting it.

    Set it to the virtual address of where haystack is expecting it is located in memory.

Panics

Scan range must be contained within the haystack, enforced by panic.

Scan for a single unique match.

Arguments

  • pat

    The pattern to match.

Return value

Fails with None if there's no match, or more than one match was found.

Iterate over all matches.

Arguments

  • pat

    The pattern being matched.

Return value

Iterator over the matches.

Match a pattern to a specific ptr.

Arguments

  • ptr

    Offset in the haystack to match the pattern at.

  • pat

    The pattern to match.

Return value

None if mismatch, Some(Match) if matched.

Remarks

I'd like to name this function match but that's a keyword...

Trait Implementations

impl<'a> Clone for Scanner<'a>
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl<'a> Debug for Scanner<'a>
[src]

Formats the value using the given formatter.

impl<'a, 'b> From<&'b PeView<'a>> for Scanner<'a>
[src]

Performs the conversion.

impl<'a, 'b> From<&'b PeView<'a>> for Scanner<'a>
[src]

Performs the conversion.