KittyMemory is a native C++ library for runtime memory patching, scanning, dumping, and module (ELF / Mach-O) introspection, targeting Android and iOS.
- Memory patching & backup —
MemoryPatch/MemoryBackup: snapshot-then-modify-then-restore workflows for arbitrary code or data, built from raw bytes, a hex string, or hand-written assembly (via Keystone). - Pattern scanning —
KittyScanner::findBytesFirst/All,findHexFirst/All,findIdaPatternFirst/All,findDataFirst/All: byte-mask, hex-mask, IDA-style ("33 ? 55 66 ? 77 88 ? 99"), and exact raw-value search, with a fast in-process mode and a safe syscall-based mode (setPatternScanSafeMode) that skips unmapped pages instead of crashing. - ELF introspection (Android)
ElfScannerparses a loaded library's program headers, dynamic section, and symbol/hash tables directly out of memory (no need for the file on disk), including libraries mapped from inside a split APK/zip.- Symbol lookup covers both the live dynamic symbol table (
findSymbol) and on-disk debug symbols (dsymbols,findDebugSymbol— for symbols not dynamically exported). - Segment discovery exposes the module's main segment (
baseSegment()), all mapped segments (segments()), and its BSS segments (bssSegments()), each as aKittyMemory::ProcMap.
- Native & Emulated solist walking (Android)
LinkerScannerwalks the Android dynamic linker's internalsolistto enumerate every natively-loaded library.NativeBridgeScannerdoes the same for libraries running under an ISA-emulation layer (libhoudini, libndk_translation), including detecting the implementation and the native-bridge callback table (nbItfData());NativeBridgeLinkerlets youdlopen/dlsym/dlclose/dladdr/dl_iterate_phdrdirectly into those emulated libraries.
- Mach-O introspection (iOS)
MachOImageresolves a loaded image (app binary or a named framework/dylib, viafindMachOImage/getMainImage/getAllImages).- Symbol lookup via
symbols()(all non-STAB symbols) andfindSymbol(name). - Segment/section discovery via
segments()/sections()(all, keyed by name) andfindSegment("__TEXT")/findSection("__TEXT", "__text"). KittyMemory::getAbsoluteAddressturns an on-disk offset into a live ASLR-slid address.
- Memory maps (Android)
KittyMemory::ProcMapmodels one/proc/self/mapsentry (bounds, permissions, backing file).getAllMaps()/getMaps(EProcMapFilter, name)(Equal/Contains/StartWith/EndWith/Regex) /getAddressMap(address)enumerate and filter process mapsgetFileMappings(path)groups a backing file's mappings into contiguous runs (handling files split across multiple mappings).
- Memory regions (iOS)
KittyMemory::mem_range_info_tmodels one Machvm_region(bounds, protection/max-protection, name).getAllRegions()/getRegions(EMemRegionFilter, name)/getAddressRegion(address)enumerate and filter memory regiosn.getFileMappings(path)groups a backing file's mappings into contiguous runs, same semantics as the Android version.
- Instruction decoding —
KittyAsm(namespacesKittyArm32/KittyArm64) is a lightweight ARM32/ARM64 instruction decoder. - Memory dump utilities (Android & iOS)
KittyMemory::dumpMemToDiskdumps an arbitrary address range to a file.KittyMemory::dumpFileMappingsToDiskdumps every contiguous mapping of a memory-mapped file (e.g. Unity'sglobal-metadata.dat) to disk, one output file per mapping if it's split.
- ELF dumping (Android) —
ElfScanner::dumpToDiskwrites the loaded library's ELF image straight from memory to disk, useful for pulling packed/decrypted or renamed libraries. KittyUtilsVarious utilities.
- C++17 or newer.
- Android: NDK, API level 21 or newer.
- iOS: Theos or xcode for building tweaks/dylibs, deployment target iOS 14.0+.
- Keystone Assembler — only needed for
MemoryPatch::createWithAsm. Prebuilt static libraries for both platforms are already vendored underKittyMemory/Deps/Keystone; You can rebuild them yourself withDeps/Keystone/build_keystone_android.sh/build_keystone_ios.sh. If you don't want Keystone dependency then DefinekNO_KEYSTONEin your project's C++ flags (this removescreateWithAsm).
See example-android/README.md and example-ios/README.md for full NDK/CMake and Theos build instructions.