RemoteProcess

Struct RemoteProcess 

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

wrapper for a remote process handle with memory operations

Implementations§

Source§

impl RemoteProcess

Source

pub fn open(pid: u32, access: ProcessAccess) -> Result<Self>

open a process by PID with specified access rights

Source

pub fn open_all_access(pid: u32) -> Result<Self>

open a process with all access rights

Source

pub unsafe fn from_handle(handle: usize, pid: u32) -> Self

create from an existing handle (does not take ownership)

§Safety

caller must ensure handle is valid and has appropriate access rights

Source

pub unsafe fn from_handle_owned(handle: usize, pid: u32) -> Self

create from an existing handle (takes ownership)

§Safety

caller must ensure handle is valid and has appropriate access rights

Source

pub fn handle(&self) -> usize

get the raw process handle

Source

pub fn pid(&self) -> u32

get the process ID

Source

pub fn read(&self, address: usize, buffer: &mut [u8]) -> Result<usize>

read memory from the remote process

Source

pub fn read_value<T: Copy>(&self, address: usize) -> Result<T>

read a typed value from the remote process

Source

pub fn read_string(&self, address: usize, max_len: usize) -> Result<String>

read a null-terminated string from the remote process

Source

pub fn read_wstring(&self, address: usize, max_chars: usize) -> Result<String>

read a wide string from the remote process

Source

pub fn write(&self, address: usize, buffer: &[u8]) -> Result<usize>

write memory to the remote process

Source

pub fn write_value<T: Copy>(&self, address: usize, value: &T) -> Result<usize>

write a typed value to the remote process

Source

pub fn allocate(&self, size: usize, protection: u32) -> Result<RemoteAllocation>

allocate memory in the remote process

Source

pub fn allocate_at( &self, preferred_base: usize, size: usize, protection: u32, ) -> Result<RemoteAllocation>

allocate memory at a preferred address

Source

pub fn allocate_rw(&self, size: usize) -> Result<RemoteAllocation>

allocate RW memory

Source

pub fn allocate_rwx(&self, size: usize) -> Result<RemoteAllocation>

allocate RWX memory

Source

pub fn allocate_rx(&self, size: usize) -> Result<RemoteAllocation>

allocate RX memory

Source

pub fn protect( &self, address: usize, size: usize, protection: u32, ) -> Result<u32>

change memory protection in the remote process

Source

pub fn protect_guard( &self, address: usize, size: usize, new_protection: u32, ) -> Result<RemoteProtectionGuard>

change protection with RAII guard that restores on drop

Source

pub fn free(&self, address: usize) -> Result<()>

free allocated memory in the remote process

Source

pub fn write_shellcode(&self, shellcode: &[u8]) -> Result<RemoteAllocation>

write shellcode and allocate executable memory

Source

pub fn execute_shellcode(&self, shellcode: &[u8]) -> Result<u32>

write and execute shellcode via remote thread

Trait Implementations§

Source§

impl Drop for RemoteProcess

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl Send for RemoteProcess

Source§

impl Sync for RemoteProcess

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.