// // disableAttach.h // MCPlus // // Created by seo ha on 18/02/2019. // Copyright © 2019 KangSH. All rights reserved. // #ifndef disableAttach_h #define disableAttach_h #import #import typedef int (*command_ptr_t)(int _request, pid_t _pid, caddr_t _addr, int _data); #if !defined(PT_DENY_ATTACH) #define PT_DENY_ATTACH 31 #endif /** 디버그 메소드 swift 에서 사용시 buildsetting - swift otherflag에 "-DDEBUG"값을 입력후 전처리문을 통해 입력 ex) #if DEBUG #else //안티디버거 disable_attach() #endif */ //Anti-debug method void disable_attach() { void* handle = dlopen(0, RTLD_GLOBAL | RTLD_NOW); command_ptr_t command_ptr = dlsym(handle, "ptrace"); command_ptr(PT_DENY_ATTACH, 0, 0, 0); dlclose(handle); } #endif /* disableAttach_h */