Reveal

一、安装和简介

  a) download url

  b) Reveal 使用的方法有两种: Static Library Intefration, Dynamic Library Intefration。(我们使用 Dynamic Library Intefration)


 二、Dynamic Library Intefration

  a) 打开 Reveal -> Help -> Show Reveal Library In Finder, copy libReveal.dylib 到目标 app 的 Documents 目录。(我使用的是新浪的天气通)

  b) 创建 RevealUtil.h 和 RevealUtil.m,来自《iOS应用逆向工程》。

  RevealUtil.h

#import <Foundation/Foundation.h>

@interface RevealUtil : NSObject {
    @private
        void* revealLib;
}

- (void)startReveal;
- (void)stopReveal;

@end

  RevealUtil.m  

#import "RevealUtil.h"
#import <dlfcn.h>

@implementation RevealUtil

- (void)startReveal {
    NSString* revealLibName = @"libReveal.dylib";
    NSString* documentDirectory = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES)[0];
    NSString* dyLibPath = [documentDirectory stringByAppendingPathComponent:revealLibName];
    
    revealLib = dlopen([dyLibPath cStringUsingEncoding:NSUTF8StringEncoding], RTLD_NOW);
    
    if (revealLib == nil) {
        char *error = dlerror();
        NSLog(@"dlopen error: %s", error);

    } else {
        [[NSNotificationCenter defaultCenter] postNotificationName:@"IBARevealRequestStart" object:self];
    }
}

- (void)stopReveal {
    if (revealLib != nil) {
        [[NSNotificationCenter defaultCenter] postNotificationName:@"IBARevealRequestStop" object:self];
        
        if (dlclose(revealLib) == 0) {
            revealLib = nil;
            
        } else {
            char *error = dlerror();
            NSLog(@"Reveal Library could not be unloaded: %s", error);
        }
    }
}

@end

  c) 创建一个 Theos Tweak 项目(ref

  d) 修改 xxxtweak.plist,如下

  e) 修改 Tweak.xm 如下, (注意:这里 hook 的 class name 一定要对应,我这里是凭感觉猜的)

  f) 修改 makefile 文件,如下

  g) 打包安装到 ios 设备上,先关闭之前代开的目标应用,然后重新打开,并打开 mac 端的 Reveal,会有如下效果:(注意:保持 ios 设备和 mac 处于同一网段)

  

  

原文地址:https://www.cnblogs.com/eileenleung/p/3843028.html