gtoad / android_inline_hook_arm64 Goto Github PK
View Code? Open in Web Editor NEWBuild an .so file to automatically do the android_native_hook work. Supports ARM64 ! With this, tools like Xposed can do android native hook.
Build an .so file to automatically do the android_native_hook work. Supports ARM64 ! With this, tools like Xposed can do android native hook.
在Android studio中引入了源码,采用的cmake,编译会像下面这样报错:
InlineHook/libIhook.a(Ihook.c.o): In function BuildStub': E:/Projects/Android Projects/DuoDianY2/app/src/main/cpp/InlineHook/Ihook.c:(.text.BuildStub+0x3c): undefined reference to
_old_function_addr_s' E:/Projects/Android Projects/DuoDianY2/app/src/main/cpp/InlineHook/Ihook.c:(.text.BuildStub+0x40): undefined reference to _old_function_addr_s' E:/Projects/Android Projects/DuoDianY2/app/src/main/cpp/InlineHook/Ihook.c:(.text.BuildStub+0x44): undefined reference to
_hookstub_function_addr_s' E:/Projects/Android Projects/DuoDianY2/app/src/main/cpp/InlineHook/Ihook.c:(.text.BuildStub+0x48): undefined reference to _hookstub_function_addr_s' E:/Projects/Android Projects/DuoDianY2/app/src/main/cpp/InlineHook/Ihook.c:(.text.BuildStub+0x4c): undefined reference to
_shellcode_end_s' E:/Projects/Android Projects/DuoDianY2/app/src/main/cpp/InlineHook/Ihook.c:(.text.BuildStub+0x50): undefined reference to _shellcode_end_s' E:/Projects/Android Projects/DuoDianY2/app/src/main/cpp/InlineHook/Ihook.c:(.text.BuildStub+0x54): undefined reference to
_shellcode_start_s' E:/Projects/Android Projects/DuoDianY2/app/src/main/cpp/InlineHook/Ihook.c:(.text.BuildStub+0x58): undefined reference to `_shellcode_start_s' clang++: error: linker command failed with exit code 1 (use -v to see invocation) ninja: build stopped: subcommand failed.
想请教下您是因为cmake不支持shellcode吗
ndk >= 18 need edit APP_STL := c++_static
Hi,I want to print register value like below.
LOGI("dlsym handle is: %s",(char*)regs->uregs[0]); LOGI("dlsym symbol is: %s",(char *)regs->uregs[1]);
But it can't work.Could you help me?
bool InlineHook(void *pHookAddr, void (*onCallBack)(struct user_pt_regs *))
{
bool bRet = false;
LOGI("InlineHook");
if(pHookAddr == NULL || onCallBack == NULL)
{
return bRet;
}
INLINE_HOOK_INFO* pstInlineHook = malloc(sizeof(INLINE_HOOK_INFO));
memset(pstInlineHook, 0, sizeof(INLINE_HOOK_INFO));
pstInlineHook->pHookAddr = pHookAddr;
pstInlineHook->onCallBack = onCallBack;
if(HookArm(pstInlineHook) == false)
{
LOGI("HookArm fail.");
free(pstInlineHook);
return bRet;
}
return true;
}
void dlsym_callback(struct user_pt_regs *regs) //参数regs就是指向栈上的一个数据结构,由第二部分的mov r0, sp所传递。
{
LOGI("In Evil Hook Stub.");
}
int main()
{
PF_dlsym old_dlsym = (PF_dlsym)dlsym(dlopen("libdl.so", RTLD_NOW), "dlsym");
printf("get dlsym %p\n", old_dlsym);
InlineHook(old_dlsym, dlsym_callback);
dlsym(dlopen("libc.so", RTLD_NOW), "read"); 《---- 执行到这里 ,可以进入回调,然后会失败
getchar();
return 0;
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.