Struct Device

Source
pub struct Device<'a> { /* private fields */ }
Expand description

Access to a Frida device.

Implementations§

Source§

impl<'a> Device<'a>

Source

pub fn get_name(&self) -> &str

Returns the device’s name.

Source

pub fn get_id(&self) -> &str

Returns the device’s id.

Source

pub fn get_type(&self) -> DeviceType

Returns the device’s type

§Example
assert_eq!(device.get_type(), DeviceType::Local);
Source

pub fn query_system_parameters(&self) -> Result<HashMap<String, Variant>>

Returns the device’s system parameters

§Example
let params = device.query_system_parameters().unwrap();
let os_version = params
    .get("os")
    .expect("No parameter \"os\" present")
    .get_map()
    .expect("Parameter \"os\" was not a mapping")
    .get("version")
    .expect("Parameter \"os\" did not contain a version field")
    .get_string()
    .expect("Version is not a string");
Source

pub fn is_lost(&self) -> bool

Returns if the device is lost or not.

Source

pub fn enumerate_processes<'b>(&'a self) -> Vec<Process<'b>>
where 'a: 'b,

Returns all processes.

Source

pub fn attach<'b>(&'a self, pid: u32) -> Result<Session<'b>>
where 'a: 'b,

Creates Session and attaches the device to the current PID.

Source

pub fn spawn<S: AsRef<str>>( &mut self, program: S, options: &SpawnOptions<'_>, ) -> Result<u32>

Spawn a process on the device

Returns the PID of the newly spawned process. On spawn, the process will be halted, and resume will need to be called to continue execution.

Source

pub fn resume(&self, pid: u32) -> Result<()>

Resumes the process with given pid.

Source

pub fn kill(&mut self, pid: u32) -> Result<()>

Kill a process on the device

Trait Implementations§

Source§

impl Drop for Device<'_>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl Inject for Device<'_>

Source§

fn inject_library_file_sync<D, E, P>( &mut self, pid: u32, path: P, entrypoint: E, data: D, ) -> Result<u32>
where D: Into<Vec<u8>>, P: AsRef<Path>, E: AsRef<str>,

Inject a library into a target process Read more
Source§

fn inject_library_blob_sync<D, E>( &mut self, pid: u32, blob: &[u8], entrypoint: E, data: D, ) -> Result<u32>
where D: Into<Vec<u8>>, E: AsRef<str>,

Inject a library blob into a target process Read more

Auto Trait Implementations§

§

impl<'a> Freeze for Device<'a>

§

impl<'a> RefUnwindSafe for Device<'a>

§

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

§

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

§

impl<'a> Unpin for Device<'a>

§

impl<'a> UnwindSafe for Device<'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, 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.