Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
Abdelrahmanamhawy opened this issue Dec 7, 2022 · 8 comments
Closed

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

Abdelrahmanamhawy opened this issue Dec 7, 2022 · 8 comments
Labels

Comments

@Abdelrahmanamhawy
Copy link

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
Copy link
Member

trufae commented Dec 8, 2022

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
Copy link
Author

Abdelrahmanamhawy commented Dec 8, 2022

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
Copy link
Author

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
Copy link
Member

trufae commented Dec 9, 2022

Which version of r2 do you have in kali?

@Abdelrahmanamhawy
Copy link
Author

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

@Abdelrahmanamhawy
Copy link
Author

Abdelrahmanamhawy commented Dec 11, 2022

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
Copy link
Member

trufae commented Dec 12, 2022

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
Copy link
Member

trufae commented May 29, 2024

Last release fixed support for windows #593

@trufae trufae closed this as completed May 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants