MobileSubstrate MShookfunction on

时间:2013-08-29 08:59:14

标签: ios cydia-substrate

我希望推翻CCCrypt函数,以查看是否有任何变量在应用程序中进行了硬编码。我正在使用PonyDebuggerInjected监视应用程序,我使用的mshookcode是:

import

static CCCryptorStatus (*old_CCCryptorCreate)(
                                              CCOperation op,             /* kCCEncrypt, etc. */
                                              CCAlgorithm alg,            /* kCCAlgorithmDES, etc. */
                                              CCOptions options,          /* kCCOptionPKCS7Padding, etc. */
                                              const void *key,            /* raw key material */
                                              size_t keyLength,
                                              const void *iv,             /* optional initialization vector */
                                                     CCCryptorRef *cryptorRef);

   CCCryptorStatus hk_CCCryptorCreate(
                                    CCOperation op,             /* kCCEncrypt, etc. */
                                    CCAlgorithm alg,            /* kCCAlgorithmDES, etc. */
                                    CCOptions options,          /* kCCOptionPKCS7Padding, etc. */
                                    const void *key,            /* raw key material */
                                    size_t keyLength,
                                    const void *iv,             /* optional initialization vector */
                                    CCCryptorRef *cryptorRef)  /* RETURNED */
    {

        NSString *_operation;
        if(op == kCCEncrypt) _operation = @"kCCEncrypt";
        else if (op == kCCDecrypt) _operation = @"kCCDecrypt";

        NSString *_algorithm;
        if(alg == kCCAlgorithmAES128) _algorithm = @"kCCAlgorithmAES128";
        else if(alg == kCCAlgorithmDES) _algorithm = @"kCCAlgorithmDES";
        else if(alg == kCCAlgorithm3DES) _algorithm = @"kCCAlgorithm3DES";
        else if(alg == kCCAlgorithmCAST) _algorithm = @"kCCAlgorithmCAST";
        else if(alg == kCCAlgorithmRC4) _algorithm = @"kCCAlgorithmRC4";
        else if(alg == kCCAlgorithmRC2) _algorithm = @"kCCAlgorithmRC2";
        else if(alg == kCCAlgorithmBlowfish) _algorithm = @"kCCAlgorithmBlowfish";
        else _algorithm = @"Unknown";

        NSString *_options;
        if(options == kCCOptionPKCS7Padding) _options = @"kCCOptionPKCS7Padding";
        else if(options == kCCOptionECBMode) _options = @"kCCOptionECBMode";
        else _options = @"Unknown";



        //NSLog("CryptoDebug2> CCCryptCreate(Operation: %@, Algorithm: %@, Options: %@, Key: %s, Vector: %s, Key Length: %ld)", _operation, _algorithm, _options, key, iv, keyLength);


        return old_CCCryptorCreate(op,alg,options,key,keyLength,iv,cryptorRef);

    }

MSHookFunction(CCCryptorCreate, hk_CCCryptorCreate, &old_CCCryptorCreate); 

但我无法编译调整并继续收到错误。

Making all for tweak ccryptOverride...
 Preprocessing Tweak.xm...
 Compiling Tweak.xm...
Tweak.xm:56: error: expected constructor, destructor, or type conversion before ‘(’ token
make[2]: *** [obj/Tweak.xm.e72d3a56.o] Error 1
make[1]: *** [internal-library-all_] Error 2
make: *** [ccryptOverride.all.tweak.variables] Error 2

我试过在mshook函数面前放空,但它然后抱怨。任何指针都将不胜感激

0 个答案:

没有答案