gpt4 book ai didi

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

转载 作者:技术小花猫 更新时间:2023-10-29 11:20:19 25 4
gpt4 key购买 nike

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

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

但是这种方法不再有效,因为破解者已经找到了改变 Info.plist 的方法。我知道 this older question ,但那里给出的答案依赖于上述技术,该技术不再有效。

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

最佳答案

我个人喜欢 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;
}

关于ios - 如何在不检查 SignerIdentity 的情况下检测应用程序是否已被破解?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12774278/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com