pub struct ShellcodeBuilder { /* private fields */ }Expand description
Builder for configuring and loading shellcode
Implementations§
Source§impl ShellcodeBuilder
impl ShellcodeBuilder
Sourcepub fn from_instructions(instructions: &[u32]) -> Self
pub fn from_instructions(instructions: &[u32]) -> Self
Creates a shellcode builder from ARM64 instructions (u32 array)
§Arguments
instructions- Slice of 32-bit ARM64 instructions
Sourcepub fn with_symbol(self, offset: usize, symbol_name: &str) -> Self
pub fn with_symbol(self, offset: usize, symbol_name: &str) -> Self
Adds a symbol relocation for dynamic linking
The loader will resolve the symbol address and write it at the specified offset.
§Arguments
offset- Byte offset in the shellcodesymbol_name- Name of the symbol to resolve
Sourcepub fn no_auto_free(self) -> Self
pub fn no_auto_free(self) -> Self
Disables automatic cleanup (shellcode won’t be freed on drop)
Use this if you want the shellcode to persist for the lifetime of the process.
Sourcepub fn near_address(self, target: usize) -> Self
pub fn near_address(self, target: usize) -> Self
Tries to load shellcode near a specific address (within branch range)
Use this if your shellcode contains relative branches to nearby code.
Sourcepub fn load(self) -> Result<LoadedShellcode, LoaderError>
pub fn load(self) -> Result<LoadedShellcode, LoaderError>
Loads the shellcode into memory with all configured options
This will:
- Allocate a code cave (optionally near a target)
- Resolve and apply symbol relocations
- Write the code to memory
- Flush the instruction cache
§Returns
Result<LoadedShellcode, LoaderError>- The loaded shellcode handle or an error
Auto Trait Implementations§
impl Freeze for ShellcodeBuilder
impl RefUnwindSafe for ShellcodeBuilder
impl Send for ShellcodeBuilder
impl Sync for ShellcodeBuilder
impl Unpin for ShellcodeBuilder
impl UnsafeUnpin for ShellcodeBuilder
impl UnwindSafe for ShellcodeBuilder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more