使用Reveal分析任意的界面結構

更新時間:2016.1.27
       已支持直接在Cydia中下載插件Reveal Loader 來監控任意app的UI了


特別提醒,現已無需按下面的方式注入libReveal.dlib了,只需把libReveal.dylib上傳到設備的/Library/MobileSubstrate/DynamicLibraries,而後同時編輯並上傳一個libReveal.plist,格式以下: 使用Reveal分析任意的界面結構 圖3 設定BundleIDphp

注意,此時是能夠指定多個BundleID的,也就是說,你能夠同時監控任意多的app;再擴大一步說,若是你願意,不上傳這個libReveal.plist,你能夠監控全部app,只要你不以爲機器很慢。。。html

必定確保手機和電腦端處在同一局域網中,否則看不到界面的ios

Reveal.app 目前能搞到2.0.3的版本且能用註冊機破解,但貌似對ios7.0以上的應用無效,須要Reveal2.0.4版,但又沒法破解目前,2.0.3版本百度雲下載app

http://c.blog.sina.com.cn/profile.php?blogid=cb8a22ea89000gtw&qq-pf-to=pcqq.c2cssh



打開XCode建立iOSOpenDev--》Logos Tweak的工程

建立動態加載Reveal的類RevealUtil:
//
//  RevealUtil.h
//  pyu
//
//  Created by whe on 6/23/13.
//
//

#import

@interface RevealUtil : NSObject {
    void *_revealLib;
}

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

@end

//
//  RevealUtil.m
//  pyu
//
//  Created by whe on 6/23/13.
//
//
#import
#import
#import "RevealUtil.h"

@implementation RevealUtil

- (void)startReveal {
    NSString *revealLibName = @"libReveal.dylib";
    //NSString *revealLibExtension = @"dylib";
    NSString *bundlePath = [[NSBundle mainBundle] bundlePath];
   //此處要先將libReveal.dylib經過iTools上傳到須要分析的App的Buldle主目錄下(即xxx.app目錄)
    NSString *dyLibPath = [NSString stringWithFormat:@"%@/%@",bundlePath,revealLibName];
    UIAlertView *alert = [[UIAlertView alloc]
                          initWithTitle:@"Welcome"  message:[NSString stringWithFormat:@"Loading dynamic library: %@", dyLibPath]
                          delegate:nil cancelButtonTitle:@"Thanks"
                          otherButtonTitles:nil];
    [alert show];
    [alert release];
   
    void *revealLib = NULL;
    revealLib = dlopen([dyLibPath cStringUsingEncoding:NSUTF8StringEncoding], RTLD_NOW);
   
    if (revealLib == NULL)
    {
        char *error = dlerror();
        NSLog(@"dlopen error: %s", error);
    }else {
        [[NSNotificationCenter defaultCenter] postNotificationName:@"IBARevealRequestStart" object:self];
    }
}

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

@end

修改工程的xm文件內容以下:
#import "RevealUtil.h"

%hook MobileAssistAppDelegate //對應分析APP的AppDelegate文件類名,不一樣的App這個類名可能不一樣,這能夠先經過class-dump  xxx.app這個二進制文件,得出該APP全部的頭文件,而後搜索關鍵字didFinishLaunchingWithOptions,找到對應文件並查看該文件內的類名便是

- (BOOL)application:(id)arg1 didFinishLaunchingWithOptions:(id)arg2 {
    %orig;
   
    RevealUtil *ru = [[RevealUtil alloc] init];
    [ru startReveal];
   
    return YES;
}

%end

最終項目結構以下:
使用Reveal分析任意的界面結構

注意那個Filter,其實能夠不填,但要填必定要是該app的bundle identifier



附:OpenSSH的使用:
       ssh root@192.168.2.5 默認密碼alpine
     先經過ssh登陸到手機,而後能夠經過cycript -p 進程ID   依附在須要分析的應用程序上  ps ax | grep PPide

相關文章
相關標籤/搜索