javascriptsyntax-errorfrida

Problem with installing frida module (frida-il2cpp-bridge) and make it running


1 - I have installed frida with python.

2 - Then I download frida-il2cpp-bridge and use npm install --save-dev frida-il2cpp-bridge.

3 - I create js script

import "frida-il2cpp-bridge";

console.log("Script loaded successfully ..... ");

async function main() {
    await Il2Cpp.initialize();
    const domain = await Il2Cpp.Domain.get();
    console.log("il2cpp loaded at ",domain);
}

main().catch(error => console.log(error.stack));

4 - I put javascript file with frida-il2cpp-bridge.

5 - I run frida with: frida --no-pause -U -l ./frida-il2cpp-bridge.js -f com.example.app.

But it gives this error text:

Failed to load script: script(line 1): SyntaxError: expecting '('


Solution

  • First of all install Node-v16*.exe and Git-2*.exe.. Create new folder anywhere you want (like D:\il2cpp-bridge) Open command prompt from created folder and type

    $ git clone https://github.com/oleavr/frida-agent-example.git
    $ cd frida-agent-example/
    $ npm install -g typescript
    $ npm install
    $ npm install --save-dev frida-il2cpp-bridge
    $ npm run watch
    

    Open index.ts file from agent folder and replace all text

    import "frida-il2cpp-bridge";
    console.log("Rebuilded")
    
    
    Il2Cpp.perform(() => {
        
        Il2Cpp.dump().fileName("dump.cs").classes().build();        
        
    });
    

    *This script will dump your game

    Done! Now you can spawn your game with attached _agent.js like

    frida -Uf com.example.app -l _agent.js --no-pause
    

    P.S. Make sure that your cmd with "npm run watch" command allways still active. It will rebuild your _agent.js file every time you will modify your index.ts