pub struct ProguardMapper<'s> { /* private fields */ }
Expand description

A Proguard Remapper.

This can remap class names, stack frames one at a time, or the complete raw stacktrace.

Implementations§

source§

impl<'s> ProguardMapper<'s>

source

pub fn new(mapping: ProguardMapping<'s>) -> Self

Create a new ProguardMapper.

source

pub fn new_with_param_mapping( mapping: ProguardMapping<'s>, initialize_param_mapping: bool ) -> Self

Create a new ProguardMapper with the extra mappings_by_params. This is useful when we want to deobfuscate frames with missing line information

source

pub fn remap_class(&'s self, class: &str) -> Option<&'s str>

Remaps an obfuscated Class.

This works on the fully-qualified name of the class, with its complete module prefix.

§Examples
let mapping = r#"android.arch.core.executor.ArchTaskExecutor -> a.a.a.a.c:"#;
let mapper = proguard::ProguardMapper::from(mapping);

let mapped = mapper.remap_class("a.a.a.a.c");
assert_eq!(mapped, Some("android.arch.core.executor.ArchTaskExecutor"));
source

pub fn deobfuscate_signature( &'s self, signature: &str ) -> Option<DeobfuscatedSignature>

returns a tuple where the first element is the list of the function parameters and the second one is the return type

source

pub fn remap_method( &'s self, class: &str, method: &str ) -> Option<(&'s str, &'s str)>

Remaps an obfuscated Class Method.

The class argument has to be the fully-qualified obfuscated name of the class, with its complete module prefix.

If the method can be resolved unambiguously, it will be returned alongside the remapped class, otherwise None is being returned.

source

pub fn remap_frame(&'s self, frame: &StackFrame<'s>) -> RemappedFrameIter<'s>

Remaps a single Stackframe.

Returns zero or more StackFrames, based on the information in the proguard mapping. This can return more than one frame in the case of inlined functions. In that case, frames are sorted top to bottom.

source

pub fn remap_throwable<'a>( &'a self, throwable: &Throwable<'a> ) -> Option<Throwable<'a>>

Remaps a throwable which is the first line of a full stacktrace.

§Example
use proguard::{ProguardMapper, Throwable};

let mapping = "com.example.Mapper -> a.b:";
let mapper = ProguardMapper::from(mapping);

let throwable = Throwable::try_parse(b"a.b: Crash").unwrap();
let mapped = mapper.remap_throwable(&throwable);

assert_eq!(
    Some(Throwable::with_message("com.example.Mapper", "Crash")),
    mapped
);
source

pub fn remap_stacktrace(&self, input: &str) -> Result<String, Error>

Remaps a complete Java StackTrace, similar to Self::remap_stacktrace_typed but instead works on strings as input and output.

source

pub fn remap_stacktrace_typed<'a>( &'a self, trace: &StackTrace<'a> ) -> StackTrace<'a>

Remaps a complete Java StackTrace.

Trait Implementations§

source§

impl<'s> Clone for ProguardMapper<'s>

source§

fn clone(&self) -> ProguardMapper<'s>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<'s> Debug for ProguardMapper<'s>

source§

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

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

impl<'s> From<&'s str> for ProguardMapper<'s>

source§

fn from(s: &'s str) -> Self

Converts to this type from the input type.
source§

impl<'s> From<(&'s str, bool)> for ProguardMapper<'s>

source§

fn from(t: (&'s str, bool)) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

§

impl<'s> Freeze for ProguardMapper<'s>

§

impl<'s> RefUnwindSafe for ProguardMapper<'s>

§

impl<'s> Send for ProguardMapper<'s>

§

impl<'s> Sync for ProguardMapper<'s>

§

impl<'s> Unpin for ProguardMapper<'s>

§

impl<'s> UnwindSafe for ProguardMapper<'s>

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> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

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

§

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.