oleavr / frida-agent-example

Example Frida agent written in TypeScript
https://www.frida.re/
725 stars 182 forks source link

_agent.js NOT like a normal js file #24

Closed 0x79H closed 2 years ago

0x79H commented 2 years ago

Hi. I checkout the latest version (c709844d8dd47df8955172db104c76ceed81d6c6). When i run npm run build (frida-compile agent/index.ts -o _agent.js -c) , the output file _agent.js include emoji, and it not like a normal js file. I also try npm run watch (frida-compile agent/index.ts -o _agent.js -w)

I try to find the reason. I found this at frida-compile , and understand the output is normal.

But i don't know why _agnet.js work in frida. Maybe it only work in Frida? Or new features of the js engine? Any helpful info?

I also try to find the parameters in frida-compile where I could get a normal javascript output file, but nothing there. What i miss?

Thanks.

oleavr commented 2 years ago

Hi,

The new frida-compile outputs a Frida-specific container format for multiple ESMs in a single .js, and that's what you're seeing.

Check out the new frida-tools -- there is now a frida-compile tool there and the REPL supports loading .ts files through -l.

Cheers!

ghost commented 2 years ago

Hi,

The new frida-compile outputs a Frida-specific container format for multiple ESMs in a single .js, and that's what you're seeing.

Check out the new frida-tools -- there is now a frida-compile tool there and the REPL supports loading .ts files through -l.

Cheers!

Can I use .ts files from a .py script similar to loading .js scripts?

ChiChou commented 2 years ago

Hi, The new frida-compile outputs a Frida-specific container format for multiple ESMs in a single .js, and that's what you're seeing. Check out the new frida-tools -- there is now a frida-compile tool there and the REPL supports loading .ts files through -l. Cheers!

Can I use .ts files from a .py script similar to loading .js scripts?

I have the same issue here

andreafioraldi commented 2 years ago

Hi, The new frida-compile outputs a Frida-specific container format for multiple ESMs in a single .js, and that's what you're seeing. Check out the new frida-tools -- there is now a frida-compile tool there and the REPL supports loading .ts files through -l. Cheers!

Can I use .ts files from a .py script similar to loading .js scripts?

I have the same issue here

+1

ChiChou commented 2 years ago

@andreafioraldi the problem is the line break on Windows. Mine solved by suppplying newline='\n' to open, then the rest remains the same

with (filename).open('r', encoding='utf8', newline='\n') as fp:
        return fp.read()
qiaozhi-4 commented 5 months ago

你好请问有解决吗

muniategui commented 3 months ago

你好请问有解决吗

Dude, you are writing just under the answer. If you are in windows open('r', encoding='utf8', newline='\n') the utf8 and \n has to be set. https://github.com/oleavr/frida-agent-example/issues/24#issuecomment-1219810181