|
[求助]Android Inline Hook问题
贴下修改后的代码 int (*Old_Sys_FileRead)(const char *name, char *buf, int len) = NULL; int New_Sys_FileRead(const char *name, char *buf, int len) { LOGD("New_Sys_FileRead Hook Into.\n"); if(Old_Sys_FileRead == NULL){ LOGD("Old_Sys_FileRead Is NULL.\n"); return -1; } return Old_Sys_FileRead(name, buf, len); } int xHook_Sys_FileRead(void) { // 打开xhook DEBUG (默认关闭): 0:关闭DEBUG 1:打开DEBUG xhook_enable_debug(1); // 在所有已加载so库中查找函数进行Hook //xhook_register(".*\\.so$", "Sys_FileRead", New_Sys_FileRead, &Old_Sys_FileRead); // 在指定so中查找函数进行Hook xhook_register(".*/libmisc.so$", "Sys_FileRead", New_Sys_FileRead, &Old_Sys_FileRead); // 忽略libex_misc.so中的Sys_FileRead hook xhook_ignore(".*/libex_misc\\.so$", "Sys_FileRead"); // 忽略libex_misc.so中的所有hook xhook_ignore(".*/libex_misc\\.so$", NULL); // 提交执行hook操作, 0:同步执行hook 1:异步执行hook xhook_refresh(1); return 0; }
最后于 2019-6-5 16:42
被guoqiangck编辑
,原因:
|
|
[求助]Android Inline Hook问题
不知道为啥,尝试使用GOT表Hook、InlineHook、TKHooklib、ElfHook都没有成功,都是Hook的新打开库的备份 我改动源代码把原函数地址打出来,再我把注入的模块里面的原函数地址打出来,两者对不上,注入的函数模块拿到的OrginFunc的地址就是新dlopen打开的函数地址 应该要找到原始进程so库里面需要Hook函数的地址,传给Hook框架,所以这个问题和Hook框架没有关系,后面再研究下怎么拿到原始函数的地址 最后,找到一个iqiyi的xhook框架,传入需要Hook的函数名字符串,xhook查找ELF HASH 和 GNU HASH找到对应的地址,支持正则表达式全局查找,功能挺强大,使用这个框架Hook成功,源码地址 https://github.com/iqiyi/xHook,希望能对大家有所帮助 |
|
|
|
|
|
|
操作理由
RANk
{{ user_info.golds == '' ? 0 : user_info.golds }}
雪币
{{ experience }}
课程经验
{{ score }}
学习收益
{{study_duration_fmt}}
学习时长
基本信息
荣誉称号:
{{ honorary_title }}
能力排名:
No.{{ rank_num }}
等 级:
LV{{ rank_lv-100 }}
活跃值:
在线值:
浏览人数:{{ visits }}
最近活跃:{{ last_active_time }}
注册时间:{{ user_info.create_date_jsonfmt }}
勋章
兑换勋章
证书
证书查询 >
能力值