#import <substrate.h> #define libmis "/usr/lib/libmis.dylib" //方式1 uintptr_t (*MISCopySignerCertificateData)(NSString *path, NSData **data); uintptr_t (*MISValidateSignatureAndCopyInfo)(NSString *path, uintptr_t b, NSDictionary **info); uintptr_t MyMISValidateSignatureAndCopyInfo(NSString *path, uintptr_t b, NSDictionary **info) { NSLog(@"inject success!!!!"); NSData *data; MISCopySignerCertificateData(path, &data); *(uintptr_t *)info = 0; return 0; } %ctor { MSImageRef image = MSGetImageByName(libmis); if (image) { MISValidateSignatureAndCopyInfo = reinterpret_cast<uintptr_t (*)(NSString *path, uintptr_t b, NSDictionary **info)>(MSFindSymbol(image, "_MISValidateSignatureAndCopyInfo")); MISCopySignerCertificateData = reinterpret_cast<uintptr_t (*)(NSString *path, NSData **data)>(MSFindSymbol(image, "_MISCopySignerCertificateData")); if(MISValidateSignatureAndCopyInfo) { MSHookFunction(MISValidateSignatureAndCopyInfo, &MyMISValidateSignatureAndCopyInfo); }else { NSLog(@"未找到函数 MISValidateSignatureAndCopyInfo"); } }else{ NSLog(@"AppSync: 加载libmis.dylib失败..."); return; } } //方式2 /* static uintptr_t (*kernel_MISValidateSignatureAndCopyInfo)(NSString *path, uintptr_t b, NSDictionary **info); uintptr_t MyMISValidateSignatureAndCopyInfo(NSString *path, uintptr_t b, NSDictionary **info) { NSLog(@"inject success!!!!"); kernel_MISValidateSignatureAndCopyInfo(path, b, info); return 0; } %ctor { MSImageRef image = MSGetImageByName(libmis); if (image) { void *_MISValidateSignatureAndCopyInfo = MSFindSymbol(image, "_MISValidateSignatureAndCopyInfo"); if(_MISValidateSignatureAndCopyInfo) { MSHookFunction(_MISValidateSignatureAndCopyInfo, (void *)MyMISValidateSignatureAndCopyInfo, (void **)&kernel_MISValidateSignatureAndCopyInfo); }else { NSLog(@"未找到函数 MISValidateSignatureAndCopyInfo"); } }else{ NSLog(@"AppSync: 加载libmis.dylib失败..."); return; } } */
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>Filter</key> <dict> <key>Executables</key> <array> <string>installd</string> </array> </dict> </dict> </plist>
发表评论