yrp604 / rappel

A linux-based assembly REPL for x86, amd64, armv7, and armv8
Other
1.16k stars 55 forks source link

.write does not seem to work #18

Closed jstaursky closed 5 years ago

jstaursky commented 5 years ago

Say I'm in an interactive session and run .showmap which returns the following

f7fd8000-f7fdb000 r--p 00000000 00:00 0                                  [vvar]
f7fdb000-f7fdc000 r-xp 00000000 00:00 0                                  [vdso]
ff8aa000-ff8cd000 rwxp 00000000 00:00 0                                  [stack]

Why doesn't .write 0xff8aa000 0x7f and then reading it .read 0xff8ea000 0x1 show 7f?

If I instead do mov dword [0xff8aa000], 0x7f and follow up with .read 0xff8ea000 0x1 it does show that 7f has been written.

P.S. What does [vvar] and [vdso] mean?

yrp604 commented 5 years ago

I'll look into .write, but I can answer the vdso/vvar stuff now:

yrp604 commented 5 years ago

So uh, apparently I forgot to implement the ui code to convert command lines into ptrace write calls three years ago and you're the first person to notice.... wups!

I'll get on that, thanks for letting me know.

jstaursky commented 5 years ago

No problem, thanks for the cool tool!

BTW will .write support cmds piped in? Would be nice to do something like .write 0xff8aa000 <((){objcopy -O binary -j .text `which less` $1; cat $1 } =(touch -c .)) with zsh

disconnect3d commented 5 years ago

It would probably easier to implement .writef <addr> <file with bytes to write to memory>

yrp604 commented 5 years ago

.write will not support shell commands but a .writef is a possibility.

Originally I had planned on adding command line options to add other files to the initial generated elf, so you could do something like rappel --map 0x41410000 --file foo.bin and in your resulting session you'd have the contents there, but I never got around to it and unless I have a pressing need, I doubt I will. If someone wants to add this though, feel free, though the ELF generation code is kinda hairy...