### Get Process Memory Maps (C++) Source: https://context7.com/antikmods/sysdexdump/llms.txt Retrieves a list of all memory regions (maps) for a specific library or the entire process. It requires the 'mem.h' header and the process ID. Each memory map entry contains start and end addresses, size, permissions (read, write, execute, private), offset, and pathname. This information is crucial for understanding memory layout and identifying accessible regions. ```cpp #include "mem.h" // Get all memory maps for a library Memory::g_pid = 12345; std::vector maps = Memory::GetMaps("libil2cpp.so", Memory::g_pid); for (const auto& map : maps) { printf("Region: 0x%llx - 0x%llx\n", map.startAddress, map.endAddress); printf(" Size: %zu bytes\n", map.length); printf(" Perms: %s%s%s%s\n", (map.perms & Prot_READ) ? "r" : "-", (map.perms & Prot_WRITE) ? "w" : "-", (map.perms & Prot_EXEC) ? "x" : "-", (map.perms & Prot_PRIV) ? "p" : "s"); printf(" Offset: 0x%llx\n", map.offset); printf(" Path: %s\n", map.pathname.c_str()); } // Find all writable regions in a library for (const auto& map : maps) { if (map.perms & Prot_WRITE) { printf("Writable region at: 0x%llx (size: %zu)\n", map.startAddress, map.length); // Scan this region for specific values for (uintptr_t addr = map.startAddress; addr < map.endAddress; addr += 4) { int value = Memory::Read(addr); if (value == 12345) { printf("Found target value at: 0x%lx\n", addr); } } } } ``` -------------------------------- ### Retrieve Module Base Address (C++) Source: https://context7.com/antikmods/sysdexdump/llms.txt Retrieves the base address of a loaded library within a target process. It requires the 'mem.h' header and the process ID. The function can find both the start and end addresses of a module, allowing for the calculation of its size. This is useful for determining memory ranges for further analysis or patching. ```cpp #include "mem.h" // Find base address of main game library Memory::g_pid = 12345; uintptr_t il2cppBase = Memory::GetBase("libil2cpp.so", Memory::g_pid); uintptr_t unityBase = Memory::GetBase("libunity.so", Memory::g_pid); if (il2cppBase) { printf("IL2CPP Base: 0x%lx\n", il2cppBase); // Calculate offsets from base uintptr_t targetFunction = il2cppBase + 0x123456; // Read function pointer uintptr_t funcPtr = Memory::ReadPtr(targetFunction); } // Get library end address uintptr_t il2cppEnd = Memory::GetEnd("libil2cpp.so", Memory::g_pid); size_t librarySize = il2cppEnd - il2cppBase; printf("Library size: %zu bytes\n", librarySize); // Example: Scan entire library for patterns unsigned char pattern[] = {0x48, 0x8B, 0x05}; const char* mask = "xxx"; uintptr_t found = Memory::FindPattern( il2cppBase, librarySize, pattern, mask ); ``` -------------------------------- ### Build SysDexDump Tool with AIDE or NDK Source: https://context7.com/antikmods/sysdexdump/llms.txt Provides instructions for compiling the SysDexDump tool using either the AIDE Android IDE or the Android NDK command-line tools. It covers building for different architectures (ARM64, ARM32, all) and includes steps for cleaning builds and pushing the compiled binary to a device for testing. ```bash # Method 1: Build with AIDE Android IDE # 1. Install AIDE from Google Play # 2. Ensure NDK 64-bit is installed in AIDE # 3. Open project in AIDE # 4. Tap "Build Compile & Run" # Binary will be at: app/src/main/jni/prebuild/arm64-v8a/SysDexDump # Method 2: Build with Android NDK (command line) cd /path/to/SysDexDump export NDK_HOME=/path/to/android-ndk # Build for ARM64 cd app/src/main/jni $NDK_HOME/ndk-build APP_ABI=arm64-v8a # Output: libs/arm64-v8a/SysDexDump # Build for ARM32 $NDK_HOME/ndk-build APP_ABI=armeabi-v7a # Output: libs/armeabi-v7a/SysDexDump # Build for all architectures $NDK_HOME/ndk-build APP_ABI=all # Method 3: Build with Gradle (Android Studio) ./gradlew assembleDebug # Binary embedded in: app/build/outputs/apk/debug/app-debug.apk # Clean build $NDK_HOME/ndk-build clean $NDK_HOME/ndk-build # Push to device and test adb push libs/arm64-v8a/SysDexDump /data/local/tmp/ # adb shell chmod +x /data/local/tmp/SysDexDump # adb shell su -c "/data/local/tmp/SysDexDump --help" ``` -------------------------------- ### Dump DEX Files from Running Android App Source: https://context7.com/antikmods/sysdexdump/llms.txt A command-line tool to scan a running Android application's memory, extract all DEX files, and package them into a ZIP archive. It supports basic usage, multi-process selection, and integrates with ADB for real-world workflows. The tool can also dump from multiple apps in batch. ```bash # Basic usage - dump DEX files from a running app ./SysDexDump com.example.targetapp /data/local/tmp/output # Example output: # [12:34:56] Scanning - Searching for DEX memory regions... # Target PID: 12345 (com.example.targetapp) # [12:34:57] Dumping - Starting DEX dump process... # [12:34:57] Dumped - Saved /data/local/tmp/output/1.dex (2845672 bytes) # [12:34:58] Dumped - Saved /data/local/tmp/output/2.dex (1024356 bytes) # [12:34:58] Dumped - Saved /data/local/tmp/output/3.dex (512489 bytes) # [12:34:58] Packaging - Creating ZIP # [12:34:59] Complete - Dump complete Total => 3 # Multi-process selection (when app has multiple processes) ./SysDexDump com.game.app /sdcard/dumps # © @aantik_mods # # Multiple processes found: # ---------------------------------- # [1] DexDumpV1 -> PID: 12345 (com.game.app) # [2] DexDumpV2 -> PID: 12346 (com.game.app:remote) # [3] DexDumpV3 -> PID: 12347 (com.game.app:push) # ---------------------------------- # Select PID (1-3): 1 # Real-world workflow adb push SysDexDump /data/local/tmp/ adb shell chmod +x /data/local/tmp/SysDexDump adb shell su -c "/data/local/tmp/SysDexDump com.target.app /data/local/tmp/dex_output" adb pull /data/local/tmp/dex_output.zip ./ # Dump from multiple apps in batch for pkg in com.app1 com.app2 com.app3; do ./SysDexDump "$pkg" "/data/local/tmp/${pkg}_dump" done ``` -------------------------------- ### Execute Shell Commands on Android Source: https://context7.com/antikmods/sysdexdump/llms.txt Enables the execution of shell commands on an Android device, with options for superuser privileges and capturing command output. This is valuable for system-level interactions, file manipulation, and information gathering. It utilizes functions from 'ReadPid.h' and 'mem.h'. ```cpp #include "ReadPid.h" // Execute shell command with su privileges ExecuteShell("chmod", "777 /data/local/tmp/dumped.dex"); // Kill an application KillAPP("com.example.targetapp"); // Alternative: Use Memory::Exec for command output #include "mem.h" std::string output = Memory::Exec("pm list packages | grep game"); printf("Packages:\n%s\n", output.c_str()); // Get device architecture std::string arch = Memory::Exec("getprop ro.product.cpu.abi"); printf("Architecture: %s\n", arch.c_str()); // Check if process is running std::string pidStr = Memory::Exec("pidof com.example.game"); if (!pidStr.empty()) { pid_t pid = strtol(pidStr.c_str(), nullptr, 10); printf("Process running with PID: %d\n", pid); } // Example: Automated dumping workflow ExecuteShell("mkdir", "-p /data/local/tmp/dumps"); // ... perform dump operations ... ExecuteShell("chmod", "-R 777 /data/local/tmp/dumps"); ``` -------------------------------- ### IDA-Style Pattern Scanning in Process Memory (C++) Source: https://context7.com/antikmods/sysdexdump/llms.txt Searches for byte patterns within a specified range of a remote process's memory using IDA-style syntax with wildcard support. It supports finding the first occurrence, all occurrences, and parallel scanning for efficiency. Includes pattern validation. ```cpp #include "PatternScanner.h" // Initialize target process Memory::g_pid = 12345; // Find first occurrence of a pattern // Pattern: "dex\n" header followed by any 4 bytes uintptr_t start = 0x70000000; uintptr_t end = 0x80000000; uintptr_t dexLocation = PatternScanner::find_ida_first( start, end, "64 65 78 0A ?? ?? ?? ??", // "dex\n" + wildcards Memory::g_pid ); if (dexLocation) { printf("Found DEX at: 0x%lx\n", dexLocation); } // Find all occurrences of a pattern std::vector results = PatternScanner::find_ida_all( start, end, "48 8B ?? ?? 89", // x86_64 instruction pattern Memory::g_pid ); for (auto addr : results) { printf("Pattern found at: 0x%lx\n", addr); } // Use parallel scanning for large memory regions uintptr_t found = PatternScanner::find_first_parallel( start, end, (const unsigned char*)"\x48\x8B\x00\x00\x89", "xx??x", 8, // 8 threads Memory::g_pid ); // Validate pattern before scanning std::string pattern = "DE AD BE EF ?? ?? ?? ??"; if (PatternScanner::validate_ida_pattern(pattern)) { uintptr_t location = PatternScanner::find_ida_first(start, end, pattern, Memory::g_pid); } ``` -------------------------------- ### Retrieve Module Base Address from Split APK (C++) Source: https://context7.com/antikmods/sysdexdump/llms.txt Retrieves the base address of a native library located within a split APK (Android App Bundle). It requires the 'mem.h' header, the process ID, the name of the split configuration, and the library name. The function can also provide the end address to determine the library's size. This is essential for accessing libraries packaged in multi-part APKs. ```cpp #include "mem.h" // Target process Memory::g_pid = 12345; // Find library in split APK (Android App Bundle) uintptr_t splitLibBase = Memory::GetBaseInSplit( "split_config.arm64_v8a", // Split name "libgame.so", // Library name Memory::g_pid ); if (splitLibBase) { printf("Split library base: 0x%lx\n", splitLibBase); uintptr_t splitLibEnd = Memory::GetEndInSplit( "split_config.arm64_v8a", "libgame.so", Memory::g_pid ); size_t libSize = splitLibEnd - splitLibBase; printf("Split library size: %zu bytes\n", libSize); // Now you can read/scan this library int value = Memory::Read(splitLibBase + 0x1000); } // Example: Multiple split APK support const char* splits[] = { "split_config.arm64_v8a", "split_config.armeabi_v7a", "split_config.x86_64" }; for (auto split : splits) { uintptr_t base = Memory::GetBaseInSplit(split, "libcore.so"); if (base) { printf("Found in split %s at 0x%lx\n", split, base); break; } } ``` -------------------------------- ### Find Android Process by Package Name Source: https://context7.com/antikmods/sysdexdump/llms.txt Locates a running Android process by its package name and returns its Process ID (PID). This is useful for targeting specific applications for memory operations or monitoring. It relies on the 'mem.h' and 'ReadPid.h' headers for functionality. ```cpp #include "mem.h" // Find process by package name pid_t pid = Memory::FindPid("com.example.game"); if (pid > 0) { printf("Found process: %d\n", pid); Memory::g_pid = pid; // Now you can perform memory operations uintptr_t base = Memory::GetBase("libgame.so"); if (base) { printf("Game library at: 0x%lx\n", base); } } else { printf("Process not found\n"); } // Example: Monitor process lifecycle const char* packageName = "com.game.app"; while (true) { pid_t currentPid = Memory::FindPid(packageName); if (currentPid > 0 && currentPid != Memory::g_pid) { printf("Process started/restarted: %d\n", currentPid); Memory::g_pid = currentPid; // Reinitialize hooks, patches, etc. } sleep(1); } // Alternative: Use ReadPid function #include "ReadPid.h" pid_t gamePid = ReadPid("com.example.game"); if (gamePid > 0) { Pid = gamePid; Module1 = ReadModule("libgame.so", 1); printf("Module base: 0x%lx\n", Module1); } ``` -------------------------------- ### Write to Remote Process Memory (C++) Source: https://context7.com/antikmods/sysdexdump/llms.txt Writes data to a remote process's memory with validation and error handling. Supports writing single values, structures, and uses low-level APIs with error checking. An alternative IO method is also available. ```cpp #include "mem.h" // Set target process Memory::g_pid = 12345; // Write a single value int newHealth = 100; bool success = Memory::Write(0x7000001000, newHealth); // Write a structure struct GameState { int level; int score; bool unlocked; }; GameState state = {5, 9999, true}; success = Memory::Write(0x7000002000, state); // Write using low-level API with error handling float position[3] = {100.5f, 200.0f, 50.25f}; int result = Memory::ProcessWrite((void*)0x7000003000, position, sizeof(position), Memory::g_pid); if (result == 0) { printf("Successfully updated position\n"); } // Write using IO method (alternative approach) uint32_t value = 0xDEADBEEF; bool written = Memory::WriteIO(0x7000004000, &value, sizeof(value), Memory::g_pid); ``` -------------------------------- ### Search for Byte Patterns with Explicit Mask (C++) Source: https://context7.com/antikmods/sysdexdump/llms.txt Searches for a specific byte pattern within a given memory region using an explicit mask string. It requires the 'mem.h' header and a target process PID. The function returns the address of the first occurrence of the pattern or 0 if not found. It can also be used to read data at offsets relative to the found pattern. ```cpp #include "mem.h" // Initialize target process Memory::g_pid = 12345; // Define pattern and mask unsigned char pattern[] = {0x55, 0x48, 0x89, 0xE5, 0x48, 0x83, 0xEC}; const char* mask = "xxxxxxx"; // Search in a specific memory range uintptr_t baseAddress = Memory::GetBase("libil2cpp.so"); size_t searchLength = 0x100000; // 1MB uintptr_t result = Memory::FindPattern( baseAddress, searchLength, pattern, mask ); if (result) { printf("Pattern found at offset: 0x%lx\n", result - baseAddress); // Read data at found location uint32_t value = Memory::Read(result + 0x10); printf("Value at offset +0x10: 0x%x\n", value); } // Example: Find function prologue in game library unsigned char funcPrologue[] = {0x55, 0x89, 0xE5}; const char* prologueMask = "xxx"; uintptr_t functionAddr = Memory::FindPattern( baseAddress, 0x500000, funcPrologue, prologueMask ); ``` -------------------------------- ### Read Remote Process Memory (C++) Source: https://context7.com/antikmods/sysdexdump/llms.txt Reads data from a remote process's memory using the process_vm_readv syscall, with a fallback to /proc/pid/mem IO operations. It supports reading single values, structures, and arrays, and includes error checking. ```cpp #include "mem.h" // Initialize with target process PID Memory::g_pid = 12345; // Read a single value from memory int value = Memory::Read(0x7000000000); // Read a structure from memory struct PlayerData { int health; float position[3]; char name[32]; }; PlayerData player = Memory::Read(0x7000001000); // Read an array of values int* array = Memory::ReadArray(0x7000002000, 100); // Process array data... delete[] array; // Read with error checking uintptr_t address = 0x7000003000; char buffer[256]; int result = Memory::ProcessRead(address, buffer, sizeof(buffer), Memory::g_pid); if (result == 0) { // Successfully read data printf("Data: %s\n", buffer); } else { printf("Failed to read memory\n"); } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.