unidbg icon indicating copy to clipboard operation
unidbg copied to clipboard

如何在某个so刚刚加载的瞬间去hook他的函数?

Open abcdefgnihao opened this issue 3 years ago • 3 comments

您好作者,有这样一个需求。我需要在我的so加载到内存后去hook他的函数,比如JNI_OnLoad或者Init_array. 但是在这里使用xhook或者Dobby去hook某个函数后,发现没有经过。

loadInternal(....)
{
    LinuxModule module = loadInternal(libraryFile);             						     resolveSymbols(!forceCallInit);
    //***********插入我的逻辑**************
    //***********结束我的逻辑**************
    if (callInitFunction || forceCallInit) {...
    }
}

后来在 main 函数,在 loadLibrary之前,添加了一个 moduleListerner. 但也是发现无法成功hook上。请教下有什么办法可以解决我的问题~

abcdefgnihao avatar Mar 08 '21 02:03 abcdefgnihao

如果是分析用,或以考虑attack debugger

zhkl0228 avatar Mar 08 '21 05:03 zhkl0228

谢谢~

abcdefgnihao avatar Mar 08 '21 06:03 abcdefgnihao

如果是分析用,或以考虑attack debugger

试了下,似乎emulator.attach(DebuggerType.ANDROID_SERVER_V7);并不会在init_array的时候等待调试器,而是会直接跑飞(。

kotori2 avatar Sep 10 '21 11:09 kotori2