frida / frida-compile

Compile a Frida script comprised of one or more Node.js modules
Other
186 stars 49 forks source link

Invalid tokens #60

Open wenq1 opened 1 year ago

wenq1 commented 1 year ago

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)
oleavr commented 1 year ago

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.

wenq1 commented 1 year ago

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

re100io commented 11 months ago

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...

NKU100 commented 9 months ago

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

Syth-1 commented 5 months ago

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 ./