其他分享
首页 > 其他分享> > iOS越狱开发 常用检测Hook 代码 闪退检测断点

iOS越狱开发 常用检测Hook 代码 闪退检测断点

作者:互联网

__attribute__((constructor)) static void entry(){

    
    rebind_symbols((struct rebinding[1]){{"abort", abort_hook, (void *)&abort_old}}, 1);
    rebind_symbols((struct rebinding[2]){{"exit", myexit, (void *)&orig_exit}}, 1);
    rebind_symbols((struct rebinding[2]){{"_dyld_get_image_name", my_dyld_get_image_name, (void *)&orig__dyld_get_image_name}}, 1);
    rebind_symbols((struct rebinding[2]){{"_dyld_image_count", my_dyld_image_count, (void *)&orig_dyld_image_count}}, 1);
    
}


//void     exit(int) __dead2;
static void     (*orig_exit)(int *s);
void myexit(int* s){
    printf("myexit =(%s)\n", "myexit");
    orig_exit(s);
}

//void     abort(void) __dead2;
static void (*abort_old)(void);
void abort_hook(void) {
}

//extern uint32_t                    _dyld_image_count(void)
static uint32_t  (*orig_dyld_image_count)(void);
uint32_t *  my_dyld_image_count(void){
    uint32_t *s = orig_dyld_image_count();
    printf("orig__dyld_get_image_name =(%s)\n", s);
    return s;
}

//extern const char*                 _dyld_get_image_name(uint32_t image_index)           __OSX_AVAILABLE_STARTING(__MAC_10_1, __IPHONE_2_0);
static char*     (*orig__dyld_get_image_name)(uint32_t image_index);
char*   my_dyld_get_image_name(uint32_t image_index){
    char* s = orig__dyld_get_image_name(image_index);
    printf("orig__dyld_get_image_name =(%s)\n", s);
    return s;
}

 

标签:__,get,检测,image,iOS,dyld,断点,void,orig
来源: https://blog.csdn.net/qq_21051503/article/details/104837855