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

在二进制文件中使用libxhook对__android_log_print进行hook,hook不成功 #105

Open
yangsusuqq opened this issue Oct 18, 2023 · 0 comments

Comments

@yangsusuqq
Copy link

static int my_android_log_print(int prio, const char* tag, const char* fmt, ...)
{
va_list ap;
char buf[1024];
int r;
int n = 100;

va_start(ap, fmt);
r = __android_log_print(ANDROID_LOG_INFO, "ProjectName", "I am : %d/n", n);
va_end(ap);

}
static void test_invoke_hook(){
int res = xhook_register("^/system/.*\.so$", "__android_log_print", my_android_log_print, NULL);
if(res != 0){
printf("register failed\n");
return;
} else {
printf("register success\n");
}

while(1){
    int res_r = xhook_refresh(0);
    if(res_r != 0){
        printf("refresh failed\n");
    } else {
        printf("refresh success\n");
    }
    sleep(3);
}

}

出现register success
refresh success,
可是logcat里面没有I am的信息

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant