如何在不检查SignerIdentity的情况下检测应用程序是否已被破解?

Dmi*_*try 9 iphone app-store ipad ios

曾经有一种方法来检查应用程序是否是从App Store购买的,以防止破解:

NSBundle *bundle = [NSBundle mainBundle]; 
NSDictionary *info = [bundle infoDictionary]; 
if ([info objectForKey: @"SignerIdentity"] != nil) 
{ /* do something */  }
Run Code Online (Sandbox Code Playgroud)

但这种方法不再有效,因为破解者已经找到了改变Info.plist的方法.我知道这个较老的问题,但那里提出的答案依赖于上述技术,该技术已不再有效.

如何在不从Info.plist中读取SignerIdentity的情况下,如何从App Store中检测您的应用程序是否被破解或合法购买?

web*_*rsx 10

我个人喜欢Mick的回答,因为它简短而简单.

Greg的回复无效--Mick的代码只检查应用程序是否可以打开该URL,因此不应该崩溃.

我已经在我的一个应用程序中实现了以下内容,之前会更严格地检查应用程序是否加密,如果不是它很可能是一个破解的应用程序:

从分析来看,这种方法已经阻止了成千上万的盗版用户,并且花了大约5分钟来实现,所以这样做的成本几乎没有 - 对我来说,我不在乎它是否增加了销售额(我确信它不是不管怎么说 - 更多的是我不希望人们从我的辛勤工作中挣脱出来.此外,我的应用程序的大量内容在确定应用程序是否是盗版之后提供信息,如果是,则返回垃圾数据.

在main.m

#import <dlfcn.h>
#import <mach-o/dyld.h>
#import <TargetConditionals.h>

#if TARGET_IPHONE_SIMULATOR && !defined(LC_ENCRYPTION_INFO)
#define LC_ENCRYPTION_INFO 0x21
struct encryption_info_command {
    uint32_t cmd;
    uint32_t cmdsize;
    uint32_t cryptoff;
    uint32_t cryptsize;
    uint32_t cryptid;
};
#endif

static BOOL isEncrypted();

static BOOL isEncrypted () {
    const struct mach_header *header;
    Dl_info dlinfo;

    /* Fetch the dlinfo for main() */
    if (dladdr(main, &dlinfo) == 0 || dlinfo.dli_fbase == NULL) {
        //NSLog(@"Could not find main() symbol (very odd)");
        return NO;
    }
    header = dlinfo.dli_fbase;

    /* Compute the image size and search for a UUID */
    struct load_command *cmd = (struct load_command *) (header+1);

    for (uint32_t i = 0; cmd != NULL && i < header->ncmds; i++) {
        /* Encryption info segment */
        if (cmd->cmd == LC_ENCRYPTION_INFO) {
            struct encryption_info_command *crypt_cmd = (struct encryption_info_command *) cmd;
            /* Check if binary encryption is enabled */
            if (crypt_cmd->cryptid < 1) {
                /* Disabled, probably pirated */
                return NO;
            }

            /* Probably not pirated <-- can't say for certain, maybe theres a way around it */
            return YES;
        }

        cmd = (struct load_command *) ((uint8_t *) cmd + cmd->cmdsize);
    }

    /* Encryption info not found */
    return NO;
}
Run Code Online (Sandbox Code Playgroud)


Mic*_*ker -4

虽然不是检查应用程序是否是从 App Store 购买的,但我使用此代码来检查我的应用程序是否在越狱设备上运行:

+(BOOL)isJailbroken { 
    NSURL* url = [NSURL URLWithString:@"cydia://package/com.example.package"]; 
    return [[UIApplication sharedApplication] canOpenURL:url]; 
} 
Run Code Online (Sandbox Code Playgroud)

  • 这不是最好的答案,因为并非所有越狱者都是海盗。如果有人为你的应用程序付费,但由于他们越狱而导致应用程序崩溃,这会激怒他们。 (9认同)