Loading...
Loading...
Debug and emulate specific code fragments or functions using the Unicorn engine. Activate when the user wants to emulate a function with Unicorn, trace binary execution without running the full program, decrypt or decode data by emulating the algorithm, or bypass environment dependencies (JNI, syscalls, libc) during emulation.
npx skill4agent add p4nda0s/reverse-skills rev-unicorn-debug| Category | Examples | Simulation Strategy |
|---|---|---|
| libc | | Hook address, implement logic in Python (bump allocator for malloc) |
| JNI | | Build fake JNIEnv function table in UC memory, write RET stubs at each entry, hook stub addresses |
| Syscalls | | Hook |
| C++ runtime | | Hook and simulate |
| Library calls | | Hook and return success/stub |
UC_HOOK_CODE| Callback | Purpose |
|---|---|
| Intercept import calls by address; instruction-level trace (use sparingly, narrow range only) |
| Block-level trace (preferred over instruction trace) |
| Auto-map missing pages to recover from unmapped access errors |
| Trace memory access on targeted data ranges only |
| Intercept SVC/INT for syscall simulation |
| Arch | Uc Const | Mode | SP | LR | Args | Return | Syscall |
|---|---|---|---|---|---|---|---|
| ARM64 | | | SP | X30 | X0-X7 | X0 | X8 + SVC #0 |
| ARM32 | | | SP | LR | R0-R3 | R0 | R7 + SVC #0 |
| x86-64 | | | RSP | (stack) | RDI,RSI,RDX,RCX,R8,R9 | RAX | RAX + syscall |
| x86-32 | | | ESP | (stack) | (stack) | EAX | EAX + int 0x80 |
| MIPS32 | | | $sp | $ra | $a0-$a3 | $v0 | $v0 + syscall |