pub trait Process: Send {
Show 25 methods
// Required methods
fn state(&mut self) -> ProcessState;
fn set_dtb(&mut self, dtb1: Address, dtb2: Address) -> Result<(), Error>;
fn module_address_list_callback(
&mut self,
target_arch: Option<&ArchitectureIdent>,
callback: OpaqueCallback<'_, ModuleAddressInfo>,
) -> Result<(), Error>;
fn module_by_address(
&mut self,
address: Address,
architecture: ArchitectureIdent,
) -> Result<ModuleInfo, Error>;
fn primary_module_address(&mut self) -> Result<Address, Error>;
fn module_import_list_callback(
&mut self,
info: &ModuleInfo,
callback: OpaqueCallback<'_, ImportInfo>,
) -> Result<(), Error>;
fn module_export_list_callback(
&mut self,
info: &ModuleInfo,
callback: OpaqueCallback<'_, ExportInfo>,
) -> Result<(), Error>;
fn module_section_list_callback(
&mut self,
info: &ModuleInfo,
callback: OpaqueCallback<'_, SectionInfo>,
) -> Result<(), Error>;
fn info(&self) -> &ProcessInfo;
fn mapped_mem_range(
&mut self,
gap_size: i64,
start: Address,
end: Address,
out: OpaqueCallback<'_, CTup3<Address, u64, PageType>>,
);
// Provided methods
fn module_list_callback(
&mut self,
target_arch: Option<&ArchitectureIdent>,
callback: OpaqueCallback<'_, ModuleInfo>,
) -> Result<(), Error> { ... }
fn module_by_name_arch(
&mut self,
name: &str,
architecture: Option<&ArchitectureIdent>,
) -> Result<ModuleInfo, Error> { ... }
fn module_by_name(&mut self, name: &str) -> Result<ModuleInfo, Error> { ... }
fn module_list_arch(
&mut self,
target_arch: Option<&ArchitectureIdent>,
) -> Result<Vec<ModuleInfo>, Error> { ... }
fn module_list(&mut self) -> Result<Vec<ModuleInfo>, Error> { ... }
fn primary_module(&mut self) -> Result<ModuleInfo, Error> { ... }
fn module_import_list(
&mut self,
info: &ModuleInfo,
) -> Result<Vec<ImportInfo>, Error> { ... }
fn module_export_list(
&mut self,
info: &ModuleInfo,
) -> Result<Vec<ExportInfo>, Error> { ... }
fn module_section_list(
&mut self,
info: &ModuleInfo,
) -> Result<Vec<SectionInfo>, Error> { ... }
fn module_import_by_name(
&mut self,
info: &ModuleInfo,
name: &str,
) -> Result<ImportInfo, Error> { ... }
fn module_export_by_name(
&mut self,
info: &ModuleInfo,
name: &str,
) -> Result<ExportInfo, Error> { ... }
fn module_section_by_name(
&mut self,
info: &ModuleInfo,
name: &str,
) -> Result<SectionInfo, Error> { ... }
fn mapped_mem_range_vec(
&mut self,
gap_size: i64,
start: Address,
end: Address,
) -> Vec<CTup3<Address, u64, PageType>> { ... }
fn mapped_mem(
&mut self,
gap_size: i64,
out: OpaqueCallback<'_, CTup3<Address, u64, PageType>>,
) { ... }
fn mapped_mem_vec(
&mut self,
gap_size: i64,
) -> Vec<CTup3<Address, u64, PageType>> { ... }
}Expand description
Provides all actions on processes
This trait provides a lot of typical functionality for processes, such as memory access, module lists, and basic information.
Future expansions could include threads, keyboard input, and more.
Required Methods§
Sourcefn state(&mut self) -> ProcessState
fn state(&mut self) -> ProcessState
Retrieves the state of the process
Sourcefn set_dtb(&mut self, dtb1: Address, dtb2: Address) -> Result<(), Error>
fn set_dtb(&mut self, dtb1: Address, dtb2: Address) -> Result<(), Error>
Changes the dtb this process uses for memory translations
§Remarks
In case the architecture only uses a single dtb for translation the second parameter should be set to Address::invalid().
Sourcefn module_address_list_callback(
&mut self,
target_arch: Option<&ArchitectureIdent>,
callback: OpaqueCallback<'_, ModuleAddressInfo>,
) -> Result<(), Error>
fn module_address_list_callback( &mut self, target_arch: Option<&ArchitectureIdent>, callback: OpaqueCallback<'_, ModuleAddressInfo>, ) -> Result<(), Error>
Walks the process’ module list and calls the provided callback for each module structure address
§Arguments
target_arch- sets which architecture to retrieve the modules for (if emulated). Choose betweenSome(ProcessInfo::sys_arch()), andSome(ProcessInfo::proc_arch()).Nonefor all.callback- where to pass each matching module to. This is an opaque callback.
Sourcefn module_by_address(
&mut self,
address: Address,
architecture: ArchitectureIdent,
) -> Result<ModuleInfo, Error>
fn module_by_address( &mut self, address: Address, architecture: ArchitectureIdent, ) -> Result<ModuleInfo, Error>
Retrieves a module by its structure address and architecture
§Arguments
address- address where module’s information resides inarchitecture- architecture of the module. Should be eitherProcessInfo::proc_arch, orProcessInfo::sys_arch.
Sourcefn primary_module_address(&mut self) -> Result<Address, Error>
fn primary_module_address(&mut self) -> Result<Address, Error>
Retrieves address of the primary module structure of the process
This will generally be for the initial executable that was run
Sourcefn module_import_list_callback(
&mut self,
info: &ModuleInfo,
callback: OpaqueCallback<'_, ImportInfo>,
) -> Result<(), Error>
fn module_import_list_callback( &mut self, info: &ModuleInfo, callback: OpaqueCallback<'_, ImportInfo>, ) -> Result<(), Error>
Retrieves a list of all imports of a given module
Sourcefn module_export_list_callback(
&mut self,
info: &ModuleInfo,
callback: OpaqueCallback<'_, ExportInfo>,
) -> Result<(), Error>
fn module_export_list_callback( &mut self, info: &ModuleInfo, callback: OpaqueCallback<'_, ExportInfo>, ) -> Result<(), Error>
Retrieves a list of all exports of a given module
Sourcefn module_section_list_callback(
&mut self,
info: &ModuleInfo,
callback: OpaqueCallback<'_, SectionInfo>,
) -> Result<(), Error>
fn module_section_list_callback( &mut self, info: &ModuleInfo, callback: OpaqueCallback<'_, SectionInfo>, ) -> Result<(), Error>
Retrieves a list of all sections of a given module
Sourcefn info(&self) -> &ProcessInfo
fn info(&self) -> &ProcessInfo
Retrieves the process info
fn mapped_mem_range( &mut self, gap_size: i64, start: Address, end: Address, out: OpaqueCallback<'_, CTup3<Address, u64, PageType>>, )
Provided Methods§
Sourcefn module_list_callback(
&mut self,
target_arch: Option<&ArchitectureIdent>,
callback: OpaqueCallback<'_, ModuleInfo>,
) -> Result<(), Error>
fn module_list_callback( &mut self, target_arch: Option<&ArchitectureIdent>, callback: OpaqueCallback<'_, ModuleInfo>, ) -> Result<(), Error>
Walks the process’ module list and calls the provided callback for each module
§Arguments
target_arch- sets which architecture to retrieve the modules for (if emulated). Choose betweenSome(ProcessInfo::sys_arch()), andSome(ProcessInfo::proc_arch()).Nonefor all.callback- where to pass each matching module to. This is an opaque callback.
Sourcefn module_by_name_arch(
&mut self,
name: &str,
architecture: Option<&ArchitectureIdent>,
) -> Result<ModuleInfo, Error>
fn module_by_name_arch( &mut self, name: &str, architecture: Option<&ArchitectureIdent>, ) -> Result<ModuleInfo, Error>
Finds a process module by its name under specified architecture
This function can be useful for quickly accessing a specific module
§Arguments
name- name of the module to findarchitecture- architecture of the module. Should be eitherProcessInfo::proc_arch, orProcessInfo::sys_arch, or None for both.
Sourcefn module_by_name(&mut self, name: &str) -> Result<ModuleInfo, Error>
fn module_by_name(&mut self, name: &str) -> Result<ModuleInfo, Error>
Finds any architecture process module by its name
This function can be useful for quickly accessing a specific module
§Arguments
name- name of the module to find
Sourcefn module_list_arch(
&mut self,
target_arch: Option<&ArchitectureIdent>,
) -> Result<Vec<ModuleInfo>, Error>
fn module_list_arch( &mut self, target_arch: Option<&ArchitectureIdent>, ) -> Result<Vec<ModuleInfo>, Error>
Retrieves a module list for the process
§Arguments
target_arch- sets which architecture to retrieve the modules for (if emulated). Choose betweenSome(ProcessInfo::sys_arch()), andSome(ProcessInfo::proc_arch()).Nonefor all.
Sourcefn module_list(&mut self) -> Result<Vec<ModuleInfo>, Error>
fn module_list(&mut self) -> Result<Vec<ModuleInfo>, Error>
Retrieves a module list for the process
This is equivalent to Process::module_list_arch(None)
Sourcefn primary_module(&mut self) -> Result<ModuleInfo, Error>
fn primary_module(&mut self) -> Result<ModuleInfo, Error>
Retrieves information for the primary module of the process
This will generally be the initial executable that was run
Sourcefn module_import_list(
&mut self,
info: &ModuleInfo,
) -> Result<Vec<ImportInfo>, Error>
fn module_import_list( &mut self, info: &ModuleInfo, ) -> Result<Vec<ImportInfo>, Error>
Retrieves a list of all imports of a given module
Sourcefn module_export_list(
&mut self,
info: &ModuleInfo,
) -> Result<Vec<ExportInfo>, Error>
fn module_export_list( &mut self, info: &ModuleInfo, ) -> Result<Vec<ExportInfo>, Error>
Retrieves a list of all exports of a given module
Sourcefn module_section_list(
&mut self,
info: &ModuleInfo,
) -> Result<Vec<SectionInfo>, Error>
fn module_section_list( &mut self, info: &ModuleInfo, ) -> Result<Vec<SectionInfo>, Error>
Retrieves a list of all sections of a given module
Sourcefn module_import_by_name(
&mut self,
info: &ModuleInfo,
name: &str,
) -> Result<ImportInfo, Error>
fn module_import_by_name( &mut self, info: &ModuleInfo, name: &str, ) -> Result<ImportInfo, Error>
Finds a single import of a given module by its name
Sourcefn module_export_by_name(
&mut self,
info: &ModuleInfo,
name: &str,
) -> Result<ExportInfo, Error>
fn module_export_by_name( &mut self, info: &ModuleInfo, name: &str, ) -> Result<ExportInfo, Error>
Finds a single export of a given module by its name
Sourcefn module_section_by_name(
&mut self,
info: &ModuleInfo,
name: &str,
) -> Result<SectionInfo, Error>
fn module_section_by_name( &mut self, info: &ModuleInfo, name: &str, ) -> Result<SectionInfo, Error>
Finds a single section of a given module by its name