在 OS X 中读取其他进程的内存? [英] Reading Other Process' Memory in OS X?
问题描述
我一直试图了解如何在 Mac OS X 上读取其他进程的内存,但我运气不佳.我在网上看到了很多使用 ptrace
和 PEEKDATA
等的例子,但是它在 BSD [man ptrace
].>
I've been trying to understand how to read the memory of other processes on Mac OS X, but I'm not having much luck. I've seen many examples online using ptrace
with PEEKDATA
and such, however it doesn't have that option on BSD [man ptrace
].
int pid = fork();
if (pid > 0) {
// mess around with child-process's memory
}
如何在 Mac OS X 上读取和写入另一个进程的内存?
How is it possible to read from and write to the memory of another process on Mac OS X?
推荐答案
使用 task_for_pid()
或其他方法获取目标进程的任务端口.此后,您可以使用 vm_read()
、vm_write()
等直接操作进程的地址空间.
Use task_for_pid()
or other methods to obtain the target process’s task port. Thereafter, you can directly manipulate the process’s address space using vm_read()
, vm_write()
, and others.
这篇关于在 OS X 中读取其他进程的内存?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!