Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

不知道为啥,hook一款游戏,有时候能进hook函数,有时候没进来 #68

Open
shuajinanhai opened this issue Jul 5, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@shuajinanhai
Copy link

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问题还是基址获得有问题,能否提供点帮助,非常感谢

@shuajinanhai shuajinanhai added the bug Something isn't working label Jul 5, 2024
@zhongqingsong
Copy link

兄弟,shadowHook提供了一个 shadowhook_dlopen,这个可以直接得到基址的吧?

@caikelun
Copy link
Member

你可以贴一下你的shadowhook初始化代码、hook代码、proxy函数。这样才能解决问题。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants