-
Notifications
You must be signed in to change notification settings - Fork 337
Description
ShadowHook Version
1.0.9
Android OS Version
13
Android ABIs
arm64-v8a
Device Manufacturers and Models
真我GT5
Describe the Bug
不知道为啥,hook一款游戏(com.olzhas.carparking.multyplayer2 版本名0.3.6.06283941),有时候能进hook函数,有时候没进来,
先使用线程等待libil2cpp.so加载进来后hook getModuleBase + 偏移量
static void* getModuleBase(char* module_name, char* moduleFullPath)
{
char filename[256];
snprintf(filename, sizeof(filename), "/proc/self/maps");
FILE fp = fopen(filename, "r");
void addr=0;
if (fp != NULL)
{
char line[1024];
while (fgets(line, sizeof(line), fp))
{
if(strstr(line, module_name) && (strstr(line, "r--p")|| strstr(line, "r-xp")))
{
LOGE("getModuleBase:line=%s", line);
sscanf(line, "%[^/]%[^\n]", moduleFullPath);
char pch = strtok(line, "-");
addr = (void)strtoul(pch, NULL, 16);
if (addr == 0x8000){addr = 0;}
LOGE("getModuleBase:找到%s(%s),base_addr=%p", module_name, moduleFullPath, addr);
break;
}
}
fclose(fp);
}
return (void)addr;
}
但我使用AndHook每次都可以进hook函数,唯一区别就是基址用AKGetBaseAddress获得后 + 偏移量,不知道是shadowhook问题还是基址获得有问题,能否提供点帮助,非常感谢