iOS逆向-theos(四)

2018-10-12  本文已影响25人  Rathen
theos - tweak的开发过程.png theos - tweak的运行过程.png

安装

安装签名工具ldid

 $ /usr/bin/ruby -e "$(curl -fsSL
https://raw.githubusercontent.com/Homebrew/install/master/install)"
$ brew install ldid

修改环境变量

$ vim ~/.bash_profile
export THEOS=~/theos
export PATH=$THEOS/bin:$PATH
$ source ~/.bash_profile

下载theos

$ git clone --recursive https://github.com/theos/theos.git $THEOS

新建tweak项目

$ cd ~/Desktop
$ nic.pl

编辑Makefile

 
export THEOS_DEVICE_IP=127.0.0.1
export THEOS_DEVICE_PORT=10010
include $(THEOS)/makefiles/common.mk
TWEAK_NAME = ting_tweak
ting_tweak_FILES = Tweak.xm
include $(THEOS_MAKE_PATH)/tweak.mk
after-install::
    install.exec "killall -9 SpringBoard"
$ vim ~/.bash_profile
export THEOS=~/theos
export PATH=$THEOS/bin:$PATH
export THEOS_DEVICE_IP=127.0.0.1
export THEOS_DEVICE_PORT=10010
$ source ~/.bash_profile

编写代码

 
%hook XMAdAnimationView
- (id)initWithImageUrl:(id)arg1 title:(id)arg2 iconType:(long long)arg3
jumpType:(long long)arg4
{
return nil; }
%end
%hook XMSoundPatchPosterView
- (id)initWithFrame:(struct CGRect)arg1
{
return nil; }
%end

编译-打包-安装

make
make package
make install

可能的问题

1、 make package的错误

 
$ make package
Can't locate IO/Compress/Lzma.pm in @INC (you may need to install the
IO::Compress::Lzma module) (@INC contains: /Library/Perl/5.18/darwin-
thread-multi-2level /Library/Perl/5.18 /Network/Library/Perl/5.18/darwin-
thread-multi-2level /Network/Library/Perl/5.18 /Library/Perl/Updates/5.18.2
/System/Library/Perl/5.18/darwin-thread-multi-2level
/System/Library/Perl/5.18 /System/Library/Perl/Extras/5.18/darwin-thread-
multi-2level /System/Library/Perl/Extras/5.18 .) at
/Users/mj/theos/bin/dm.pl line 12.
BEGIN failed--compilation aborted at /Users/mj/theos/bin/dm.pl line 12.
make: *** [internal-package] Error 2
$ vim $THEOS/vendor/dm.pl/dm.pl
#use IO::Compress::Lzma;
#use IO::Compress::Xz;

-- 修改deb.mk文件的第6行压缩方式位gzip

$ vim $THEOS/makefiles/package/deb.mk
_THEOS_PLATFORM_DPKG_DEB_COMPRESSION ?= gzip

2、make错误

$ make
Error: You do not have an SDK in
/Library/Developer/CommandLineTools/Platforms/iPhoneOS.platform/Developer/S
DKs
$ sudo xcode-select --switch
/Applications/Xcode.app/Contents/Developer/
 
$ make
> Making all for tweak xxx...
make[2]: Nothing to be done for `internal-library-compile'.
  $ make clean
$ make

文档

theos-tweak实现过程

image.png
上一篇下一篇

猜你喜欢

热点阅读