将共享库注入正在运行的进程

时间:2017-06-21 14:24:46

标签: c++ linux qt shared-libraries code-injection

我刚开始学习Linux中的注入技术,并希望编写一个简单的程序,将共享库注入正在运行的进程(使用QT的应用程序)。然而,经过几个小时的研究,我找不到任何完整的例子。

为什么dlsym找不到qt_startup_hook?

#include <stdio.h>
#include <dlfcn.h>


void hello()
{
    printf("Call hello\n");
    void *func = dlsym(RTLD_NEXT, "qt_startup_hook");

    if (!func) {
        printf("Error\n");
    }
}

GDB:

b main
run
call dlopen("/linux-inject/sample-library.so",2)
>> $1 = 108781344
call hello()
>> Call hello
>> Error

Gdb找到了qt_startup_hook:

info functions qt_startup_hook
>> Non-debugging symbols:
>> 0x00007ffff7b0ae40  qt_startup_hook

0 个答案:

没有答案