【问题标题】:Is it possible to intercept System Calls via Theos Tweak? Jailed Version是否可以通过 Theos Tweak 拦截系统调用?入狱版
【发布时间】:2017-02-21 10:46:18
【问题描述】:

我能否通过 Theos (jailed versione) Tweak 拦截通用系统调用,例如 sqlite3_preparesqlite3_open 以及 CC_MD5libcommonCrypto

我会拦截所有这些调用并在控制台或日志文件中打印。 我读过一些关于 MSHookFunction 的文章,但我不确定。

编辑:我添加了一些我这些天写的代码。这是我的 Tweak.xm,我将在其中拦截 CC_MD5 调用,在简单的消息日志之后,我将返回正常流程。调整已注入,但我看不到任何消息。

#include <substrate.h>
#include <CommonCrypto/CommonDigest.h>

static unsigned char * (*original_CC_MD5)(const void *data, CC_LONG len, unsigned char *md);

static unsigned char * replaced_CC_MD5(const void *data, CC_LONG len, unsigned char *md) {

        NSLog(@"Calling MD5");
        return original_CC_MD5(data, len, md);
}

MSInitialize {
        MSHookFunction(CC_MD5, replaced_CC_MD5, &original_CC_MD5);
}

【问题讨论】:

    标签: ios theos tweak


    【解决方案1】:

    我发现了问题。我正在使用的Theos version 用于被监禁的设备。在这个版本中,MSHookFunction 被 fishhook 取代。

    使用鱼钩没问题:显然代码发生了变化

    #include <substrate.h>
    #include <CommonCrypto/CommonDigest.h>
    #import <fishhook.h>
    
    static unsigned char * (*original_CC_MD5)(const void *data, CC_LONG len, unsigned char *md);
    
    static unsigned char * replaced_CC_MD5(const void *data, CC_LONG len, unsigned char *md) {
    
            NSLog(@"Calling MD5");
            return original_CC_MD5(data, len, md);
    }
    
    %ctor {
    
    rebind_symbols((struct rebinding[1]){{"CC_MD5", replaced_CC_MD5, (void *)&original_CC_MD5}},1);
    
    }
    

    【讨论】:

      猜你喜欢
      • 2010-10-02
      • 1970-01-01
      • 2022-07-07
      • 2015-10-04
      • 1970-01-01
      • 2021-07-06
      • 1970-01-01
      • 2012-05-28
      • 2012-02-27
      相关资源
      最近更新 更多