aaaaaaaaaaaa
代码改变世界

cycript使用

2018-03-01 10:21  二进制乐谱  阅读(1214)  评论(0编辑  收藏  举报

cycript的原理是动态库注入,但是其动态库注入的原理,与我们常见的通过LC_LOAD_DYLIB在可执行文件中注入动态库不同. cycript的操作是 :
抓取到要挂载的应用, 由于越狱机上拥有权限,所以直接在挂载的进程上创建一个挂起的线程, 然后在这个线程里申请一片用于加载动态库的内存,
然后恢复线程,动态库就被注入。

 

越狱的手机上安装cycript

查找进程

  ps -e|grep /Application/ 查找MobileNotes

 

 

注入进程:

cycript -p MobileNotes

 

cycript命令:

查看地址对象:

 #address

 

object-c message

  _ivarDescription

  _shortMethodDescription

  nextResponder

  _autolayoutTrace

  recursiveDescription

  _methodDescription

[UIApp description]

 

 _methodDescription

 

 _ivarDescription

这个应该是成员变量

 

打印当前界面

UIApp.keyWindow.recursiveDescription().toString()

throw new TypeError(`'<UIWindow: 0x12d613ff0; frame = (0 0; 320 568); gestureRecognizers = <NSArray: 0x17005cd10>; layer = <UIWindowLayer: 0x17002fe20>>

   | <UILayoutContainerView: 0x1781ba320; frame = (0 0; 320 568); autoresize = W+H; gestureRecognizers = <NSArray: 0x17805e7b0>; layer = <CALayer: 0x170036c40>>

   |    | <UINavigationTransitionView: 0x1701f0200; frame = (0 0; 320 568); clipsToBounds = YES; autoresize = W+H; layer = <CALayer: 0x170036c00>>

   |    |    | <UIViewControllerWrapperView: 0x17016f240; frame = (0 0; 320 568); autoresize = W+H; layer = <CALayer: 0x170224460>>

   |    |    |    | <NotesBackgroundView: 0x1781f4500; frame = (0 0; 320 568); autoresize = W+H; layer = <CALayer: 0x178038120>>

   |    |    |    |    | <NotesTextureBackgroundView: 0x178192fe0; frame = (0 0; 320 568); autoresize = W+H; layer = <CALayer: 0x1780385c0>>

   |    |    |    |    |    | <NotesTextureView: 0x178193f50; frame = (0 -44; 320 640); layer = <CALayer: 0x178037fc0>>

   |    |    |    |    | <UIView: 0x17816ed00; frame = (0 0; 320 568); autoresize = W+H; layer = <CALayer: 0x178038340>>

   |    |    |    |    |    | <NotesListTableView: 0x12d83c400; baseClass = UITableView; frame = (0 0; 320 568); clipsToBounds = YES; opaque = NO; autoresize = W+H; gestureRecognizers = <NSArray: 0x178241cb0>; layer = <CALayer: 0x178038060>; contentOffset: {0, -20}>

   |    |    |    |    |    |    | <UIView: 0x17016f0c0; frame = (0 -20; 320 568); autoresize = W+H; layer = <CALayer: 0x170224080>>

   |    |    |    |    |    |    | <UITableViewWrapperView: 0x17816ee80; frame = (0 0; 320 568); autoresize = W+H; layer = <CALayer: 0x1780388a0>>

   |    |    |    |    |    |    |    | <NoteCell: 0x12d63bad0; baseClass = UITableViewCell; frame = (0 44; 320 44); opaque = NO; autoresize = W; layer = <CALayer: 0x170225000>>

   |    |    |    |    |    |    |    |    | <UITableViewCellScrollView: 0x12d63bfc0; frame = (0 0; 320 44); autoresize = W+H; gestureRecognizers = <NSArray: 0x1702514c0>; layer = <CALayer: 0x170225060>; contentOffset: {0, 0}>

   |    |    |    |    |    |    |    |    |    | <UITableViewCellContentView: 0x17016f540; frame = (0 0; 294.5 43.5); gestureRecognizers = <NSArray: 0x170251760>; layer = <CALayer: 0x170225140>>

   |    |    |    |    |    |    |    |    |    | <NoteCellContentView: 0x12d514b30; frame = (0 0; 320 44); opaque = NO; autoresize = W+H; layer = <CALayer: 0x17803ebc0>>

   |    |    |    |    |    |    |    |    |    | <_UITableViewCellSeparatorView: 0x1781949e0; frame = (15 43.5; 305 0.5); layer = <CALayer: 0x17803fc40>>

   |    |    |    |    |    |    |    |    |    | <UIImageView: 0x1781f3300; frame = (294.5 14; 10.5 15); opaque = NO; userInteractionEnabled = NO; layer = <CALayer: 0x17803ec40>>

   |    |    |    |    |    |    | <UILabel: 0x12d516bd0; frame = (0 0; 102

 

nextResponder找到视图控制器  ViewController

 

 

_autolayoutTrace

 

cy# [#0x1781ba320 _autolayoutTrace].toString()

`

<UIWindow:0x12d613ff0>

|   <UILayoutContainerView:0x1781ba320>

|   |   <UINavigationTransitionView:0x1701f0200>

|   |   |   <UIViewControllerWrapperView:0x17016f240>

|   |   |   |   <NotesBackgroundView:0x1781f4500>

|   |   |   |   |   <NotesTextureBackgroundView:0x178192fe0>

|   |   |   |   |   |   <NotesTextureView:0x178193f50>

|   |   |   |   |   <UIView:0x17816ed00>

|   |   |   |   |   |   <NotesListTableView:0x12d83c400>

|   |   |   |   |   |   |   <UIView:0x17016f0c0>

|   |   |   |   |   |   |   <UITableViewWrapperView:0x17816ee80>

|   |   |   |   |   |   |   |   <NoteCell:0x12d63bad0>

|   |   |   |   |   |   |   |   |   <UITableViewCellScrollView:0x12d63bfc0>

|   |   |   |   |   |   |   |   |   |   <UITableViewCellContentView:0x17016f540>

|   |   |   |   |   |   |   |   |   |   <NoteCellContentView:0x12d514b30>

|   |   |   |   |   |   |   |   |   |   <_UITableViewCellSeparatorView:0x1781949e0>

|   |   |   |   |   |   |   |   |   |   <UIImageView:0x1781f3300>

|   |   |   |   |   |   |   <UILabel:0x12d516bd0>

|   |   |   |   |   |   |   <UISearchBar:0x12d6352a0>

|   |   |   |   |   |   |   |   <UIView:0x17016ec40>

|   |   |   |   |   |   |   |   |   <UISearchBarBackground:0x12d635bc0>

|   |   |   |   |   |   |   |   |   |   <_UIBackdropView:0x12d6379c0>

|   |   |   |   |   |   |   |   |   <UISearchBarTextField:0x12d636b40>

|   |   |   |   |   |   |   |   |   |   <_UISearchBarSearchFieldBackgroundView:0x12d528ce0>

|   |   |   |   |   |   |   |   |   |   |   <_UISearchBarSearchFieldBackgroundView:0x12d636dc0>

|   |   |   |   |   |   |   |   |   |   |   <_UISearchBarSearchFieldBackgroundView:0x12d636050>

|   |   |   |   |   |   |   |   |   |   <UIImageView:0x1781f5500>

|   |   |   |   |   |   |   |   |   |   <UISearchBarTextFieldLabel:0x12d639100>

|   |   |   |   |   |   |   <_UITableViewCellSeparatorView:0x178194910>

|   |   |   |   |   |   |   <_UITableViewCellSeparatorView:0x178194ab0>

|   |   |   |   |   |   |   <_UITableViewCellSeparatorView:0x178194b80>

|   |   |   |   |   |   |   <_UITableViewCellSeparatorView:0x178194c50>

|   |   |   |   |   |   |   <_UITableViewCellSeparatorView:0x178194d20>

|   |   |   |   |   |   |   <_UITableViewCellSeparatorView:0x178194df0>

|   |   |   |   |   |   |   <_UITableViewCellSeparatorView:0x178194ec0>

|   |   |   |   |   |   |   <_UITableViewCellSeparatorView:0x178194f90>

|   |   |   |   |   |   |   <_UITableViewCellSeparatorView:0x178195060>

|   |   |   |   |   |   |   <_UITableViewCellSeparatorView:0x178195130>

|   |   |   |   |   |   |   <_UITableViewCellSeparatorView:0x178195200>

|   |   |   |   |   |   |   <_UITableViewCellSeparatorView:0x1781952d0>

|   |   |   |   |   |   |   <_UITableViewCellSeparatorView:0x1781953a0>

|   |   |   |   |   |   |   <_UITableViewCellSeparatorView:0x178195540>

|   |   |   |   |   |   |   <_UITableViewCellSeparatorView:0x1781956e0>

|   |   |   |   |   |   |   <_UITableViewCellSeparatorView:0x178195880>

|   |   |   |   |   |   |   <_UITableViewCellSeparatorView:0x178195a20>

|   |   |   |   |   |   |   <_UITableViewCellSeparatorView:0x178195c90>

|   |   |   |   |   <NotesTextureBackgroundView:0x178194020>

|   |   |   |   |   |   <NotesTextureView:0x1781940f0>

|   |   <UINavigationBar:0x12d6145a0>

|   |   |   <_UINavigationBarBackground:0x12d614ea0>

|   |   |   <UINavigationButton:0x12d639e40>

|   |   |   |   <UIButtonLabel:0x12d512860>

|   |   |   <_UINavigationBarBackIndicatorView:0x1701f1300>`

cy# 

 

bundleIdentifier 获appid

cy# [[NSBundle mainBundle] bundleIdentifier]

@"com.apple.mobilenotes"

 

 

 

aaaaaaaaaaaaa