vfsfitvnm / frida-il2cpp-bridge

A Frida module to dump, trace or hijack any Il2Cpp application at runtime, without needing the global-metadata.dat file.
https://github.com/vfsfitvnm/frida-il2cpp-bridge/wiki
MIT License
974 stars 199 forks source link

How to hook static method #292

Closed sosloop closed 1 year ago

sosloop commented 1 year ago
import "frida-il2cpp-bridge"

console.log("start");

Il2Cpp.perform(() => {

    console.log("unityVersion=" + Il2Cpp.unityVersion);

    const mscorlib = Il2Cpp.domain.tryAssembly("Assembly-CSharp")?.image
    if (mscorlib) {

        const StaticHelper= mscorlib.class("StaticHelper");
        const GoString = StaticHelper.method<Il2Cpp.String>('Go').invoke()
        console.log("GoString = " + GoString );
    }

})

frida.exe -U -p 10489 -l _.js --runtime=v8 --realm=emulated

Attaching... Failed to load script: the connection is closed

Attach mode injection ,this app is crash!

vfsfitvnm commented 1 year ago

Would you share mode details regarding the environment? I.e. the emulator you are using, the application you are instrumenting... What if you try to run the following command (don't load the script)?

frida.exe -U -p <whatever> --realm=emulated
sosloop commented 1 year ago
{
  "compilerOptions": {
    "target": "esnext",
    "lib": [
      "es2020"
    ],
    "experimentalDecorators": true,
    "module": "commonjs",
    "allowJs": true,
    "noEmit": true,
    "esModuleInterop": true,
    "strict": true,
    "moduleResolution": "node",
  },
  // "exclude": [
  //   "_.js"
  // ]
}

I have found the problem, because _.js added exclude,Just comment it out。