iOS Reverse Series - theos

Overview

theos is a project open sourced by GitHub, created by nic.plcreating a tweakproject. By writing the code we inject, and then performing operations such as compiling, packaging, and installing, the code is injected into the formulation program installed by the iPhone.

theos environment configuration

Install the signature tool ldid

  • Make sure brew is installed

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

    $ brew install ldid

download theos

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

Since theos depends on other libraries, we use a recursiverecursive method to clone to automatically download the lock-dependent libraries. I downloaded it here in the ~/ directory.

Configure environment variables

In order to make the commands in the theos/bin directory globally effective, configure environment variables.

theos

theos create project

  • cd to a folder where the project code is stored (like the desktop)

    $ cd ~/Desktop
    $ nic.pl
  • Select【11.】iphone/tweak

  • Fill in the project information
    • project name
    • Project ID (write whatever you want)
    • Author/Maintainer Name
      • author
      • Just hit enter and follow the default method (the default is the username on the Mac)
    • [iphone/tweak]MobileSubstrate Bundle filter
      • 需要修改的App的Bundle Identifier(需要hook程序的Bundle Id)
      • 可以通过Cycript查看App的Bundle Identifier
  • [iPhone/tweak] List of applications to terminate upon installation
    • Just hit enter and follow the default

Write Makefiles

  • Add environment variables in front and write clearly which IP and port to access the phone through

Write code

  • Open the Tweak.xm file

compile-package-install

  • compile

    make
  • packaged as deb

    make package
  • Install (default will restart SpringBoard)

    make install

Problem solving

make package error

$ 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

It is because there is a problem with the packaging and compression method, so change it to gzip compression. Modify the dm.pl file and use # to comment out the following two sentences

$ vim $THEOS/vendor/dm.pl/dm.pl
#use IO::Compress::Lzma;
#use IO::Compress::Xz;

Modify the compression method on line 6 of the deb.mk file to gzip

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

make error

error one

$ make
Error: You do not have an SDK in
/Library/Developer/CommandLineTools/Platforms/iPhoneOS.platform/Developer/S
DKs

It is because installing multiple Xcodes causes path problems, you need to specify Xcode

 $ sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer/

error two

> Making all for tweak xxx...
make[2]: Nothing to be done for `internal-library-compile'.

It is because it has been compiled before, and there is a cache. Just clean it.

$ make clean
$make

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324893629&siteId=291194637