This guide explains how to generate the required emulator assets (memory_dump.bin and imports_map.txt) starting directly from an APK file. No Android device or Root access is required.
- Python 3.8+
- Unzip tool (7-Zip, WinRAR, or terminal
unzip) - Core Python Dependencies:
pip install capstone unicorn
An .apk file is just a ZIP archive.
- Rename your
game.apktogame.zip(optional, or just open with 7-Zip). - Extract the contents.
- Navigate to the native library folder:
- Path:
lib/arm64-v8a/
- Path:
- Locate the target library:
libbyteplusaudio.so(orlibmoba.soif targeting core logic).- Copy this
.sofile to your project root or know its path.
- Copy this
This script scans the library to find import offsets (e.g., specific addresses for send/recv).
# Usage: python scripts/scan_imports.py <path_to_so>
python scripts/scan_imports.py lib/arm64-v8a/libbyteplusaudio.soOutput: imports_map.txt will be created in the current directory.
This script simulates the OS loader in Python to create a memory snapshot, handling relocations automatically.
- Important: Ensure
scripts/dump_loader.pypoints to your extracted.so.- Edit
scripts/dump_loader.pyline 7:emu = AndroidEmulator("lib/arm64-v8a/libbyteplusaudio.so", "imports_map.txt")
- Edit
- Run the dumper:
python scripts/dump_loader.py
Output: memory_dump.bin (approx 16-32MB) in the current directory.
Now you have the two required files (imports_map.txt, memory_dump.bin).
You can start the emulator:
cd emulator_rust
cargo run --releaseIf the emulator doesn't find the expected API strings, the logic might be in a different library.
- Repeat Steps 2 & 3 with
libmoba.so(Core Game Logic). - Repeat Steps 2 & 3 with
libunity.so(Unity Engine IL2CPP). This script scans the ELF binary for relocation entries (PLT) and maps memory addresses to function names (e.g.,sendto,__android_log_write).
# Usage: python scripts/scan_imports.py <path_to_so>
python scripts/scan_imports.py path/to/libbyteplusaudio.soOutput: imports_map.txt in the current directory.
This script uses Unicorn Engine (Python) to "load" the library into memory, applying relocations using the imports_map.txt generated in Step 1. It then dumps the simulated memory to a file.
Note: Update
scripts/dump_loader.pyline 7 to point to your.sofile path if strictly needed, or ensure the default path matches.
# Usage: python scripts/dump_loader.py
python scripts/dump_loader.pyOutput: memory_dump.bin (approx 16MB).
Once both files are in the project root, you can run the Rust emulator:
cd emulator_rust
cargo run --release