Skip to main content
GUIDEMobile & Android 4 views

[Guide] Android Unity Automation: frida-il2cpp-bridge + Python OpenCV & ADB Pipeline

For Android Unity IL2CPP analysis and UI automation on rooted devices or emulators, pairing [vfsfitvnm/frida-il2cpp-bridge](https://github.com/vfsfitvnm/frida-il2cpp-bridge) with OpenCV and ADB lets you combine internal state inspection with visual verification.

1. Dynamic Runtime Hooking via Frida (agent.ts)

Instead of relying solely on static global-metadata.dat dumps, frida-il2cpp-bridge resolves classes, fields, and methods directly from libil2cpp.so at runtime:

typescript
import "frida-il2cpp-bridge";

Il2Cpp.perform(() => {
    console.log(`Unity Version: ${Il2Cpp.unityVersion}`);
    const PlayerController = Il2Cpp.domain
        .assembly("Assembly-CSharp")
        .image.class("PlayerController");

    const updateMethod = PlayerController.method("Update");
    updateMethod.implementation = function (...args) {
        return updateMethod.invoke(...args);
    };
});

2. Visual Matching via Python OpenCV + ADB

Capture framebuffers over adb exec-out screencap -p, decode into NumPy arrays with cv2.imdecode, and run cv2.matchTemplate before dispatching adb shell input tap x y.

Architecture Pitfall on Emulators

Always match your frida-server binary (arm64 vs x86_64) to the emulator's ABI, or use native ARM emulation images if libhoudini translation prevents Frida from resolving libil2cpp.so.

Open Sponsor Slot (IN THREAD)
Book Slot

0 replies

Log in to reply or react to threads.