首先,要使用Cycript你必须有一台越狱手机,这是必要条件,且能连接SSH。怎么连接SSH参考:SSH连接越狱iPhone(WIFI和USB)
- 手机安装Cycript:打开Cydia搜索Cycript进行安装
- 连接ssh
admindeMBP-4:~ admin$ ssh -p 2222 [email protected]
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that a host key has just been changed.
The fingerprint for the RSA key sent by the remote host is
SHA256:r1N7OuW80egI2Mek2kvT9snEcbikdljw9U8XYNZd+EM.
Please contact your system administrator.
Add correct host key in /Users/admin/.ssh/known_hosts to get rid of this message.
Offending RSA key in /Users/admin/.ssh/known_hosts:14
RSA host key for [127.0.0.1]:2222 has changed and you have requested strict checking.
Host key verification failed.
-
开始使用Cycript
-
查看当前手机进程
ps ax或者ps -e
- 找到自己工程项目名
- 指定PID(附加进程),找到对应项目的PID
cycript -p 19617
- 当控制台出现
cy#
获取bundele id
cy# [[NSBundle mainBundle]bundleIdentifier]
@"com.obizsoft.WCCycriptTest"
获取Documents路径
cy# NSHomeDirectory()
@"/var/mobile/Containers/Data/Application/71A4B323-D70E-45A7-87FC-7D6E1E604230"
UIApp.keyWindow.recursiveDescription().toString()
获取视图结构图(这里的UIApp相当于[UIApplication sharedApplication])
#0x13fd168c0
拿到地址所对应的对象,可以查看其相应的属性
#0x13fd168c0.text = @"lovepersistence"
?exit
退出Crcyipt
程序前后截图
可以清楚的看到成功修改了lable的文字。