frida-compile icon indicating copy to clipboard operation
frida-compile copied to clipboard

Invalid tokens

Open wenq1 opened this issue 1 year ago • 5 comments

Just out of curiosity, why are the invalid tokens in the generated output?

in frida-agent-example,

$ npx frida-compile agent/index.ts -o _agent.js -c
image

This doen's look valid javascript by the way..., that is to say,

% node _agent.js 
/Users/wc/scratch/frida-tools/frida-agent-example/_agent.js:1
📦
^

SyntaxError: Invalid or unexpected token
    at Object.compileFunction (node:vm:352:18)

wenq1 avatar Jan 29 '23 08:01 wenq1

The output is not JavaScript, it's a simple container format (Frida-specific) for a bundle of ES Modules. It's in a human-readable text-encoding though to make it easy to inspect.

oleavr avatar Jan 29 '23 08:01 oleavr

I see. thanks. Anyway to turn it off so that I can generate a quick bundled agent.js for injection?

wenq1 avatar Jan 31 '23 10:01 wenq1

I met the same problem too and it still bothers me too, is it because version of node of python? I tried but not work...

re100io avatar Oct 18 '23 14:10 re100io

How did this problem finally be solved? I also want to generate a JS file that can be run directly.

NKU100 avatar Dec 03 '23 06:12 NKU100

i was running into issues with this when using evaluate with objection, using bun (or any bundler for that matter) pointing towards your entry script (index.ts) fixed this!

for bun the command used: bun build ./agent/index.ts --outdir ./

Syth-1 avatar Apr 12 '24 19:04 Syth-1