MonkeyDev是一位大神基于iOSOpenDev重新弄的,是一款非越狱插件开发集成神器!大神就是大神!

一.安装MonkeyDev
1.环境要求
(1).安装最新的theos
sudo git clone --recursive https://github.com/theos/theos.git /opt/theos
(2).安装ldid(如安装theos过程安装了ldid,跳过)
brew install ldid
(3).配置免密码登录越狱设备(如果没有越狱设备,跳过)
ssh-keygen -t rsa -P ''
ssh-copy-id -i /Users/username/.ssh/id_rsa root@ip
或者安装sshpass自己设置密码:
brew install https://raw.githubusercontent.com/kadwanev/bigboybrew/master/Library/Formula/sshpass.rb
2.MonkeyDev的安装指令
(1). 命令选择指定的Xcode进行安装
sudo xcode-select -s /Applications/Xcode-beta.app
默认安装的Xcode为:
xcode-select -p
执行安装命令:
sudo /bin/sh -c "$(curl -fsSL https://raw.githubusercontent.com/AloneMonkey/MonkeyDev/master/bin/md-install)"
MonkeyDev卸载
sudo /bin/sh -c "$(curl -fsSL https://raw.githubusercontent.com/AloneMonkey/MonkeyDev/master/bin/md-uninstall)"
MonkeyDev更新
如果没有发布特殊说明,使用如下命令更新即可:
sudo /bin/sh -c "$(curl -fsSL https://raw.githubusercontent.com/AloneMonkey/MonkeyDev/master/bin/md-update)"
二.MonkeyDev的使用
1.创建项目

2.分析目录结构

3.拖入编译(如果无越狱手机请参考无需越狱手机下载越狱版本IPA的方法)
4.运行,如果报以下这样的错误:

解决方案:

三.动态库调试和修改
假如你想修改一个APP的内容显示,我们可以这么做?
1.使用class-dump 和Hopper实现简单反编译看到ipa文件的头文件,以我们自己的项目为例:

2.找到HomePageViewControlle的头文件,属性City代表城市

3.在TestAppDylib.m中写入代码
CHDeclareClass(HomePageViewController); // declare class
CHOptimizedMethod(0, self, NSString *, HomePageViewController, city) // hook method (with no arguments and no return value)
{
// write code here ...
return @"湖南"; //随意改数
}
CHConstructor // code block that runs immediately upon load
{
@autoreleasepool
{
CHLoadLateClass(HomePageViewController);
CHHook(0, HomePageViewController,city);
}
}
不让使用runtime库,修改如图位置即可,改为NO.

最后修改后的效果图:

注:虽然知道项目的头文件,有很大的局限性,我们需要经过猜测找到要修改的控制器和变量名。
网友评论