基本上已经无用的防破解方法
//First Method#import <dlfcn.h>#import <mach-o/dyld.h>#import <TargetConditionals.h>/* The encryption info struct and constants are missing from the iPhoneSimulator SDK, but not from the iPhoneOS or * Mac OS X SDKs. Since one doesn't ever ship a Simulator binary, we'll just provide the definitions here. */#if TARGET_IPHONE_SIMULATOR && !defined(LC_ENCRYPTION_INFO)#define LC_ENCRYPTION_INFO 0x21struct encryption_info_command { uint32_t cmd; uint32_t cmdsize; uint32_t cryptoff; uint32_t cryptsize; uint32_t cryptid;};#endifint main (int argc, char *argv[]);static BOOL is_encrypted () { const struct mach_header *header; Dl_info dlinfo; /* Fetch the dlinfo for main() */ if (dladdr(main, &dlinfo) == 0 || dlinfo.dli_fbase == NULL) { NSLog(@"Could not find main() symbol (very odd)"); return NO; } header = dlinfo.dli_fbase; /* Compute the image size and search for a UUID */ struct load_command *cmd = (struct load_command *) (header+1); for (uint32_t i = 0; cmd != NULL && i < header->ncmds; i++) { /* Encryption info segment */ if (cmd->cmd == LC_ENCRYPTION_INFO) { struct encryption_info_command *crypt_cmd = (struct encryption_info_command *) cmd; /* Check if binary encryption is enabled */ if (crypt_cmd->cryptid < 1) { /* Disabled, probably pirated */ return NO; } /* Probably not pirated? */ return YES; } cmd = (struct load_command *) ((uint8_t *) cmd + cmd->cmdsize); } /* Encryption info not found */ return NO;}//Second Method#if !TARGET_IPHONE_SIMULATORint root = getgid();if (root == 0) {exit(0);}#endif//Third Method#import <dlfcn.h>#import <sys/types.h>#import <Foundation/Foundation.h>#import <TargetConditionals.h>// The iPhone SDK doesn't have <sys/ptrace.h>, but it does have ptrace, and it// works just fine.typedef int (*ptrace_ptr_t)(int _request, pid_t _pid, caddr_t _addr, int _data);#if !defined(PT_DENY_ATTACH)#definePT_DENY_ATTACH31#endif// !defined(PT_DENY_ATTACH)void ZNDebugIntegrity() {// If all assertions are enabled, we're in a legitimate debug build.#if TARGET_IPHONE_SIMULATOR || defined(DEBUG) || (!defined(NS_BLOCK_ASSERTIONS) && !defined(NDEBUG))return;#endif// Lame obfuscation of the string "ptrace".char* ptrace_root = "socket";char ptrace_name[] = {0xfd, 0x05, 0x0f, 0xf6, 0xfe, 0xf1, 0x00};for (size_t i = 0; i < sizeof(ptrace_name); i++) {ptrace_name += ptrace_root;}void* handle = dlopen(0, RTLD_GLOBAL | RTLD_NOW);ptrace_ptr_t ptrace_ptr = dlsym(handle, ptrace_name);ptrace_ptr(PT_DENY_ATTACH, 0, 0, 0);dlclose(handle);}//Fourth Method#define kInfoSize 500//Place your NSLog Plist Size into the above Define statmentNSString* bundlePath = [ bundlePath];NSString* path = ;NSDictionary *fileInfo = [ infoDictionary];NSFileManager *fileManager = ;NSDictionary *fileAttributes = ;if (fileAttributes != nil) {NSNumber *fileSize;if(fileSize = ){NSLog(@"File Size:%qi\n", );//Best to see the File Size and change it accordingly firstNSString *cSID = [ initWithFormat:@"%@%@%@%@%@",@"Si",@"gne",@"rIde",@"ntity",@""];BOOL checkedforPir = false;if( == nil || != nil) {if( == kInfoSize) {checkedforPir = true;}}if(!checkedforPir){//Pirated};}}//Fifth MethodNSString* bundlePath = [ bundlePath];NSString* path = ;NSString* path2 = ;NSDate* infoModifiedDate = [[ fileAttributesAtPath:path traverseLink:YES] fileModificationDate];NSDate* infoModifiedDate2 = [[ fileAttributesAtPath:path2 traverseLink:YES] fileModificationDate];NSDate* pkgInfoModifiedDate = [[ fileAttributesAtPath:[[ resourcePath] stringByAppendingPathComponent:@"PkgInfo"] traverseLink:YES] fileModificationDate];if( > ) {//Pirated}if( > ) {//Pirated}//Sixth MethodNSString* bundlePath = [ bundlePath];BOOL fileExists = [ fileExistsAtPath:(@"%@/_CodeSignature", bundlePath)];if (!fileExists) {//PiratedNSLog(@"Pirated");}BOOL fileExists2 = [ fileExistsAtPath:(@"%@/CodeResources", bundlePath)];if (!fileExists2) {//PiratedNSLog(@"Pirated2");}BOOL fileExists3 = [ fileExistsAtPath:(@"%@/ResourceRules.plist", bundlePath)];if (!fileExists3) {//PiratedNSLog(@"Pirated3");}//Covert exitsclose(0);[ terminate];[ terminateWithSuccess];UIWebView *a = ;UIWindow *b = ;UIView *c = ;UILabel *d = ;UITextField *e = ;UIImageView *f = ;UIImage *g = ;UISwitch *h = ;UISegmentedControl *i = ;UITabBar *j = ;;;;;;;;;;;system("killall SpringBoard");
页:
[1]