[http://blog.sina.com.cn/s/blog_6dce99b10100wvtn.html]
首先简单介绍一下原理:
现在大多数的破解苹果验证安装app的办法都会动一个文件, 就是在.app文件夹下的”Info.plist”, 也就是那个程序信息文件.
代码很简单, 不再详细解释什么意思了
1. 检查Info.plist 是否存在 SignerIdentity这个键名(Key).
未破解的程序是不会有这个键名的, 苹果没给你加, 你自己没有加, 如果有, 那是哪儿来的呢?? 嘻嘻….
if ([[[NSBundle mainBundle] infoDictionary] objectForKey: @”SignerIdentity”] != nil) {
// 这就是被破解过的app
}
2. 检查3个文件是否存在
NSString* bundlePath = [[NSBundle mainBundle] bundlePath];
BOOL fileExists = [[NSFileManager defaultManager] fileExistsAtPath:(@”%@/_CodeSignature”, bundlePath)];
if (!fileExists) {
// 这就是被破解过的app
}
BOOL fileExists2 = [[NSFileManager defaultManager] fileExistsAtPath:(@”%@/CodeResources”, bundlePath)];
if (!fileExists2) {
/// 这就是被破解过的app
}
BOOL fileExists3 = [[NSFileManager defaultManager] fileExistsAtPath:(@”%@/ResourceRules.plist”, bundlePath)];
if (!fileExists3) {
// 这就是被破解过的app
}
3. 对比文件修改时间是否一致, 看看你的程序是不是被二进制编辑器修改过了
NSString* bundlePath = [[NSBundle mainBundle] bundlePath];
NSString* path = [NSString stringWithFormat:@"%@/Info.plist", bundlePath];
NSString* path2 = [NSString stringWithFormat:@"%@/程序名字", bundlePath];
NSDate* infoModifiedDate = [[[NSFileManager defaultManager] fileAttributesAtPath:path traverseLink:YES] fileModificationDate];
NSDate* infoModifiedDate2 = [[[NSFileManager defaultManager] fileAttributesAtPath:path2 traverseLink:YES] fileModificationDate];
NSDate* pkgInfoModifiedDate = [[[NSFileManager defaultManager] fileAttributesAtPath:[[[NSBundle mainBundle] resourcePath] stringByAppendingPathCom
ponent:@”PkgInfo”] traverseLink:YES] fileModificationDate]; if( > [pkgInfoModifiedDate timeIntervalSinceReferen
ceDate]) { //Pirated
}
if( > [pkgInfoModifiedDate timeIntervalSinceReferen
ceDate]) { //Pirated
}
本文介绍了一种检测iOS应用程序是否被破解的方法,主要通过检查Info.plist文件中的SignerIdentity键,验证三个关键文件是否存在,以及对比文件的修改时间来判断应用的安全状态。
2020

被折叠的 条评论
为什么被折叠?



