nowsecure / r2frida

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

[WINDOWS] r2frida not working (KNOWN BUG) #444

Closed Abdelrahmanamhawy closed 4 months ago

Abdelrahmanamhawy commented 1 year ago

Here is the installation process :

IssueWithDebugger

Although i didn't use the VC compiler as written in the instructions . When i write r2 in cmd it 's fine and no errors,but when i write "r2 'frida://0'" i get an error saying "ERROR: Cannot open ''frida://0''" Anybody knows how to solve this ? Also, i downloaded the r2frida-5.7.8-w64 from release ,and put the io-frida.dll file in the radare2 's bin folder,but still the error is there . Any help with this ?

trufae commented 1 year ago

Looks like you dont have the radare2\ directory in the source directory. also radare2.exe must be in path, see errors in the output. btw if you can improve the .bat files it will be good.

Use r2 -L | grep frida to check if its loaded or not

you can enable R2_DEBUG=1 env var to get the reason why the plugin is not loaded .

also the io-frida.dll must be copied into the plugins directory not the bin directory.

Abdelrahmanamhawy commented 1 year ago
newissue

Okay so i played a little with the build.bat file . I copied the io_frida.dll to the plugins folder for radare2 . Where do i enable r2_debug =1 env var ?

I edited the build.bat file , but still i get this error . I tried "r2 -L" to see if the plugin is in the list but it's not . Any solutions?

Abdelrahmanamhawy commented 1 year ago

I tried to install it on kali linux vm using r2pm ci-r2frida

But i got this log :

`src/frida-compile src/agent/index.js > src/_agent.js test -s src/_agent.js ( rm -f src/_agent.js && exit 1) r2 -nfqcpc src/_agent.js grep 0x > src/_agent.h cc -c -DFRIDA_VERSION_STRING=\"16.0.5\" -DFRIDA_VERSION_MAJOR=16 -fPIC -Wall -Werror -g -I/usr/include/libr -I/usr/include/libr/sdb -I/usr/include/capstone -DWANT_SESSION_DEBUGGER=1 -Iext/frida src/io_frida.c -o src/io_frida.o In file included from /usr/include/libr/r_cons.h:12, from /usr/include/libr/r_diff.h:6, from /usr/include/libr/r_util.h:7, from /usr/include/libr/r_getopt.h:4, from /usr/include/libr/r_main.h:7, from /usr/include/libr/r_core.h:6, from src/io_frida.c:5: src/io_frida.c: In function ‘__write’: src/io_frida.c:425:22: error: format ‘%d’ expects argument of type ‘int’, but argument 7 has type ‘long long unsigned int’ [-Werror=format=] 425 R_LOG_DEBUG ("write %d @ 0x%08"PFMT64x, io->off, count); ^~~~~~ ~~~
long long unsigned int
/usr/include/libr/r_util/r_log.h:46:41: note: in definition of macro ‘R_LOG_DEBUG’ 46 LINE, R_LOGLVL_DEBUG, NULL, fmtstr, ##__VA_ARGS__); ^~ src/io_frida.c:425:30: note: format string is defined here 425 R_LOG_DEBUG ("write %d @ 0x%08"PFMT64x, io->off, count); ~^
int
%lld
src/io_frida.c:425:22: error: format ‘%llx’ expects argument of type ‘long long unsigned int’, but argument 8 has type ‘int’ [-Werror=format=] 425 R_LOG_DEBUG ("write %d @ 0x%08"PFMT64x, io->off, count); ^~~~~~ ~
int

/usr/include/libr/r_util/r_log.h:46:41: note: in definition of macro ‘R_LOG_DEBUG’ 46 | LINE, R_LOGLVL_DEBUG, NULL, fmtstr, ##VA_ARGS__); | ^~ src/io_frida.c: In function ‘open’: src/io_frida.c:839:22: error: zero-length gnu_printf format string [-Werror=format-zero-length] 839 | R_LOG_DEBUG (""); | ^~ /usr/include/libr/r_util/r_log.h:46:41: note: in definition of macro ‘R_LOG_DEBUG’ 46 | LINE, R_LOGLVL_DEBUG, NULL, fmtstr, ##__VA_ARGS); | ^~ src/io_frida.c: In function ‘print_list’: src/io_frida.c:2015:25: error: too many arguments to function ‘r_table_new’ 2015 | RTable table = r_table_new ("print_list"); | ^~~ In file included from /usr/include/libr/r_util.h:51: /usr/include/libr/r_util/r_table.h:64:15: note: declared here 64 | R_API RTable r_table_new(void); | ^~~ src/io_frida.c: At top level: src/io_frida.c:2079:18: error: initialization of ‘int ()(RIODesc )’ {aka ‘int ()(struct r_io_desc_t )’} from incompatible pointer type ‘_Bool ()(RIODesc )’ {aka ‘_Bool ()(struct r_io_desc_t )’} [-Werror=incompatible-pointer-types] 2079 | .close = close, | ^~~ src/io_frida.c:2079:18: note: (near initialization for ‘r_io_plugin_frida.close’) cc1: all warnings being treated as errors gmake[1]: [Makefile:190: src/io_frida.o] Error 1 gmake[1]: Leaving directory '/home/kali/.local/share/radare2/r2pm/git/r2frida' gmake: [Makefile:143: all] Error 2 ERROR: Build failed `

trufae commented 1 year ago

Which version of r2 do you have in kali?

Abdelrahmanamhawy commented 1 year ago

radare2 5.0.0 0 @ linux-x86-64 git.5.0.0

Abdelrahmanamhawy commented 1 year ago

Okay so i updated R2 and it now works . But still i get this error : Module version mismatch /home/kali/.local/share/radare2/plugins/io_frida.so (5.7.9) vs (5.0.0) r2pm -ci r2frida [r] Cannot open 'frida://?'

I think that Radare2 and r2frida have different versions,but the problem is that there is no version 5.7.9 for radare2,the last one is 5.7.8 ,i think i will uninstall and download the 5.7.8 version from r2frida .

trufae commented 1 year ago

5.7.9 is the version from git, and its ok to use it. Remove that file and r2pm -ci r2frida should be rebuilding the plugin and the warning may go away

trufae commented 4 months ago

Last release fixed support for windows https://github.com/nowsecure/r2frida/issues/593