iOSリバース開発-theosのインストールと構成の簡単な手順

iOSリバース開発-解凍ツールdumpdecryptedとfrida-ios-dumpのインストールと使用

はじめに:前回の記事は開梱ツールに関するものでしたが、今日はテオスです。これをインストールすると多くの脳細胞が無駄になり、クローン化されたNプラス1回は失敗します。それを解決する方法を記録してください。リバースエンジニアリングの学習に興味のある友人が、落とし穴を避けるためにこの記事を読んでくれることを願っています。

インストール

手順を簡単に要約します。

  1. brew install ldid
  2. 環境変数を設定する

コマンドopen ~/.zprofile、.profileファイルの後にこれらの2つの文を置きます

export THEOS=~/theos
export PATH=$THEOS/bin:$PATH
复制代码

.profileファイルを閉じる、コマンドsource ~/.zprofile

  • 環境変数構成の説明:
  1. インターネットで見た情報は、環境変数を.bash_profileファイルに入れることです。また、試してみて問題が見つかりました。zshを使用して端末をロードすると.bash_profile、端末を開くたびにsource ~/.bash_profile環境変数が有効になります。source ~/.bash_profile情報を確認し、コマンドを~/.zshrcファイルの後ろに置くと、この問題を解決できます。(またはbashをロードするように設定します)
  1. コマンドを使用して環境変数を直接設定しないでください。コマンドを使用するecho "export PATH=$THEOS/bin:$PATH" >> ~/.zprofileと、パスが.zprofileファイルで直接展開されますが、これはあまり快適ではないため、手動で記述してください。
  1. 公式の方法でクローンが失敗した場合は、 theosのzipアーカイブを直接ダウンロードして、~/theosパスに解凍します。

  2. 手動クローン依存関係パッケージ、コマンドcd $THEOS/vendor

git clone git://github.com/theos/dm.pl.git
git clone git://github.com/theos/headers.git/   //clone完成需要将headers改成include,其他的依赖直接用默认名称就可以
git clone git://github.com/theos/lib.git
git clone git://github.com/theos/logos.git
git clone git://github.com/theos/nic.git
git clone git://github.com/theos/templates.git
复制代码
  1. sdks ==> Portalを直接ダウンロードし、解凍して、theosのsdksフォルダーに配置します。

  2. ターミナルコマンドnic.pl、インストールが成功した場合は、プロジェクトを直接作成できます。

プロジェクトを作成する

  1. プロジェクトを作成する必要があるディレクトリにcdします
  2. 注文nic.pl
NIC 2.0 - New Instance Creator
------------------------------
  [1.] iphone/activator_event
  [2.] iphone/activator_listener
  [3.] iphone/application_modern
  [4.] iphone/application_swift
  [5.] iphone/cydget
  [6.] iphone/flipswitch_switch
  [7.] iphone/framework
  [8.] iphone/library
  [9.] iphone/notification_center_widget
  [10.] iphone/notification_center_widget-7up
  [11.] iphone/preference_bundle_modern
  [12.] iphone/theme
  [13.] iphone/tool
  [14.] iphone/tool_swift
  [15.] iphone/tweak
  [16.] iphone/tweak_with_simple_preferences
  [17.] iphone/xpc_service
Choose a Template (required): 15 -->如果是hook,直接填写 15
Project Name (required): xxx --->项目名随便填
Package Name [com.yourcompany.xxx]: yourcompany.xxx --->随便填
Author/Maintainer Name [FRZeng]: nnn --->随便填
[iphone/tweak] MobileSubstrate Bundle filter [com.apple.springboard]: bundle ID --->需要hook什么App,就填写该App的bundle ID
[iphone/tweak] List of applications to terminate upon installation (space-separated, '-' for none) [SpringBoard]: --->直接跳过
Instantiating iphone/tweak in xxx/...
Done. --->项目创建完成
复制代码

使用する

  1. プロジェクト全体をSublimeTextにドラッグします

  2. 配置Makefile

THEOS_DEVICE_IPとTHEOS_DEVICE_PORTを追加します

export THEOS_DEVICE_IP = localhost  //配置IP
export THEOS_DEVICE_PORT = 10010 //端口

TARGET := iphone:clang:latest:7.0
INSTALL_TARGET_PROCESSES = SpringBoard


include $(THEOS)/makefiles/common.mk

TWEAK_NAME = xxx

xxx_FILES = Tweak.x
xxx_CFLAGS = -fobjc-arc

include $(THEOS_MAKE_PATH)/tweak.mk
复制代码
  1. 構成が完了したら、Tweak.xファイルにコードを記述します。
%hook XMLiveOrListenTogetherView //引用需要hook的App里的头文件

//拦截方法
- (id)init{
	return nil;
}

%end 

复制代码
  1. コードが完了したら、ターミナルはtheosプロジェクトフォルダーにcdします(電話をコンピューターに接続したままにします)
  1. 注文make
  2. 注文make package
  3. 注文make install
frzeng@192 tingTweak % make  <========
==> Notice: Build may be slow as Theos isn’t using all available CPU cores on this computer. Consider upgrading GNU Make: https://github.com/theos/theos/wiki/Parallel-Building
> Making all for tweak tingTweak…
==> Preprocessing Tweak.x…
==> Compiling Tweak.x (armv7)…
==> Linking tweak tingTweak (armv7)…
ld: warning: building for iOS, but linking in .tbd file (/Users/frzeng/theos/vendor/lib/CydiaSubstrate.framework/CydiaSubstrate.tbd) built for iOS Simulator
==> Generating debug symbols for tingTweak…
rm /Users/frzeng/Desktop/nixiangCode/tingTweak/.theos/obj/debug/armv7/Tweak.x.m
==> Preprocessing Tweak.x…
==> Compiling Tweak.x (arm64)…
==> Linking tweak tingTweak (arm64)…
ld: warning: building for iOS, but linking in .tbd file (/Users/frzeng/theos/vendor/lib/CydiaSubstrate.framework/CydiaSubstrate.tbd) built for iOS Simulator
==> Generating debug symbols for tingTweak…
rm /Users/frzeng/Desktop/nixiangCode/tingTweak/.theos/obj/debug/arm64/Tweak.x.m
==> Merging tweak tingTweak…
==> Signing tingTweak… <<<<<<<==============
frzeng@192 tingTweak % make package  <========
==> Notice: Build may be slow as Theos isn’t using all available CPU cores on this computer. Consider upgrading GNU Make: https://github.com/theos/theos/wiki/Parallel-Building
> Making all for tweak tingTweak…
make[2]: Nothing to be done for `internal-library-compile'.
> Making stage for tweak tingTweak…
dm.pl: building package `com.gemd.iting:iphoneos-arm' in `./packages/com.gemd.iting_0.0.1-1+debug_iphoneos-arm.deb' <<<<<<<==============
frzeng@192 tingTweak % make install  <========
==> Installing…
(Reading database ... 5368 files and directories currently installed.)
Preparing to unpack /tmp/_theos_install.deb ...
Unpacking com.gemd.iting (0.0.1-1+debug) over (0.0.1-1+debug) ...
Setting up com.gemd.iting (0.0.1-1+debug) ...
==> Unloading SpringBoard…  <<<<<<<==============
frzeng@192 tingTweak %
复制代码

<<<<<<<==============各コマンドの最後のステップをポイントします。問題はありません。フックは成功します。

プラグインを削除します

電話のフックプラグインを削除する必要がある場合

電話で Library/MobileSubstrate/DynamicLibraries/探す

2つのファイルがあります:plistファイル、直接削除するdylibファイル

》》》テオスの開発については、私も初心者です。リバースエンジニアリングを一緒に学んでいる友達がいれば、ぜひコミュニケーションをとってください。

おすすめ

転載: juejin.im/post/6961975578631241765
おすすめ