大理建设工程信息网站,ssp媒体服怎样做网站,海南省交通建设局网站首页,做网站接私活怎么收费THEOS的第一个TWeak的成功创建THEOS的第一个TWeak的成功创建参考资料:成功的创建一个TWeak的弹出步骤1:安装Xcode和Xcode command line步骤2:安装theosa:下载theos前,设置保存的路径:环境变量b:下载theosc:下载头文件d:下载ldid签名工具e:配置MoblieSubstrate环境f:安装dpkg步骤…THEOS的第一个TWeak的成功创建THEOS的第一个TWeak的成功创建参考资料:成功的创建一个TWeak的弹出步骤1:安装Xcode和Xcode command line步骤2:安装theosa:下载theos前,设置保存的路径:环境变量b:下载theosc:下载头文件d:下载ldid签名工具e:配置MoblieSubstrate环境f:安装dpkg步骤3:开始编写Teak应用a 创建工程b.更改Tweak.xm文件c.编写makfiled: 编译,安装,运行步骤4: 证书设置(不用多次输入密码)总结一些坑THEOS的第一个TWeak的成功创建TWeak的成功创建也不是一件容易的事情.参考资料:http://www.iphonedevwiki.net/index.php/Theos/Getting_Startedhttp://security.ios-wiki.com/issue-3-6/http://security.ios-wiki.com/http://www.cppblog.com/AutomateProgram/archive/2013/11/11/204205.htmlhttp://www.tuicool.com/articles/Bf2UFbhttp://stackoverflow.com/questions/21013325/dpkg-error-contains-ununderstood-data-member成功的创建一个TWeak的弹出步骤1:安装Xcode和Xcode command lineXcode的安装直接去Apple官网上去下载就好了.command line的话,现在的Xcode(2015-09-20,都是Xcode7了,Xcode6开始已经集成了command line到Xcode中了).网上的教程有的是使用的Xcode4,5,等低版本.这里埋下了一个坑.步骤2:安装theosa:下载theos前,设置保存的路径:环境变量theos保存到哪里?这个路径是需要设置为环境变量的可以直接写到~/.bash_profile中(设置环境变量的一般方法) export THEOS/usr/local/iOSTools/theos网上很多的人都安装到了/opt/theos路径下,不过这个路径随意了,看你一般的开发工具放在哪里,就写那里就好了.设置好后可以echo $theos来查看设置的环境变量是否设置好了. zx:iOSTools zx$ echo $THEOS/usr/local/iOSTools/theob:下载theos下载的方法很多svn的方法有: svn co http://svn.howett.net/svn/theos/trunk $THEOSgitt途径(推荐,方便升级) git clone git://github.com/DHowett/theos.git $ THEOS当然了,也可以直接去git仓库里下载一份压缩的,将里面的内容解压到$THEOSc:下载头文件头文件下载下来后需要做一些更改.clone 头文件仓库将头文件放到theos/include/目录下复制系统的IOSurfaceAPI.h到**theos/include/IOSurface**目录下注释掉IOSurfaceCreateXPCObject 和IOSurfaceLookupFromXPCObject.# clone iphoneheaders.git
git clone git://github.com/rpetrich/iphoneheaders.git
mv iphoneheaders/* theos/include/
cp /System/Library/Frameworks/IOSurface.framework/Headers/IOSurfaceAPI.h theos/include/IOSurface如果没有拷贝和注释这两个步骤,最后会导致打包失败.d:下载ldid签名工具下载ldid可执行文件放到theos/bin/目录下 # get ldid for Mac OS Xcd ~/theos/bincurl -O http://dl.dropbox.com/u/3157793/ldidchmod ax ldid这里的文件是在dropbox上,需要什么你的懂的.所以,这里也提供一个百度盘上下载地址: http://pan.baidu.com/s/1kTHoIGZ注我把这个工具下载下来放到了http://pan.baidu.com/s/1kTHoIGZ也可以从这里下载然后给它添加执行权限chmod x ldid并移动到$THEOS/bin/这个目录下。(from http://security.ios-wiki.com/issue-3-6/)PS.当然了,你可以直接从源码编译安装,下面是源码仓库 https://github.com/rpetrich/ldide:配置MoblieSubstrate环境方法一:# get libsubstrate.dylib substrate.h
cd ~/theos
curl -OL http://apt.saurik.com/debs/mobilesubstrate_0.9.3366-1_iphoneos-arm.deb
dpkg-deb -x mobilesubstrate_0.9.3366-1_iphoneos-arm.deb mobilesubstrate
cp mobilesubstrate/Library/Frameworks/CydiaSubstrate.framework/CydiaSubstrate ~/theos/lib/libsubstrate.dylib
cp mobilesubstrate/Library/Frameworks/CydiaSubstrate.framework/Headers/CydiaSubstrate.h include/substrate.h(from http://www.tuicool.com/articles/Bf2UFb)方法二:从越狱后设备拷贝出来一份重名名为: theos/lib/libsustrate.dylib将iOS上的“/Library/Frameworks/CydiaSubstrate.framework/ CydiaSubstrate”拷贝到OSX中将其重命名为libsubstrate.dylib后放到“/opt/theos/lib/libsubstrate. dylib”中(from http://book.51cto.com/art/201504/472934.htm)方法三:百度盘里下载:http://pan.baidu.com/s/1o6ocwXk(from http://security.ios-wiki.com/issue-3-6/)f:安装dpkg方法一:通过mac port安装.mac port也就是一个软件包管理工具,像weget,apt-install,brew等工具类似.首先我尝试安装的是https://www.macports.org/install.php下的https://distfiles.macports.org/MacPorts/MacPorts-2.3.3-10.10-Yosemite.pkg 但是安装卡顿,失败.然后,尝试源码编译安装,MacPorts-2.3.3.tar.bz2“cd” into the directory where you downloaded the package and run “tar xjvf MacPorts-2.3.3.tar.bz2” or “tar xzvf MacPorts-2.3.3.tar.gz”, depending on whether you downloaded the bz2 tarball or the gz one, respectively.Build and install the recently unpacked sources:cd MacPorts-2.3.3./configure make sudo make installOptionally:cd ../rm -rf MacPorts-2.3.3*(from https://www.macports.org/install.php)但是sudo port selfupdate
sudo port install dpkg这里 时候,我的时候,根本不动了,毛网速没有啊....方法二:通过brew来安装brew的作者最近不是去了apple了吗?哈哈,以前配置号brew后,来下载就方便多了. brew install dpkg不到1分钟就可以下载好了. 真是给方法一给跪了.步骤3:开始编写Teak应用a 创建工程选一个目录,存放工程. zx:theosCode zx$ pwd/Users/zx/documents/theosCodezx:theosCode zx$ $THEOS/bin/nic.plNIC 2.0 - New Instance Creator------------------------------ [1.] iphone/application [2.] iphone/library [3.] iphone/preference_bundle [4.] iphone/tool [5.] iphone/tweak(选这个)Choose a Template (required): 5Project Name (required): zxtestPackage Name [com.yourcompany.zxtest]: com.z2xy.zxtext(可选项,按enter,[]中的作为默认值)Author/Maintainer Name [zx]: zx(按enter,[]中的作为默认值)[iphone/tweak] MobileSubstrate Bundle filter [com.apple.springboard]: com.apple.springboard(按enter,[]中的作为默认值)[iphone/tweak] List of applications to terminate upon installation (space-separated, - for none) [SpringBoard]: SpringBoard(按enter,[]中的作为默认值)Instantiating iphone/tweak in zxtest/...Done.生成后的文件列表如下: xzx:zxtest zx$ pwd/Users/zx/documents/theosCode/zxtestzx:zxtest zx$ tree.├── Makefile├── Tweak.xm├── control├── theos - /usr/local/iOSTools/theos/└── zxtest.plist1 directory, 4 files其中:Makefiile文件用于自动化编译Tweak.xm类似于我们 业务函数,main函数control是一些工程信息zxtest.plist也是项目的一些工程信息还有一个符号链接指向我们的$THEOS的安装目录(最开始配置的环境变量)b.更改Tweak.xm文件 x#import SpringBoard/SpringBoard.h%hook SpringBoard-(void)applicationDidFinishLaunching:(id)application {%orig;UIAlertView *alert [[UIAlertView alloc] initWithTitle:__z2xy__ message:from zxdev delegate:nil cancelButtonTitle:取消 otherButtonTitles:好的,nil];[alert show];[alert release];}%end上面引入了一个头文件,然后替换了**applicationDidFinishLaunching方法的实现.一些语法 %hook,%orig,%end,倒是很像django的模板语法.这里不详细讲,见上的参考资料.c.编写makfile xxxxxxxxxxARCHS armv7THEOS_DEVICE_IP 192.168.0.120 //(可选)zxtest_FRAMEWORKS UIKitinclude theos/makefiles/common.mkTWEAK_NAME zxtestzxtest_FILES Tweak.xminclude $(THEOS_MAKE_PATH)/tweak.mkafter-install:: install.exec killall -9 SpringBoard主要是添加了头三行.第一行,指定了系统架构第二行,指定了同一局域网下的iOS设备的ip地址(需要根据自己的实际情况更换)查看iOS设备的ip地址的话,直接到手机的设置,wifi,连接 wifi下查看就可以了.如果需要自动安装的话,可以去掉这行第三行,导入UIKit头文件如果不导入文件编译出错,找不到符号,因为我们使用了UIKit中的UIAlertView.d: 编译,安装,运行方法一:需要指定iOS设备ip地址,需要设置好信任的证书. zx:zxtest zx$ make package installMaking all for tweak zxtest...make[2]: Nothing to be done for internal-library-compile.Making stage for tweak zxtest...dpkg-deb: building package com.z2xy.zxtext in ./com.z2xy.zxtext_0.0.1-1_iphoneos-arm.deb.install.exec cat /tmp/_theos_install.deb; dpkg -i /tmp/_theos_install.deb rm /tmp/_theos_install.deb ./com.z2xy.zxtext_0.0.1-1_iphoneos-arm.debSelecting previously deselected package com.z2xy.zxtext.(Reading database ... 4989 files and directories currently installed.)Unpacking com.z2xy.zxtext (from /tmp/_theos_install.deb) ...Setting up com.z2xy.zxtext (0.0.1-1) ...install.exec killall -9 SpringBoard方法二:编译 zx:zxtest zx$ makeMaking all for tweak zxtest... Preprocessing Tweak.xm... Compiling Tweak.xm... Linking tweak zxtest... Stripping zxtest... Signing zxtest...打包 zx:zxtest zx$ make packageMaking all for tweak zxtest...make[2]: Nothing to be done for internal-library-compile.Making stage for tweak zxtest...dpkg-deb: building package com.z2xy.zxtext in ./com.z2xy.zxtext_0.0.1-2_iphoneos-arm.deb.上传到设备安装 xzx:zxtest zx$ scp com.z2xy.zxtext_0.0.1-2_iphoneos-arm.deb root192.168.0.120:/var/root/com.z2xy.zxtext_0.0.1-2_iphoneos-arm.deb 100% 2270 2.2KB/s 00:00 当然了,可以使用各种工具将此deb文件上传到设备中,上面使用的是scp.第一个参数是本地文件路径,第二参数目的路径root192.168.0.120指定了同一局域下的iOS设备,/var/root/指定的设备中的路径,中间有一个冒号连接.在设备上使用iFile到/var/root/目录下找到安装包安装如果上面的步骤错误的话,ununderstood data nember data.tar.xz参考: http://stackoverflow.com/questions/21013325/dpkg-error-contains-ununderstood-data-member,打包的时候,压缩的方式和iOS设备上解压缩的方式不一致导致的错误.方式是,替换$THEOS/makefiles/package/deb.mk文件中 $(ECHO_NOTHING)COPYFILE_DISABLE1 $(FAKEROOT) -r dpkg-deb -b $(THEOS_STAGING_DIR) $(_THEOS_DEB_PACKAGE_FILENAME) $(STDERR_NULL_REDIRECT)$(ECHO_END)为:$(ECHO_NOTHING)COPYFILE_DISABLE1 $(FAKEROOT) -r dpkg-deb -Zgzip -b $(THEOS_STAGING_DIR) $(_THEOS_DEB_PACKAGE_FILENAME) $(STDERR_NULL_REDIRECT)$(ECHO_END)重启设备,看到弹窗可以看到第一中方法简便了不少,只需要指定iP地址和完成证书配置就可以一行命令搞定.步骤4: 证书设置(不用多次输入密码)删除iOS设备对应的ip地址所在行从~/.ssh/known_hosts xxxxxxxxxx 192.168.0.120 ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCvTS9W8/88Z9j2D/TBft/ns173ssWhBGQgMyBnSAzIdhmfVd830aq2/78MgKyadyGxD6xhF/LG9tP5ZshaeZB9 XjBjQnEtB0gTZjiyGJpBWFdXCLX/uxV35gwZnu11Ts/HQzdC4neh9pqKR7vsaJP/gIiYqfz/oDchlHrf7bdicZ0yKFlOpilTP4WLgPz2Qqr96xGcn/3dwimFTuye5zAqqfUApjTS/ idKvJNOEsFo6lVkuyOmkbItTjp6MfQliNorOY8nvV0DRFx2lmedRjtq6UNPTyjuLPx3ymZIg/uOazvB0CHs/Ta2kMZRe1bPl8VcHI5/AbL0i7VHQB1pmac上生成证书 $ssh-keygen -t rsa如果已经生成过整数,直接得到~/.ssh/id_ras.pub 公钥就可以了.iOS设置生成.ssh目录ssh登录到iOS设备,生成证书就可以了 xxxxxxxxxx$ssh root192.168.0.120zxde-iPhone:~ root# ssh-keygenzxde-iPhone:~ root# ls -ladrwx------ 2 root wheel 170 Sep 20 22:34 .ssh/用mac上的公钥,替换掉iOS设备上的公钥 scp ~/.ssh/id_rsa.pub root192.168.0.120:/var/root/.ssh/通过上面 的证书配置和iOS设备配置,只需要方法一的一行$make package install 就可以实现,编译,打包,上传到设备,安装deb包,运行.总结一些坑下载头文件的时候,需要做一些替换,git仓库克隆后都有里面居然有这个步骤的注释!!!!(否则的话,打包就会出现找不到头文件,知道不到符号之类的错误)ldid签名工具下载,直接去下载就好了,不要从源码编译了.配置MoblieSubstrate环境的话,直接从iOS设备上拷贝出来就可以了.makefile中指定iOS设备的IP地址,省了不少时间,同时,导入头文件,也是解决了找不到文件的错误.打包文件的解压缩不一致导致的错误,ununderstood data nember data.tar.xz参考http://stackoverflow.com/questions/21013325/dpkg-error-contains-ununderstood-data-member就好了.其实,有些问题在http://www.iphonedevwiki.net/index.php/Theos/Getting_Started 中已经给出了很好的回答.9 Undefined symbols9.10 Incompatible package compression只是最开始没有看.— 最后,步骤4: 证书设置(不用多次输入密码)”,使用后,方便了很多.最后的最后,这里还有一些列相关的资料:http://security.ios-wiki.com/ undefined