iOS Hacker 使用Theos开发tweak

来源:互联网 发布:中国的乒乓球知乎 编辑:程序博客网 时间:2024/05/17 08:59

iOS Hacker 使用Theos开发tweak

mkdir /opt
export THEOS=/opt/theos
sudo git clone git://github.com/DHowett/theos.git $THEOS
http://joedj.net/ldid    //访问下载ldid
cp ~/Downloads/ldid /opt/theos/bin/ldid   //复制到bin目录
curl -o /opt/theos/bin/dpkg-deb https://raw.githubusercontent.com/DHowett/dm.pl/master/dm.pl  下载dpkg-deb
sudo chmod 777 /opt/theos/bin/dpkg-deb   //设备权限
cd ~/Desktop
/opt/theos/bin/nic.pl  //创建工程
NIC 2.0 - New Instance Creator
------------------------------
  [1.] iphone/activator_event
  [2.] iphone/application_modern
  [3.] iphone/cydget
  [4.] iphone/flipswitch_switch
  [5.] iphone/framework
  [6.] iphone/ios7_notification_center_widget
  [7.] iphone/library
  [8.] iphone/notification_center_widget
  [9.] iphone/preference_bundle_modern
  [10.] iphone/tool
  [11.] iphone/tweak
  [12.] iphone/xpc_service
Choose a Template (required): 11
Project Name (required): IOSREProject
Package Name [com.yourcompany.iosreproject]: com.iosreproject
Author/Maintainer Name [System Administrator]: exchen
[iphone/tweak] MobileSubstrate Bundle filter [com.apple.springboard]: com.apple.springboard
[iphone/tweak] List of applications to terminate upon installation (space-separated, '-' for none) [SpringBoard]: SpringBoard
Instantiating iphone/tweak in iosreproject/...
Done.
------------------------------
vi ~/Desktop/iosreproject/Makefile    //修改Makefile文件


include $(THEOS)/makefiles/common.mk
THEOS_DEVICE_IP = 192.168.4.143
ARCHS = armv7 arm64
TARGET = iphone:latest:8.0
TWEAK_NAME = iOSREGreetings
iOSREGreetings_FILES = Tweak.xm
iOSREGreetings_FRAMEWORKS = UIKit

include $(THEOS_MAKE_PATH)/tweak.mk

after-install::
        install.exec "killall -9 SpringBoard"
--------------------------------------------
vi ~/Desktop/iosreproject/tweak.mk     //编写代码hook SpringBoard,让开机之后弹出对话框

%hook SpringBoard
- (void)applicationDidFinishLaunching:(id)application
{
        %orig;
        UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Hook" message:nil delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
        [alert show];
        [alert release];
}
%end
--------------------------------------------
export THEOS_DEVICE_IP=192.168.4.143           //手机的IP地址环境变量
--------------------------------------------
make package Install                           //开始安装
> Making all for tweak iOSREProject…
==> Preprocessing Tweak.xm…
==> Compiling Tweak.xm (armv7)…
==> Linking tweak iOSREProject (armv7)…
==> Preprocessing Tweak.xm…
==> Compiling Tweak.xm (arm64)…
==> Linking tweak iOSREProject (arm64)…
==> Merging tweak iOSREProject…
==> Signing iOSREProject…
> Making stage for tweak iOSREProject…
dm.pl: building package `com.iosre.iosreproject:iphoneos-arm' in `./packages/com.iosre.iosreproject_0.0.1-3+debug_iphoneos-arm.deb'
==> Installing…
root@192.168.4.143's password: 

需要输入两次密码,安装成功之后,手机会自动重启后会弹出对话框


0 0
原创粉丝点击