Introdução: O último artigo foi sobre a ferramenta de descompactação, e hoje é a theos, pois a instalação desta também desperdiça muitas células cerebrais, e o N mais 1 vezes clonado é um fracasso. Grave como resolvê-lo, espero que amigos interessados em aprender engenharia reversa possam ler este artigo para evitar armadilhas.
Instalar
-
Pode ser devido a problemas de rede doméstica, o theos basicamente não conseguiu clonar no gitHub.
-
Estou procurando informações na Internet há muito tempo e finalmente resolvi
Faça um breve resumo das etapas:
brew install ldid
- Definir variáveis de ambiente
comando
open ~/.zprofile
, coloque essas duas frases após o arquivo .profile
export THEOS=~/theos
export PATH=$THEOS/bin:$PATH
复制代码
Feche o arquivo .profile, comando
source ~/.zprofile
- Descrição da configuração da variável de ambiente:
- A informação que vi na Internet é colocar a variável de ambiente no
.bash_profile
arquivo. Também tentei e encontrei um problema. Se o terminal for carregado usando zsh, a variável de ambiente entrará em vigor.bash_profile
toda vez que o terminal for aberto .source ~/.bash_profile
Verifique as informações, coloque osource ~/.bash_profile
comando no~/.zshrc
verso do arquivo, você pode resolver esse problema. (ou defina o bash para carregar)
- Não use comandos para definir variáveis de ambiente diretamente, porque usando comandos
echo "export PATH=$THEOS/bin:$PATH" >> ~/.zprofile
, o caminho é expandido diretamente no arquivo .zprofile, o que não parece muito bom, então escreva-o manualmente.
-
Se o clone falhar de acordo com o método oficial , baixe diretamente o arquivo zip do theos
~/theos
e descompacte-o no caminho. -
Pacote de dependência de clone manual, comando
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
复制代码
-
Baixe diretamente sdks ==> Portal , descompacte e coloque na pasta sdks do theos.
-
Comando do terminal
nic.pl
, se a instalação for bem sucedida, você pode criar diretamente o projeto.
Criar projeto
- cd para o diretório onde você precisa criar o projeto
- Pedido
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. --->项目创建完成
复制代码
usar
-
Arraste o projeto inteiro para o Sublime Text
-
Makefile da veiculação
Adicione THEOS_DEVICE_IP e 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
复制代码
- Após a conclusão da configuração, escreva o código no arquivo Tweak.x.
%hook XMLiveOrListenTogetherView //引用需要hook的App里的头文件
//拦截方法
- (id)init{
return nil;
}
%end
复制代码
- Após a conclusão do código, o terminal cd para a pasta do projeto theos (mantenha o telefone conectado ao computador)
- Pedido
make
- Pedido
make package
- Pedido
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 %
复制代码
<<<<<<<============== Aponte para o último passo de cada comando, não há problema, o gancho é bem sucedido.
remover plug-in
Se você precisar excluir o plug-in do gancho no telefone
Library/MobileSubstrate/DynamicLibraries/
Localizar no telefoneExistem dois arquivos: um arquivo plist, um arquivo dylib para excluir diretamente
》》》Quanto ao desenvolvimento de theos, também sou um novato. Se você tem amigos que estão aprendendo engenharia reversa juntos, você pode se comunicar com eles.