unidbg-cli-0.1.4 is not a library.
unidbg-rs
An idiomatic Rust port of unidbg — an ARM32 / Thumb / ARM64 emulator for Android ELF binaries/libraries and iOS Mach-O binaries/frameworks, without requiring a JVM.
Features (Parity with unidbg)
Core Framework (unidbg-api)
- CPU & Memory Abstraction:
Backendtrait,EmulatorCore,MemoryManager(rangemap-backedmmap,munmap,mprotect,brk,malloc/freewithalloc_sizetracking), andUnidbgPointer(32/64-bit). - SVC Bridge (
ArmSvcMemory): Generates ARM64 (SVC #imm; RET) and ARM32/Thumb (SVC #0; BX LR) trampolines for hooking native symbols and JNI callbacks. - Tracing & Disassembly:
AssemblyCodeDumper(capstone-powered ARM32/Thumb/ARM64 disassembly),TraceMemoryHook(filteredREAD/WRITEtracing), andRegAccessPrinter. - Hooking & Unwinding:
InlineHook(pure-Rust ARM64 & ARM32 trampolines),SimpleArmUnwinder/SimpleArm64Unwinderwithcpp_demangleC++ symbol demangling. - Debugging & Concurrency:
GdbServer: GDB Remote Serial Protocol (RSP) over TCP (?,qSupported,g,m,M,Z0,z0,s,c,k).WorkerPool: Multi-threaded worker pool running independent emulator instances per thread.- Cooperative
UniThreadDispatcher,SignalOps, andFileSystem/FileIO/IOResolvertraits.
Android Emulation (unidbg-android)
- ELF32 / ELF64 Dynamic Linker (
AndroidElfLoader):PT_LOADmapping with page alignment andMemoryPermenforcement.- ARM64 & ARM32 relocations (
RELATIVE,GLOB_DAT,JUMP_SLOT,ABS64/ABS32,IRELATIVE/IFUNC,DT_RELR). .preinit_array,.init,.init_array(including topological dependency initialization on ARM64) andET_EXEC/ PIEcall_entry.- Virtual linker & allocator hooks:
dlopen,dlsym,malloc,calloc,realloc,free,__system_property_get.
- Linux Syscalls & VFS (
LinuxFileSystem):- ARM32 EABI and ARM64
asm-genericsyscall dispatchers (openat,read,write,lseek,fstat,newfstatat,mmap,munmap,mprotect,brk,pipe2,uname,clock_gettime,gettimeofday,getrandom,clone+run_threads(),futex,exit/exit_group, etc.). - Virtual files (
/dev/urandom,/dev/null,/dev/zero,/proc/self/maps,/proc/self/cmdline,/proc/cpuinfo,/proc/meminfo, customIOResolvers).
- ARM32 EABI and ARM64
- DalvikVM & JNI Bridge (
dvm):DalvikVM(32-bit & 64-bit) withJavaVM+ 233-entryJNIEnvtable,LocalRef/GlobalRef,RegisterNatives,DvmClassinheritance (GetSuperclass),DvmObject(String,ByteArray,IntArray,ObjectArray,Boolean,Int,Long).- AAPCS32 & AAPCS64
VaListargument decoding. Jnitrait with fail-softAbstractJnidefaults andApkLibraryFile(loading.sodirectly from.apkarchives).- Virtual modules:
AndroidModule,JniGraphics,MediaNdkModule,SystemProperties.
- PLT/GOT Hooking:
XHook(register+refresh).
iOS Emulation (unidbg-ios)
- Mach-O & Dyld (
MachOLoader): Mach-O 32/64 and Fat/Universal binary loading viagoblin::mach, plusFixupChains(apply_64_rebase_chain). - Darwin Syscalls & IPA (
IpaLoader): BSD syscalls + Mach traps (svc #0x80) and.ipa/Info.plistparsing (zip+plist). - ObjC & Hooking:
ObjcRuntime(objc_getClass,sel_registerName,objc_msgSend),FishHook, andSubstrate.
CPU Backends
| Backend | Crate | Status |
|---|---|---|
Unicorn2 (unicorn-engine) |
backend/unicorn2 |
Ready (ARM32, Thumb, ARM64) |
Apple Hypervisor (Hypervisor.framework) |
backend/hypervisor |
Experimental (macOS Apple Silicon ARM64) |
| Dynarmic | backend/dynarmic |
Planned (Phase 7) |
| Linux KVM | backend/kvm |
Planned (Phase 7) |
Workspace Structure
unidbg-rs/
├── crates/
│ ├── unidbg-api/ # Core traits, memory, SVC, hooks, trace, GDB RSP, worker pool
│ ├── unidbg-android/ # Android ELF loader, Linux syscalls, VFS, DalvikVM/JNI, XHook
│ ├── unidbg-ios/ # Mach-O loader, Darwin syscalls, IPA loader, ObjC, FishHook/Substrate
│ └── unidbg-cli/ # CLI tool (`exec`, `jni`, `gdb`)
├── backend/
│ ├── unicorn2/ # Unicorn Engine 2 backend
│ ├── hypervisor/ # macOS Hypervisor.framework backend
│ ├── dynarmic/ # Dynarmic backend (WIP)
│ └── kvm/ # Linux KVM backend (WIP)
├── docs/ # Architecture, crate mapping, and roadmap checklists
└── unidbg/ # Upstream Java unidbg submodule (zhkl0228/unidbg)
Getting Started
Prerequisites
- Rust toolchain (stable, Edition 2021+)
- C/C++ toolchain & CMake (required by
unicorn-engine/capstonesys crates)
Clone & Test
(If you already cloned without --recursive, run git submodule update --init --recursive to fetch unidbg/ resources used by integration tests.)
Use as a Cargo Dependency
Add the crates you need from crates.io in your Cargo.toml:
[]
= "0.1"
= "0.1"
= "0.1"
# For iOS emulation:
# unidbg-ios = "0.1"
Or install the CLI directly:
(Alternatively, to track the latest development commits on GitHub, use { git = "https://github.com/2noScript/unidbg-rs", branch = "main" } consistently across all unidbg-* crates rather than mixing crates.io and git sources.)
Quick Example (Rust)
use DalvikVM;
use AndroidEmulatorBuilder;
use AndroidResolver;
use ;
use UnicornBackend;
let backend = Boxnew;
let mut emu = for_64_bit
.process_name
.resolver
.build?;
let vm = init?;
let module = emu.load_library?;
emu.call_init_functions?;
let jni_ver = vm.call_jni_onload?;
CLI Usage (unidbg-cli)
# Run an ELF executable
# Call a JNI method
# Start a GDB RSP server
Documentation
- Architecture Overview
- Rust Ecosystem & Crate Mapping
- Roadmap & Progress Checklists
- Structure Mapping (
unidbg->unidbg-rs)
License & Attribution
- Licensed under the Apache-2.0 License.
- Built with reference to zhkl0228/unidbg.