radare2 icon indicating copy to clipboard operation
radare2 copied to clipboard

Projects and files

Open trufae opened this issue 1 year ago • 4 comments

  • file paths must be absolute
0$ r2 -p hello
ERROR: cannot open file bins/elf/analysis/main
ERROR: Wrong fd, it must be greater than 3
ERROR: ar: Unknown register 'rax'
ERROR: ar: Unknown register 'rbx'
  • prj.files expects filename = prjname
0$ r2 /bin/ls
 -- Run your own r2 scripts in awk using the r2awk program.
[0x100003a38]> e prj.
prj.alwasyprompt   prj.files          prj.gpg            prj.name           prj.sandbox
prj.vc             prj.vc.message     prj.vc.type        prj.zip
[0x100003a38]> e prj.files
false
[0x100003a38]> e prj.files =true
[0x100003a38]> Ps testls
WARN: Cannot copy 'testls' into '/Users/pancake/.local/share/radare2/projects/testls/bin/testls'
[main (root-commit) 59ebe18] default message
 Author: pancake <pancake@localhost>
 1 file changed, 4144 insertions(+)
 create mode 100644 rc.r2
[0x100003a38]> q
0$ 

trufae avatar Aug 14 '23 08:08 trufae

Storing absolute paths would make sense regardless of prj.files, for what its worth

bqv avatar Nov 08 '23 20:11 bqv

I think is better to keep a copy of those files inside the project directory, otherwise the zipped projects cannot be shared between users/machines

trufae avatar Nov 18 '23 09:11 trufae

Disclaimer: using r2 through iaito

so prj.files copies the files to the bin folder in the project directory, then what, exactly? As far as I have witnessed it doesn't even change the project RC's opened file path.

as it currently stands r2 projects seem impossible to share for collaboration to a novice user such as me. Is there a workaround or variable to allow multiple people to interact on one project? Ideas that come off the top of my head would be:

  • making a script to open the project after dealing with paths, but that's a naive approach as it could possibly create issues with VCS (taking git as an example)
  • setting up some fictitious environment specifically to run radare2/iaito with tools like distrobox or manually setting env. vars and maybe using some ad-hoc conf file through R2_RCFILE.

Are the above valid approaches?

envyniv avatar Jul 12 '24 11:07 envyniv

Indeed, this seems like a bug on the way that the rc script is generated, the project loading can "massage" or adapt this by checking if the file specified is found in the project directory before the full path, this will probably make it easier because changing the way rc scripts are generated can be more problematic.

trufae avatar Jul 13 '24 12:07 trufae