/*==============================================================================
Hook: getenv(DYLD_INSERT_LIBRARIES)
==============================================================================*/
char * getenv(const char* name);
const char* DYLD_INSERT_LIBRARIES = "DYLD_INSERT_LIBRARIES";
%hookf(char *, getenv, const char* name){
// char* getenvRetStr = %orig(name)
char* getenvRetStr = %orig;
if (cfgHookEnable_misc) {
// iosLogDebug("name=%s", name);
// NSLog(@"getenv name");
// "_CFXNOTIFICATIONREGISTAR2_ENABLED" will cause crash
if (strStartsWith(name, "DYLD_")){
// if (!strStartsWith(name, "_")){
// iosLogInfo("not start with '_', name=%s", name);
iosLogInfo("DYLD_ name=%s", name);
}
if(0 == strcmp(name, DYLD_INSERT_LIBRARIES)){
iosLogInfo("name=%s -> getenvRetStr=%{public}s", name, getenvRetStr);
getenvRetStr = NULL;
} else {
if (strStartsWith(name, "DYLD_")){
iosLogInfo("name=%s -> getenvRetStr=%{public}s", name, getenvRetStr);
}
}
}
return getenvRetStr;
}
ios环境变量 Hook getenv(DYLD_INSERT_LIBRARIES)
Hook getenv 示例解析
最新推荐文章于 2024-12-01 11:26:19 发布
本文提供了一个针对 iOS 系统环境下,使用 Hook 技术拦截并修改 getenv 函数中 DYLD_INSERT_LIBRARIES 环境变量的具体实现示例。通过这一技术手段可以有效地干预和控制程序运行时的动态链接库加载行为。
1万+

被折叠的 条评论
为什么被折叠?



