nowsecure / r2frida

Radare2 and Frida better together.
MIT License
1.18k stars 121 forks source link

Unable to use r2frida on debian distros? #47

Closed alvarofe closed 7 years ago

alvarofe commented 7 years ago

I got this error in two different machines. One of them running ubuntu and debian in the other.

ns352728:~ alvaro$ r2 frida://cat
Cannot create script: Script(line 3544): SyntaxError: invalid escape
Cannot open 'frida://cat'
ns352728:git alvaro$ node --version
v6.9.5
ns352728:git alvaro$ frida-trace -i "write" cat
Attaching...Resolving functions...Instrumenting functions...
write: Auto-generated handler at "/home/alvaro/.config/radare2/r2pm/git/__handlers__/libpthread_2.19.so/write.js"
write: Auto-generated handler at "/home/alvaro/.config/radare2/r2pm/git/__handlers__/libc_2.19.so/write.js"
Started tracing 2 functions. Press Ctrl+C to stop.
           /* TID 0x4128 */
  5045 ms  write(fd=0x1, buf=0x7f463b50d000, count=0x6)
ns352728:git alvaro$ frida --version
9.1.7

The line 3544 at _agent.js is

var c = v <= 0x7f ? String.fromCharCode(v) : '\\x' + v.toString(16);

I am not an expert on js, but I would say that line is valid. Node issue?

trufae commented 7 years ago

Which version of node do you have? Its 2017 you should have at least node 6.9.5

On 19 Feb 2017, at 12:19, Álvaro Felipe Melchor notifications@github.com wrote:

I got this error in two different machines. One of them running ubuntu and debian in the other.

ns352728:~ alvaro$ r2 frida://cat Cannot create script: Script(line 3544): SyntaxError: invalid escape Cannot open 'frida://cat' ns352728:git alvaro$ node --version v6.9.5 ns352728:git alvaro$ frida-trace -i "write" cat Attaching...Resolving functions...Instrumenting functions... write: Auto-generated handler at "/home/alvaro/.config/radare2/r2pm/git/handlers/libpthread_2.19.so/write.js" write: Auto-generated handler at "/home/alvaro/.config/radare2/r2pm/git/handlers/libc_2.19.so/write.js" Started tracing 2 functions. Press Ctrl+C to stop. / TID 0x4128 / 5045 ms write(fd=0x1, buf=0x7f463b50d000, count=0x6) ns352728:git alvaro$ frida --version 9.1.7 The line 3544 at _agent.js is

var c = v <= 0x7f ? String.fromCharCode(v) : '\x' + v.toString(16); I am not an expert on js, but I would say that line is valid. Node issue?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

alvarofe commented 7 years ago

I wrote in the issue

ns352728:git alvaro$ node --version
v6.9.5
oleavr commented 7 years ago

I suspect this is an issue with the Makefile target that generates a header file from the .js on disk: https://github.com/nowsecure/r2frida/blob/639ec9b389a1dc159839f2fd4142a35a06d83569/Makefile#L93-L97 Perhaps there's a subtle difference in how awk behaves?

alvarofe commented 7 years ago

Yep, I installed gawk and it does work now. Thanks!!