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
946 stars 194 forks source link

Game can't be dump #308

Closed thienha1 closed 1 year ago

thienha1 commented 1 year ago

Capture I dont know this happen for now, old version of this game work normal! Maybe they obfuscated all name?

Source code:

Il2Cpp.perform(() => {
  // console.log(Il2Cpp.unityVersion);
    Il2Cpp.dump("hsrsea.cs");
});
commonuserlol commented 1 year ago

mihoyo games have modified il2cpp binaries and hidden exports. thats why it don't work with common il2cpp tools

vfsfitvnm commented 1 year ago

"No such file or directory" means it couldn't create the file where to write the dump, pass the directory as the second parameter: https://github.com/vfsfitvnm/frida-il2cpp-bridge/blob/ae7ef9ea2ca0e33fe50994179b2a4751541549e4/src/il2cpp/dump.ts#L3

(and make sure it exists!)

commonuserlol commented 1 year ago

hmm ik that genshin (mobile version, idk about pc) have protections like hidden exports, encrypted metadata, etc... maybe hsr still not

thienha1 commented 1 year ago

"No such file or directory" means it couldn't create the file where to write the dump, pass the directory as the second parameter:

https://github.com/vfsfitvnm/frida-il2cpp-bridge/blob/ae7ef9ea2ca0e33fe50994179b2a4751541549e4/src/il2cpp/dump.ts#L3

(and make sure it exists!)

I created this file Capture

And still got this error Capture Code:

Il2Cpp.perform(() => {
  // console.log(Il2Cpp.unityVersion);
    Il2Cpp.dump("hsrsea.cs", "D:\APKLabs\Dumped Honkai Star Rail SEA");
}, "free");
thienha1 commented 1 year ago

hmm ik that genshin (mobile version, idk about pc) have protections like hidden exports, encrypted metadata, etc... maybe hsr still not

yeah mihoyo did that but still i dunno how modder could dump those encrypted file in PC... What tools they use?

commonuserlol commented 1 year ago

idk sorry, you can try explore cheats for these games (akebi source available only for 3.2, i seen some hsr cheat). maybe it will help u

vfsfitvnm commented 1 year ago

@thienha1 Oh yeah I think I know what's wrong (I don't have Windows so I can't really test...).

Here's how I generate the full path: https://github.com/vfsfitvnm/frida-il2cpp-bridge/blob/ae7ef9ea2ca0e33fe50994179b2a4751541549e4/src/il2cpp/dump.ts#L6

But as you can see, I use the Unix file separator char (/) - illegal on Windows - instead of the correct one (\).

Would you patch either your local copy (node_modules/frida-il2cpp-bridge/dist/index.js) or the bundled script (_agent.js) and see if it works?

thienha1 commented 1 year ago

@thienha1 Oh yeah I think I know what's wrong (I don't have Windows so I can't really test...).

Here's how I generate the full path:

https://github.com/vfsfitvnm/frida-il2cpp-bridge/blob/ae7ef9ea2ca0e33fe50994179b2a4751541549e4/src/il2cpp/dump.ts#L6

But as you can see, I use the Unix file separator char (/) - illegal on Windows - instead of the correct one (\).

Would you patch either your local copy (node_modules/frida-il2cpp-bridge/dist/index.js) or the bundled script (_agent.js) and see if it works?

I updated your script to latest version Capture But I tried this function dump without parameter 2 before of this game in old version, it work smoothly! Now I tried all of this with latest version for now, not work at all!

vfsfitvnm commented 1 year ago

@thienha1 Hmm, this is weird to be honest. However, just to make sure, would you replace the / with \ at line 648? And then:

Il2Cpp.perform(() => {
    Il2Cpp.dump("hsrsea.cs", "D:\APKLabs\Dumped Honkai Star Rail SEA");
}, "free");

Another possibility is the app cannot write to that path, but again, I have no idea how it works on Windows; does the following Frida script works?

const file = new File("D:\APKLabs\Dumped Honkai Star Rail SEA\hello.cs", "w");
file.write("hello!");
file.flush();
file.close();
vfsfitvnm commented 1 year ago

And, shouldn't it be: D:\\<and so on>? Notice the double backslash

thienha1 commented 1 year ago

And, shouldn't it be: D:\\<and so on>? Notice the double backslash

Yeah, it temp working and get other issue... Capture

vfsfitvnm commented 1 year ago

You need to determine the Unity version by yourself (it doesn't have to be precise, though), then. Unfortunately I don't have Windows so I cannot find a workaround by myself.

Then, see https://github.com/vfsfitvnm/frida-il2cpp-bridge/issues/96#issuecomment-1042788077