zoukankan      html  css  js  c++  java
  • 防止你的iPhone程序遭盗版(入门篇)

    转载自:http://www.devdiv.com/%E9%98%B2%E6%AD%A2%E4%BD%A0%E7%9A%84iPhone%E7%A8%8B%E5%BA%8F%E9%81%AD%E7%9B%97%E7%89%88_%E5%85%A5%E9%97%A8%E7%AF%87_-weblog-215400-12864.html

    老大让研究app遭盗版了怎么判断,找到一片文章,没测试过,不知道咋测试!先收藏下!

    首先简单介绍一下原理:

    现在大多数的破解苹果验证安装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] stringByAppendingPathComponent:@”PkgInfo”] traverseLink:YES] fileModificationDate];

    if([infoModifiedDate timeIntervalSinceReferenceDate] > [pkgInfoModifiedDate timeIntervalSinceReferenceDate]) {

    //Pirated

    }

    if([infoModifiedDate2 timeIntervalSinceReferenceDate] > [pkgInfoModifiedDate timeIntervalSinceReferenceDate]) {

    //Pirated

    }

    如果以上3条都没挡住丫挺的步伐, 请等我出高级篇吧 :) 恭喜发财!


    PS:

    本人用的就是越狱过后的机器,

    用 phoneView 打开看了一下,上述的检测方法好像有点儿过时了~

    不过获取设备中 userDefaults 物理文件的修改时间还是具有一些参考价值的。

  • 相关阅读:
    左偏树
    论在Windows下远程连接Ubuntu
    ZOJ 3711 Give Me Your Hand
    SGU 495. Kids and Prizes
    POJ 2151 Check the difficulty of problems
    CodeForces 148D. Bag of mice
    HDU 3631 Shortest Path
    HDU 1869 六度分离
    HDU 2544 最短路
    HDU 3584 Cube
  • 原文地址:https://www.cnblogs.com/java20130723/p/3212087.html
Copyright © 2011-2022 走看看