Ekulelu's Blog

iOS安全开发笔记0——工具安装

iOS安全开发笔记0——工具安装

1、将终端换成iTerm

下载地址 https://www.iterm2.com/downloads.html

安装zsh,在终端输入命令

1
sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"

使用下面的命令启用zsh

1
chsh -s /bin/zsh

打开 ~/.zshrc文件,将主题改为agnoster.

1
ZSH_THEME="agnoster"

但是这个主题的前缀是用户名@host名,所以会有点长,建议找到这个主题文件,在~/.oh-my-zsh/themes/agnoster.zsh-theme,将它copy一份后取个另外的名字,然后打开,在

1
2
3
4
5
6
# Context: user@hostname (who am I and where am I)
prompt_context() {
if [[ "$USER" != "$DEFAULT_USER" || -n "$SSH_CLIENT" ]]; then
prompt_segment black default "%(!.%{%F{yellow}%}.)$USER@%m"
fi
}

留意到$USER@%m,将后面的@%m去掉之后就只显示用户名了。然后把主题设置为这个文件。

另外,使用这个主题需要安装Meslo字体文件,否则会出现符号乱码。下载地址:Meslo LG M Regular for Powerline.ttf

command + ,打开iTerm的配置界面,在Profiles -> Text -> Font -> Chanage Font,选择 Meslo LG M Regular for Powerline 字体。

安装其他的插件

1、声明高亮

使用 Homebrew 安装:

1
$ brew install zsh-syntax-highlighting

安装成功之后,编辑vim ~/.zshrc文件,在最后一行增加下面配置:

1
source /usr/local/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh

2、自动填充

先clonezsh-autosuggestions项目到指定目录:

1
$ git clone https://github.com/zsh-users/zsh-autosuggestions ~/.oh-my-zsh/custom/plugins/zsh-autosuggestions

然后编辑vim ~/.zshrc文件,找到plugins配置,增加zsh-autosuggestionszsh-syntax-highlighting插件插件。

1
2
3
plugins=(
git zsh-autosuggestions zsh-syntax-highlighting
)

设置编辑的快捷键

打开 iTerm2,按Command + ,键,打开 Preferences 配置界面,然后Profiles → Keys → Load Preset... → Natural Text Editing,就可以了。这样的操作和xcode就差不多了。

建议打开~/.zshrc 在文件的最后加上source ~/.bash_profile 以便另zsh可以加载bash的path路径。

2、安装ida

这个请自己去找安装包吧。。。

3、安装cycript

下载地址 http://www.cycript.org/ 下载后,建议新建目录/opt 把越狱工具都放里面。 我们记得在~/.bash_profile上加上这个目录,否则会找不到可执行文件。

cycript安装后,在新的Mac系统上会有问题,因为ruby是2.3的。可以用下面命令查看ruby版本

1
ruby -v

如果是2.3之后的版本,那么运行cycript就会出问题。因为它需要2.0.0版本的ruby。但其实我们并不需要安装2.0.0的ruby,只需要将2.3的ruby拷贝一份,然后命名为2.0.0就可以了。

1
2
3
dyld: Library not loaded: /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/libruby.2.0.0.dylib
Referenced from: /opt/cycript_0.9.594/Cycript.lib/cycript-apl
Reason: image not found

但是在新MacOS系统下有一个跟安全相关的模式叫 SIP(System Integrity Protection ),它禁止让软件以 root 身份来在 Mac 上运行,在升级到 OS X 10.11 中或许你就会看到部分应用程序被禁用了,这些或许是你通过终端或者第三方软件安装。

我们需要进入恢复模式更改这个设定

  1. 电脑重启,开始时候按住command+R,进入恢复模式

  2. 打开终端,输入 csrutil disable 重启系统

  3. 执行下面代码建立2.0的软链接到2.3。

    1
    2
    sudo mkdir -p /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/
    sudo ln -s /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/libruby.2.3.0.dylib /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/libruby.2.0.0.dylib

    注:根据每个人ruby版本不同,将上面第二条命令的/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/libruby.2.3.0.dylib中的2.3改成本机的ruby版本。

  4. 如果想打开SIP,重复上两步,命令改为csrutil enable.

4、安装class-dump

下载地址 http://stevenygard.com/projects/class-dump/ 打开后,将class-dump 可执行文件添加到/opt

5、其他工具

Alfred、gotoShell、Reveal