为什么我需要以root身份运行(不r00t_)?
// main()
scan.scanProcessOffset(10838, 0x7f8c14000000); // proper pid and offset
void MemoryMapper::scanProcessOffset(unsigned int procId, unsigned long long offset)
{
long attach = ptrace(PTRACE_ATTACH, procId, NULL, NULL);
cout << attach << endl << errno << endl;
long memory = ptrace(PTRACE_PEEKDATA, procId, offset);
if (memory == -1 && errno == 3)
{
cout << errno << endl;
errno = 0;
}
cout << memory;
}
正如你可以看到我钩住由r00t_拥有的过程
r00t_@:/proc/10838$ ls -l
lrwxrwxrwx 1 r00t r00t_ 0 2012-04-15 08:21 exe -> /usr/bin/gedit
-rw------- 1 r00t r00t_ 0 2012-04-15 09:04 mem
输出没有作为root运行:
r00t_@:~/memedit$ ./a.out
-1
1
3
-1
输出作为根:
r00t_@:~/memedit$ sudo ./a.out
0
0
140239607693344
我为什么不能连接,当我的过程中,我试图连接到的主人吗?