iOS审核上架逆向开发

iOS逆向工程(三):利用Cycript调试App

2020-10-21  本文已影响0人  冰雨9527

利用Cycript调试App

一、Cycript是什么?
二、Cycript的用法
例如:想挂载皮皮虾App,先让皮皮虾App在手机里跑起来,找到进程名后,输入以下命令
cycript -p Super
1>.使用前提:MacSSH登录了iPhone,iPhone安装了Cycript
2>.ps -A , 找出所有进程
3>.cycript -p Super,挂载皮皮虾,出现cy#,说明进入到了Cycript环境
三、Cycript的常用语法
四、封装并导入Cycript库
(function(exports){
    // app id
    AppId = [NSBundle mainBundle].bundleIdentifier;

    // mainBundlePath
    BundlePath = [NSBundle mainBundle].bundlePath;

    // keyWindow
    KeyWin = function() {
        return UIApp.keyWindow;
    };

    // rootView
    RootVc =  function() {
        return UIApp.keyWindow.rootViewController;
    };
})(exports);
五、在iOS12及以后的系统,挂载进程的方法
assert($mach_task_self != NULL)
*** _assert(status == 0):../Inject.cpp(143):InjectLibrary
六、知识点总结
1>.使用Cycript调试APP的前提:用Mac以SSH的方式登录了iPhone,iPhone安装了Cycript
2>.ps -A , 找出所有进程,找到要调试的APP
3>.以皮皮虾APP为例,挂载皮皮虾APP的进程:
- iOS12系统以前的挂载 :cycript -p Super
- iOS12系统以后的挂载 :cyrun -n Super -e -d -f 或者 cyrun  -b  bundleID -e
4>. 挂载后,会进入cycript环境,导入封装好的库,使用其中的方法进行调试: @import mjcript
5>. 找到皮皮虾APP的当前控制器: MJFrontVc()
6>. 退出cycript环境:Control + D
七、修改皮皮虾APP界面
songpengdeMBP:~ songpeng$ sh login.sh
iPhone7ceshiji:~ root# cyrun -n Super -e -d -f
applicationName: Super is not running (-1)
    executableName: Super
    bundleIdentifier: com.bd.iphone.super
    Cycript is inactive:
    Device is not passcode locked
    Tweak Mode
Waiting for Cycript to become active...
Successfully enabled, you may now run
    cycript -r 127.0.0.1:8556
cy# @import mjcript
{}
cy# MJFrontVc()
#"<BDSLoginViewController: 0x107b0f400>"
cy# MJVcSubviews(#0x107b0f400)
`<UIView: 0x11719b2b0; frame = (0 0; 375 667); autoresize = W+H; gestureRecognizers = <NSArray: 0x2836757d0>; layer = <CALayer: 0x283b2dea0>>
   | <BDSNavigationBar: 0x117194a60; baseClass = UIControl; frame = (0 0; 375 64); layer = <CALayer: 0x283b2e060>>
   |    | <UIView: 0x106dc3600; frame = (0 20; 375 44); layer = <CALayer: 0x283b2aec0>>
   |    |    | <BDSNavigationBarItem: 0x1179baa00; baseClass = UIControl; frame = (0 0; 48 44); layer = <CALayer: 0x283b29d80>>
   |    |    |    | <UIImageView: 0x1179b2870; frame = (12 10; 24 24); opaque = NO; userInteractionEnabled = NO; layer = <CALayer: 0x283b2ac60>>
   |    |    | <BDSNavigationBarItem: 0x1179babf0; baseClass = UIControl; frame = (314 8; 48 36); hidden = YES; layer = <CALayer: 0x283b2ae40>>
   |    |    |    | <UILabel: 0x1179b2bc0; frame = (0 0; 48 36); text = '\u8df3\u8fc7'; clipsToBounds = YES; userInteractionEnabled = NO; layer = <_UILabelLayer: 0x281a15e00>>
   |    |    | <UILabel: 0x117196d00; frame = (187.5 0; 0 44); userInteractionEnabled = NO; layer = <_UILabelLayer: 0x281a137f0>>
   |    |    |    | <_UILabelContentLayer: 0x283b34c60> (layer)
   | <UILabel: 0x117917e10; frame = (24 81.4815; 80 56); text = '\u767b\u5f55'; userInteractionEnabled = NO; layer = <_UILabelLayer: 0x281a15a40>>
   |    | <_UILabelContentLayer: 0x283b34b60> (layer)
   | <UITextField: 0x117136290; frame = (26 186.37; 336 42); text = ''; opaque = NO; gestureRecognizers = <NSArray: 0x28349c5a0>; layer = <CALayer: 0x283b2dce0>>
   |    | <UITextFieldLabel: 0x11719a4c0; frame = (0 0; 309 42); text = '\u8f93\u5165\u624b\u673a\u53f7'; opaque = NO; userInteractionEnabled = NO; layer = <_UILabelLayer: 0x281a11590>>
   |    |    | <_UILabelContentLayer: 0x283b34a80> (layer)
   |    | <UIFieldEditor: 0x1073b4c00; frame = (0 0; 309 42); text = ''; clipsToBounds = YES; opaque = NO; gestureRecognizers = <NSArray: 0x283652c70>; layer = <CALayer: 0x283b2dd00>; contentOffset: {0, 0}; contentSize: {309, 42}; adjustedContentInset: {0, 0, 0, 0}>
   |    |    | <_UITextFieldCanvasView: 0x117169530; frame = (0 0; 309 42); opaque = NO; userInteractionEnabled = NO; layer = <_UITextTiledLayer: 0x28085d8c0>>
   |    |    |    | <UITextSelectionView: 0x1171a6d20; frame = (0 0; 0 0); userInteractionEnabled = NO; layer = <CALayer: 0x283b3a260>>
   |    |    |    |    | <UIView: 0x1179a4810; frame = (0 0; 2 42); userInteractionEnabled = NO; layer = <CALayer: 0x283b3d9c0>>
   | <UIView: 0x11712f6f0; frame = (24 233.556; 327 1); layer = <CALayer: 0x283b2e7e0>>
   | <UIButton: 0x1171bbd80; frame = (0 401; 375 50); opaque = NO; layer = <CALayer: 0x283b2e880>>
   |    | <UIImageView: 0x117194e00; frame = (0 0; 375 50); clipsToBounds = YES; opaque = NO; userInteractionEnabled = NO; layer = <CALayer: 0x283b34f20>>
   |    | <UIButtonLabel: 0x106cd0180; frame = (145 13; 85 24); text = '\u83b7\u53d6\u9a8c\u8bc1\u7801'; opaque = NO; userInteractionEnabled = NO; layer = <_UILabelLayer: 0x281a1f840>>
   |    |    | <_UILabelContentLayer: 0x283b35200> (layer)
   | <UILabel: 0x1171b5b40; frame = (24 246.5; 327 20); text = '\u4e3a\u4e86\u60a8\u7684\u8d26\u53f7\u5b89\u5168\uff0c\u8bf7\u7ed1\u5b9a\u624b\u673a\u53f7'; hidden = YES; userInteractionEnabled = NO; layer = <_UILabelLayer: 0x281a1f7f0>>
   |    | <_UILabelContentLayer: 0x283b34ec0> (layer)
   | <UILabel: 0x11717c3d0; frame = (24 372.5; 327 18); userInteractionEnabled = NO; layer = <_UILabelLayer: 0x281a1dc70>>
   |    | <_UILabelContentLayer: 0x283b35140> (layer)
   | <BDSVerifyCodeInputView: 0x117147b90; frame = (24 168.889; 327 54); hidden = YES; layer = <CALayer: 0x283b2eb00>>
   |    | <UITextField: 0x11718d1b0; frame = (0 8; 2 38); text = ''; opaque = NO; tintColor = UIExtendedGrayColorSpace 0.25098 1; gestureRecognizers = <NSArray: 0x283648720>; layer = <CALayer: 0x283b2eb20>>
   |    |    | <_UITextFieldCanvasView: 0x1171bd3d0; frame = (0 0; 2 38); opaque = NO; userInteractionEnabled = NO; layer = <_UITextTiledLayer: 0x28085da70>>
   |    | <BDSVerifyCodeInputLabel: 0x1179b3330; baseClass = UILabel; frame = (0 0; 327 54); userInteractionEnabled = NO; layer = <_UILabelLayer: 0x281a15860>>
   |    |    | <_UILabelContentLayer: 0x283b35820> (layer)
   | <UILabel: 0x11792be30; frame = (0 231.778; 375 20); text = '\u9a8c\u8bc1\u7801\u9519\u8bef'; hidden = YES; userInteractionEnabled = NO; layer = <_UILabelLayer: 0x281a15770>>
   |    | <_UILabelContentLayer: 0x283b35080> (layer)
   | <BDSRegisterProtocolView: 0x117958e20; frame = (39 361; 297 38); layer = <CALayer: 0x283b32c20>>
   |    | <UIButton: 0x1179f8ec0; frame = (10 10; 18 18); opaque = NO; layer = <CALayer: 0x283b32b60>>
   |    |    | <UIImageView: 0x11717e320; frame = (0 0; 18 18); clipsToBounds = YES; opaque = NO; userInteractionEnabled = NO; layer = <CALayer: 0x283b359e0>>
   |    | <TTTAttributedLabel: 0x117920400; baseClass = UILabel; frame = (32 9; 255 20); text = '\u6211\u5df2\u9605\u8bfb\u5e76\u540c\u610f\u201c\u7528\u6237\u534f\u8bae\u201d\u548c\u201c\u9690\u79c1\u653f\u7b56\u201d'; gestureRecognizers = <NSArray: 0x28366c2a0>; layer = <_UILabelLayer: 0x281a145a0>>
   |    |    | <_UILabelContentLayer: 0x283b35300> (layer)
   | <UIButton: 0x1179dfa80; frame = (145 140.481; 17 17); hidden = YES; opaque = NO; layer = <CALayer: 0x283b32b20>>
   |    | <UIImageView: 0x11715ed00; frame = (0 0; 17 17); clipsToBounds = YES; opaque = NO; userInteractionEnabled = NO; layer = <CALayer: 0x283b35a00>>
   | <UIView: 0x1179bf5e0; frame = (24 249.5; 128 24); layer = <CALayer: 0x283b32500>>
   |    | <ArticlePlatformLoginView: 0x11791bb60; frame = (0 0; 128 24); layer = <CALayer: 0x283b32f60>>
   |    |    | <BDSAlphaThemedButton: 0x117159ab0; baseClass = UIButton; frame = (104 0; 24 24); opaque = NO; layer = <CALayer: 0x283b2f300>>
   |    |    |    | <UIImageView: 0x11717a9b0; frame = (0 0; 24 24); clipsToBounds = YES; opaque = NO; userInteractionEnabled = NO; layer = <CALayer: 0x283b35860>>
   |    |    | <UILabel: 0x11710ec00; frame = (0 2; 84 20); text = '\u5176\u5b83\u65b9\u5f0f\u767b\u5f55'; userInteractionEnabled = NO; layer = <_UILabelLayer: 0x281a1f570>>
   |    |    |    | <_UILabelContentLayer: 0x283b357a0> (layer)`
cy# 登录
throw new ReferenceError("Can't find variable: \u767b\u5f55")
cy# #0x117917e10.text = '逆向调试'
"\u9006\u5411\u8c03\u8bd5"
cy# #0x117917e10.size = MJSizeMake(200,30)
{0:200,1:30}
上一篇下一篇

猜你喜欢

热点阅读