#import <UIKit/UIKit.h>
#import "AppDelegate.h"
#import <dlfcn.h>
#import <sys/types.h>
#pragma mark --Kboy加入Ptrace检测,防止白盒测试、逆向工程对源代码进行调试
/////Kboy***Kboy//////
typedef int (*ptrace_ptr_t)(int _request, pid_t _pid, caddr_t _addr, int _data);
#if !defined(PT_DENY_ATTACH)
#define PT_DENY_ATTACH 31
#endif // !defined(PT_DENY_ATTACH)
void disable_gdb() {
void* handle = dlopen(0, RTLD_GLOBAL | RTLD_NOW);
ptrace_ptr_t ptrace_ptr = dlsym(handle, "ptrace");
ptrace_ptr(PT_DENY_ATTACH, 0, 0, 0);
dlclose(handle);
}
/////Kboy***Kboy//////
int main(int argc, char * argv[]) {
@autoreleasepool {
/////Kboy***Kboy//////
#ifndef DEBUG
disable_gdb();
#endif
/////Kboy***Kboy//////
return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
}
}
网友评论