How do I detect if an app has been cracked without examining the SignerIdentity?

前端 未结 4 1462
暖寄归人
暖寄归人 2021-01-30 05:03

There used to be a method to check if an application was purchased from the App Store, to protect against cracking:

NSBundle *bundle = [NSBundle mainBundle]; 
NS         


        
4条回答
  •  难免孤独
    2021-01-30 05:23

    I'd suggest a smaller code snippet that does the same thing as @user1353482 suggested (and the same way). I'd write in comments, but code would be unreadable then. Moreover, I may be wrong but it seems that additional defines is not needed anymore even when compiling for simulator (at least this works in xcode 4.5.1, target is 5.0).

    Please note that this code returns false on debug and adhoc binary, but we're talking about appstore, right? It's Apple who makes the final encryption and you're supposed to not try this at home :)

    #include 
    #import 
    
    bool executableEncryption()
    {
        const uint8_t *command = (const uint8_t *) (&_mh_execute_header + 1);
        for (uint32_t idx = 0; idx < _mh_execute_header.ncmds; ++idx)
        {
            if (((const struct load_command *) command)->cmd == LC_ENCRYPTION_INFO)
            {
                struct encryption_info_command *crypt_cmd = (struct encryption_info_command *) command;    
                if (crypt_cmd->cryptid < 1)
                    return false;
                return true;
            }
            else
            {
                command += ((const struct load_command *) command)->cmdsize;
            }
        }
        return false;
    }
    

提交回复
热议问题