【问题标题】:How to detect whether AppSync is installed on device?如何检测设备上是否安装了 AppSync?
【发布时间】:2012-10-25 21:48:58
【问题描述】:

AppSync 会导致 iCloud 和应用内购买出现一些问题,因此我想检测它是否存在于设备上以处理 iCloud 和 IAP 的奇怪行为。有什么办法知道吗?

设备越狱没关系,但 AppSync 会阻止我的应用程序正常工作,而且这显然是“黑客的痕迹”。

【问题讨论】:

    标签: ios security jailbreak


    【解决方案1】:

    我已经搜索并找到了 AppSync 的痕迹,这里是找出它是否存在于设备上的代码。是的,它比需要的时间长一点,但我想确定一下。当然在发布代码中你应该以某种方式混淆字符串,但就是这样:

    bool isAppSyncExist()
    {
        BOOL isbash = NO;
        BOOL isappsync = NO;
        FILE *f = fopen("/bin/bash", "r");
        if (f != NULL)
        {
            //Device is jailbroken
            isbash = YES;
            fclose(f);
        }
    
        if (isbash)
        {
            f = fopen("/Library/MobileSubstrate/DynamicLibraries/AppSync.plist", "r");
            if (f != NULL)
            {
                isappsync = YES;
                fclose(f);
            }
            if (isappsync == NO)
            {
                NSError *err;
                NSArray *files = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:@"/private/var/lib/dpkg/info" error:&err];
    
                for (int i = 0; i < files.count; i++)
                {
                    NSString *fname = [files objectAtIndex:i];
                    if ([fname rangeOfString:@"appsync" options:NSCaseInsensitiveSearch].location != NSNotFound)
                    {
                        isappsync = YES;
                        break;
                    }
                }
            }
            if (isappsync == NO)
            {
                NSError *err;
                NSArray *files = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:@"/var/lib/dpkg/info" error:&err];
    
                for (int i = 0; i < files.count; i++)
                {
                    NSString *fname = [files objectAtIndex:i];
                    if ([fname rangeOfString:@"appsync" options:NSCaseInsensitiveSearch].location != NSNotFound)
                    {
                        isappsync = YES;
                        break;
                    }
                }
            }
        }
    
        return isappsync == YES;
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-03-05
      • 1970-01-01
      • 1970-01-01
      • 2012-09-22
      • 2010-11-05
      • 2016-06-30
      • 1970-01-01
      • 2021-09-25
      相关资源
      最近更新 更多