您的位置:首页 > 移动开发 > IOS开发

ios逆向的学习笔记

2014-05-12 16:14 323 查看
很开心已经接触到了ios的逆向,并完成了第一个小的tweak。

功能:hookspringboard 当ios启动时插入一个AlertView,详细过程如下:

(大部分工作都在终端下完成)

1、配置环境变量

export THEOS=/opt/theos (就不解释了,都知道什么意思)

export LC_COLLATE='C'

export LC_CTYPE='C'

2、下载安装theos

sudo git clone git://github.com/DHowett/theos.git $THEOS (git是版本控制工具,git clone是获取软件的最新版本)

3、ldid

从https://github.com/downloads/repetrich/ldid/ldid.zip下载,并将ldid文件放在/opt/theos/bin下(装好以后就没有管了)

4、配置mobilesubstrate环境

将ios上/library/frameworks/cydiasubstrate.framework/cydiasubstrate.dylib复制到mac中,并运行

sudo mv -f /path/to/cydiasubstrate $THEOS/lib/libsubstrate.dylib

sudo $THEOS/bin/bootstrap.sh substrate

5、安装dpkg

从http://www.macports.org/install.php下载对应的osx版本的pkg包

sudo port selfupdate

sudo port install dpkg (以前ubantu下面用的get-apt就被现在这个port替代,例如get-apt install就等于port install)

6、安装theos模版

从https://github.com/DHowett/theos-nic-templates/archive/master.zip

将解压得到的5个tar文件复制到$THEOS/templates/iphone下

第一个Tweak的制作

1、进入常用目录(我的是wl/code)然后输入

$THEOS/bin/nic.pl

选择9

输入deb包的名字(按照bundle identifier写):com.naken.iosre

tweak作用对象的bundle identifier,这里是com.apple.springboard (看你的作用对象是什么填对应的bundle,不能随便填)

2、编辑control

Package: com.naken.iosre

Name: IOSRE

Depends: mobilesubstrate,firmware (>=5.0)

Version: 1.0

Architecture: iphoneos-arm

Description: 在SpringBoard启动后弹出UIAlertView!

Maintainer: jooson

Author: jooson

Homepage: http://iosre.com
Section: Tweaks

3、编辑iOSRE.plist

指定tweak的作用对象:com.apple.springboard

4、编辑makefile文件

ARCHS=armv7

TARGET=iphone:6.1:4.3

include theos/makefiles/common.mk

TWEAK_NAME = IOSRE

IOSRE_FILES = Tweak.xm

IOSRE_FRAMEWORKS=UIKit

include $(THEOS_MAKE_PATH)/tweak.mk

after-install::

install.exec "killall -9 SpringBoard"

5、编辑Tweak.xm(logos和object-c语法)

%hook SpringBoard

-(void) applicationDidFinishLaunching:(id)application

{

%orig;

UIAlertView *alert=[[UIAlertView alloc] initWithTitle:@"Hello, Tweak!"

message:nil delegate:self cancelButtonTitle:@"ok" otherButtonTitles:nil];

[alert show];

[alert release];

}

%end

6、打包(如果没有前面配置环境的后两句话就会报错,sed:RE error:illegal byte sequence)

make package

生成一个deb包,(10.9下可能会出问题,我的是10.8所以就不管了,出问题再去书上查)

(还有很多关于安装的技巧,可以看书的44页)

7、安装

用ssh方法(适用于mac os系统也带有wifi,有一种通过基于usb的ssh连接的方法,我没有试通)

在windows下可以用ssh连接(用putty工具)也可以用iFunbox2014进行安装,我就是用这个方法成功了!
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: