前言:
theos是国外大牛开发的越狱编译平台,经过命令行能够快速的生成例子,其最有意思的当属tweak插件的开发,其Logus的语法简洁明了,是越狱中HOOK的绝佳神器,下面就来一步步揭开这些东西的神秘面纱!
1、环境准备ios
一、安装theosgit
;新建theos安装目录 $cd ~ $mkdir -r work/theos ;下载theos $export THEOS=~/work/theos $svn co http://svn.howett.net/svn/theos/trunk $THEOS
二、 安装签名工具ldidgithub
$git clone git://git.saurik.com/ldid.git $cd ldid $git submodule update --init $./make.sh $cp -f ./ldid $THEOS/bin/ldid
三、设置环境变量spring
$touch ~/.bash_profile ;设置环境变量(THEOS_DEVICE_IP为要安装app的真机IP) $vi ~/.bash_profile export THEOS=~/work/theos export PATH=$THEOS/bin:$PATH export THEOS_DEVICE_IP=10.60.113.36 THEOS_DEVICE_PORT=22
四、安装substrate库ruby
;安装brew 包安装工具 $/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" ;安装wget $brew install wget ;安装dpkg $brew install dpkg ;下载substrate $wget http://apt.saurik.com/debs/mobilesubstrate_0.9.6011_iphoneos-arm.deb ;解包 $mkdir substrate $dpkg-deb -x mobilesubstrate_*_iphoneos-arm.deb substrate ;拷贝到theos目录 $mv substrate/Library/Frameworks/CydiaSubstrate.framework/CydiaSubstrate $THEOS/lib/libsubstrate.dylib $mv substrate/Library/Frameworks/CydiaSubstrate.framework/Headers/ \ CydiaSubstrate.h $THEOS/include/substrate.h
五、更新iphone开发头bash
$mkdir iphoneheaders ;下载头文件 $git clone https://github.com/nanotech/iphoneheaders.git ;拷贝到theos目录下 $mv iphoneheaders/* $THEOS/include/ ;ps $cp /System/Library/Frameworks/IOSurface.framework/Headers/IOSurfaceAPI.h .
2、真枪实战服务器
一、第一个application程序app
;应用环境变量 $. ~/.bash_profile ;新建项目 $ $THEOS/bin/nic.pl NIC 1.0 - New Instance Creator ------------------------------ [1.] iphone/application [2.] iphone/library [3.] iphone/preference_bundle [4.] iphone/tool [5.] iphone/tweak Choose a Template (required): 1 Project Name (required): iPhoneDevWiki Package Name [com.yourcompany.iphonedevwiki]: net.howett.iphonedevwiki Authour/Maintainer Name [Dustin L. Howett]: Instantiating iphone/application in iphonedevwiki/... Done. ;切换到生成的项目目录下 make 生成deb $cd iphonedevwiki $make package ;安装deb到cydia中 $make install
在真机的cydia已安装列表中会有iphonedevwiki的包名,须要respring手机才能在桌面看到安装的app。respring能够在cydia上安装个插件Respring,方便调试!框架
二、第一个tweak程序curl
;应用环境变量 $. ~/.bash_profile ;新建项目 $ $THEOS/bin/nic.pl NIC 1.0 - New Instance Creator ------------------------------ [1.] iphone/application [2.] iphone/library [3.] iphone/preference_bundle [4.] iphone/tool [5.] iphone/tweak Choose a Template (required): 5 Project Name (required): iPhoneDevWiki Package Name [com.yourcompany.iphonedevwiki]: net.howett.iphonedevwiki Authour/Maintainer Name [Dustin L. Howett]: Instantiating iphone/tweak iphonedevwiki/... Done. ;生成的文件目录 Makefile Tweak.xm control theos tweak.plist ;Makefile中增长编译框架 iPhoneDevWiki_FRAMEWORKS = UIKit ;Tweak.xm中增长alert #import <SpringBoard/SpringBoard.h> %hook SpringBoard -(void)applicationDidFinishLaunching:(id)application { %orig; UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Welcome" message:@"Welcome to your iOS Device Ted!" delegate:nil cancelButtonTitle:@"security.ios-wiki.com" otherButtonTitles:nil]; [alert show]; [alert release]; } %end ;切换到生成的项目目录下 make 生成deb $cd iphonedevwiki $make package ;安装deb到cydia中 $make install
一、获取cydia安装包
老版本的cydia会将经过源安装的deb删除掉,以致找不到deb包。当前可以使用apt来获取安装包。
$cd var/cache/apt/archives #更新源 $apt-get update #下载包 $apt-get -d install app.weiphone.nx #查看包安装信息 $dpkg-dbg -I xx.deb #安装deb $dpkg -i xx.deb #卸载应用 $dpkg -r app.weiphone.nx
二、经过theos编译的deb文件里面包含debian_binary、control.tar.gz、data.tar.gz等文件,能够使用命令显示
#列出deb中文件 $ar vt com.cm.tweak_0.0.1-1_iphoneos-arm.deb rw-r--r-- 0/0 4 Aug 9 00:53 2016 debian-binary rw-r--r-- 0/0 293 Aug 9 00:53 2016 control.tar.gz rw-r--r-- 0/0 1708 Aug 9 00:53 2016 data.tar.gz #提取文件 $ar vx xxx.deb debian-binary $ar vx xxx.deb control.tar.gz $ar vx xxx.deb data.tar.gz #删除文件 $ar d xxx.deb data.tar.gz #更新文件 $ar r xxx.deb data.tar.gz #解压tar.gz $tar -tzvf control.tar.gz #打包 $tar -zvcf control1.tar.gz control postinst #制做deb包 $ar -rc xx.deb debian-binary control.tar.gz data.tar.gz #特殊状况碰到lzma #安装lzma $sudo apt-get install lzma #查看lzma状况 $ lzmainfo data.tar.lzma #解压lzma $unlzma data.tar.lzma $tar -xvf data.tar #压缩lzma $tar -cvf data.tar file1 file2 $lzma -z data.tar
三、scp操做
一、从服务器下载文件 scp username@servername:/path/filename /tmp/local_destination 二、上传本地文件到服务器 scp /path/local_filename username@servername:/path 三、从服务器下载整个目录 scp -r username@servername:remote_dir/ /tmp/local_dir 四、上传目录到服务器 scp -r /tmp/local_dir username@servername:remote_dir
四、重启springboard,刷新桌面
$killall SpringBoard
ps:
syslogd to /var/log/syslog
tail -f /var/log/syslog