Introducción: El último artículo fue sobre la herramienta de desempaquetado, y hoy es el theos, porque la instalación de esto también desperdicia muchas células cerebrales, y el clonado N más 1 veces es un fracaso. Anota cómo resolverlo, espero que los amigos que estén interesados en aprender ingeniería inversa puedan leer este artículo para evitar escollos.
Instalar
-
Puede deberse a problemas de la red doméstica, el theos básicamente no pudo clonar en gitHub.
-
Estuve mucho tiempo buscando información en Internet, y por fin lo resolví
Resume brevemente los pasos:
brew install ldid
- Establecer variables de entorno
comando
open ~/.zprofile
, coloque estas dos oraciones después del archivo .profile
export THEOS=~/theos
export PATH=$THEOS/bin:$PATH
复制代码
Cierre el archivo .profile, comando
source ~/.zprofile
- Descripción de la configuración de la variable de entorno:
- La información que vi en Internet es poner la variable de entorno en el
.bash_profile
archivo, también lo probé y encontré un problema, si la terminal se carga usando zsh, la variable de entorno tendrá efecto.bash_profile
cada vez que se abra la terminal .source ~/.bash_profile
Verifique la información, coloque elsource ~/.bash_profile
comando en la~/.zshrc
parte posterior del archivo, puede resolver este problema. (o configurar bash para cargar)
- No use comandos para establecer variables de entorno directamente, porque al usar comandos
echo "export PATH=$THEOS/bin:$PATH" >> ~/.zprofile
, la ruta se expande directamente en el archivo .zprofile, lo que no se siente muy bien, así que escríbalo manualmente.
-
Si el clon falla según el método oficial , descarga directamente el archivo zip de theos
~/theos
y descomprímelo en la ruta. -
Paquete de dependencia de clonación 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
复制代码
-
Descargue directamente sdks ==> Portal , descomprímalo y colóquelo en la carpeta sdks de theos.
-
Comando de terminal
nic.pl
, si la instalación es exitosa, puede crear directamente el proyecto.
Crear proyecto
- cd al directorio donde necesita crear el proyecto
- 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
-
Arrastra todo el proyecto a Sublime Text
-
Makefile de ubicación
Agregar THEOS_DEVICE_IP y 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
复制代码
- Una vez completada la configuración, escriba el código en el archivo Tweak.x.
%hook XMLiveOrListenTogetherView //引用需要hook的App里的头文件
//拦截方法
- (id)init{
return nil;
}
%end
复制代码
- Después de completar el código, el terminal cd a la carpeta del proyecto theos (mantenga el teléfono conectado a la computadora)
- 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 %
复制代码
<<<<<<<============== Señale el último paso de cada comando, no hay problema, el gancho es exitoso.
eliminar complemento
Si necesita eliminar el complemento de gancho en el teléfono
Library/MobileSubstrate/DynamicLibraries/
Buscar en el teléfonoHay dos archivos: un archivo plist, un archivo dylib para eliminar directamente
》》》En cuanto al desarrollo de theos, también soy un novato. Si tienes amigos que están aprendiendo ingeniería inversa juntos, puedes comunicarte con ellos.