iOS逆向小技能:Theos的安装

6,420 阅读3分钟

「这是我参与2022首次更文挑战的第7天,活动详情查看:2022首次更文挑战」。

前言

Theos是越狱开发工具包。logos语法简单。,它给我们准备好了一些代码模板、预置一些基本的Makefile脚本,这样我们开发一个tweak就会变得方便的多,

(整合在Xcode的iOSopendev )由于逆向工程很多东西无法自动化,因此推荐Theos

I 安装Thoes

1.1 安装Xcode

安装Xcode,以及command line tools

1.2 下载Thoes

下载Thoes:https://github.com/theos/theos

查看环境变量: 终端中输入命令env

建立环境变量:

 export THEOS=/opt/theos
#在当前终端中起作用了,关闭终端后又得重新设置。

为了避免每次都建立这个环境变量,建立一个永久的环境变量 : 编辑~/.profile文件,在其中添加export THEOS=/opt/theos/,这个环境变量就是永久的了.

记得source

source .profile 

或者使用.bash_profile

 open -e ~/.bash_profile


export THEOS=/opt/theos

 source .bash_profile
devzkndeMacBook-Pro:opt devzkn$ git clone --recursive https://github.com/theos/theos.git $THEOS


fatal: could not create work tree dir '/opt/theos': Permission denied
devzkndeMacBook-Pro:opt devzkn$ sudo git clone --recursive https://github.com/theos/theos.git $THEOS
Password:
Cloning into '/opt/theos'...

新版的theos 已经自带CydiaSubstrate.framework(基本上,tweak都依赖于一个名叫cydia Substrate (以前名字也叫mobile Substrate)的动态库,Mobile Substrate是Cydia的作者Jay Freeman (@saurik)的作品,也叫Cydia Substrate,它的主要功能是hook某个App,修改代码比如替换其中方法的实现,Cydia上的tweak都是基于Mobile Substrate实现的.)


devzkndeMacBook-Pro:lib devzkn$ pwd
/opt/theos/vendor/lib
devzkndeMacBook-Pro:lib devzkn$ ls -lrt
total 72
drwxr-xr-x  3 root  wheel   102 Aug 10 15:19 libswift
lrwxr-xr-x  1 root  wheel    43 Aug 10 15:19 libsubstrate.tbd -> CydiaSubstrate.framework/CydiaSubstrate.tbd
-rw-r--r--  1 root  wheel   635 Aug 10 15:19 librocketbootstrap.tbd
-rw-r--r--  1 root  wheel   392 Aug 10 15:19 libprefs.tbd
-rw-r--r--  1 root  wheel   588 Aug 10 15:19 libflipswitch.tbd
-rw-r--r--  1 root  wheel  1111 Aug 10 15:19 libapplist.tbd
-rw-r--r--  1 root  wheel  5646 Aug 10 15:19 libactivator.tbd
drwxr-xr-x  4 root  wheel   136 Aug 10 15:19 TechSupport.framework
-rw-r--r--  1 root  wheel   432 Aug 10 15:19 README.md
drwxr-xr-x  5 root  wheel   170 Aug 10 15:19 Opener.framework
-rw-r--r--  1 root  wheel  3342 Aug 10 15:19 LICENSE.md
drwxr-xr-x  5 root  wheel   170 Aug 10 15:19 CydiaSubstrate.framework
drwxr-xr-x  4 root  wheel   136 Aug 10 15:19 Cycript.framework
drwxr-xr-x  5 root  wheel   170 Aug 10 15:19 CepheiPrefs.framework
drwxr-xr-x  4 root  wheel   136 Aug 10 15:19 Cephei.framework

1.3 配置ldid

用来专门签名iOS可执行文件的工具,用以在越狱iOS中取代Xcode自带的codesign. 安装这个ldid,推荐的方式是采用brew来安装--

 brew install ldid

ps : 安装brew

1.4 dpkg-deb

deb是越狱开发包的标准格式,dpkg-deb是个用于操作deb文件的工具,有了这个工具,Theos才能正确的把工程打包成deb文件.

brew install dpkg

see also

更多内容请关注 #小程序:iOS逆向,只为你呈现有价值的信息,专注于移动端技术研究领域;更多服务和咨询请关注#公众号:iOS逆向。