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

ioplugin and map file #148

Open
pipothebit opened this issue Apr 26, 2022 · 3 comments
Open

ioplugin and map file #148

pipothebit opened this issue Apr 26, 2022 · 3 comments

Comments

@pipothebit
Copy link

pipothebit commented Apr 26, 2022

Hi,
I'm using r2pipe to try to map a "virtual" file at certain address. The command line that i am using is:

r2 \  
  -a arm \  
  -b 32 \  
  -e cfg.bigendian=true \  
  -c "e asm.emu=true" \  
  -c "on malloc://16K 0x10000000 rwx" \  
  -c "omn 0x10000000 sram_1" \  
  -c "on malloc://128M 0x20000000 rwx" \  
  -c "omn 0x20000000 sram_2" \  
  -c 'on "r2pipe://node test-r2io-plugin.js" 0x3c000000 rw  '
  bios.hex

That command give me this memory map:

 5 fd: 6 +0x00000000 0x3c000000 - 0xffffffffffffffff rw-   
 4 fd: 6 +0xffffffffc4000000 0x00000000 - 0x3bfffffe rw-   
 3 fd: 5 +0x00000000 0x20000000 - 0x27ffffff rwx sram_2  
 2 fd: 4 +0x00000000 0x10000000 - 0x10003fff rwx sram_1  
 1 fd: 3 +0x00000000 0x00000000 - 0x001fffff rwx

When I use the original file dumped I use this command line lo launch r2:

r2 \
  -a arm \
  -b 32 \
  -e cfg.bigendian=true \
  -c "e asm.emu=true" \
  -c "on malloc://16K 0x10000000 rwx" \
  -c "omn 0x10000000 sram_1" \
  -c "on malloc://128M 0x20000000 rwx" \
  -c "omn 0x20000000 sram_2" \
  -c "on 0x3c000000.bin 0x3c000000 rw" \
  bios.hex

And I get this is the memory map:

 4 fd: 6 +0x00000000 0x3c000000 - 0x3c3fffff rw- 
 3 fd: 5 +0x00000000 0x20000000 - 0x27ffffff rwx sram_2
 2 fd: 4 +0x00000000 0x10000000 - 0x10003fff rwx sram_1
 1 fd: 3 +0x00000000 0x00000000 - 0x001fffff r-x 

Is posible to do this with r2pipe?

@trufae
Copy link
Contributor

trufae commented May 2, 2022

yes you can do this with r2pipe.

@pipothebit
Copy link
Author

can you point me in some direction how to do this with r2pipe?
What fails in the command line with which I launch r2?

@trufae
Copy link
Contributor

trufae commented Jun 3, 2022

you can pass arguments to the r2 process you spawn by using the 2rd argument of the open() call in the python API. also you can do the same by opening "--" file which means no-file, and then running thos ecommands and o to open the file.

btw, see pydoc r2pipe, but the 2nd arg is an array of arguments passed to the r2 process.

but that wont work if you use the native r2pipe api or http api

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants