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

Dump timeout reached closes with incomplete dump #224

Closed bluewave41 closed 1 year ago

bluewave41 commented 1 year ago

Issue #99 says this warning is harmless but it's the opposite.

import "frida-il2cpp-bridge";

Il2Cpp.perform(() => {
    Il2Cpp.dump()
}

... il2cpp: dumping Unity.TextMeshPro... il2cpp: dumping UnityDLL... il2cpp: dumping UnityEngine.TestRunner... Failed to load script: timeout was reached

Thank you for using Frida! PS C:\Users\x\Desktop>

No dump is created. Sometimes a file is saved:

... il2cpp: dumping Assembly-CSharp-firstpass... il2cpp: dumping Assembly-CSharp... Failed to load script: timeout was reached il2cpp: dump saved to /storage/emulated/0/Android/data/com.spaceapegames.beatstar/files/com.spaceapegames.beatstar_unknown.cs

but it's about 140k lines short. The only way to properly dump anything I've found is

import "frida-il2cpp-bridge";

Il2Cpp.perform(() => {
    setTimeout(() => {
        Il2Cpp.dump()
    }, 1000);
}

Which isn't mentioned anywhere.

vfsfitvnm commented 1 year ago

That's not the proper way to dump. setTimeout will detach the thread from il2cpp

vfsfitvnm commented 1 year ago

You can try the following instead:

import "frida-il2cpp-bridge";

setTimeout(() => {
    Il2Cpp.perform(() => Il2Cpp.dump());
}, 1000);
bluewave41 commented 1 year ago

You can try the following instead:

import "frida-il2cpp-bridge";

setTimeout(() => {
    Il2Cpp.perform(() => Il2Cpp.dump());
}, 1000);

My method worked anyway and gave a full dump but alright. Maybe this should be added to the wiki snippets though?

import "frida-il2cpp-bridge";

Il2Cpp.perform(() => {
    // it will use default directory path and file name: /<default_path>/<default_name>.cs
    Il2Cpp.dump();

    // the file name is overridden: /<default_path>/custom_file_name.cs
    Il2Cpp.dump("custom_file_name");

    // the file name and directory path are overridden: /i/can/write/to/this/path/custom_file_name.cs
    Il2Cpp.dump("custom_file_name", "/i/can/write/to/this/path");
});

In cases like this none of the given will run to completion.

vfsfitvnm commented 1 year ago

It worked by accident - it works for your app but it won't work for others