[feat] plt hook inject

This commit is contained in:
rootacite
2025-10-28 03:26:37 +08:00
parent 28253d6806
commit 0c3ff27dad
5 changed files with 208 additions and 33 deletions

View File

@@ -0,0 +1,12 @@
use iced_x86::code_asm::asm_traits::CodeAsmJmp;
use iced_x86::{Instruction, code_asm::*};
pub fn assemble<F>(addr: u64, op: F) -> Result<Vec<u8>, Box<dyn std::error::Error>>
where
F: Fn(&mut CodeAssembler) -> Result<(), Box<dyn std::error::Error>>,
{
let mut asm = CodeAssembler::new(64)?;
_ = op(&mut asm);
Ok(asm.assemble(addr)?)
}