如何检测AppSync是否已安装在设备上?

时间:2012-10-25 21:48:59

标签: ios security jailbreak

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

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

1 个答案:

答案 0 :(得分: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;
}