Using Ptrace to track the location of files being

2019-05-26 21:34发布

I was using the following code which actually gets me the contents in the registers (eax, ebx, ecx) whenever a open system call is called. Now after a lot of struggle I understood what the values signify from this Question.
ebx contains the pointer to filename. But when I try to access it I was getting a segmentation fault. Where am I going wrong? The code can be accessed from the here

1条回答
Melony?
2楼-- · 2019-05-26 22:25

Every process has its own address space. An address obtained from another process will not be valid in yours. One way to read memory in the other process would be to use PTRACE_PEEKDATA. On Linux, another way would be to open /proc/<pid>/mem, seek to the address, and read from it like a file.

查看更多
登录 后发表回答