阅读在OS X中的其他进程“记忆? [英] Reading Other Process' Memory in OS X?

查看:138
本文介绍了阅读在OS X中的其他进程“记忆?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在试图了解如何阅读在Mac OS X的其他进程的内存,但我没有多少运气。我在网上看到使用 ptrace的 PEEKDATA 和这样的,但它不会对BSD该选项的例子很多 [<一个href=\"http://developer.apple.com/documentation/Darwin/Reference/ManPages/man2/ptrace.2.html\"><$c$c>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 and write the memory of anther process on Mac OS X?

推荐答案

使用 task_for_pi​​d()或其它方法来获取目标进程的任务端口。此后,您可以通过直接操纵进程的地址空间 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆