
目录
一,加壳
二,脱壳
三,工具
四,验证
一,加壳
1,介绍
-
App Store会对
ipa
包中的可执行文件进行加壳操作 -
加壳就是利用特殊的算法,对可执行文件进行加密,以达到保护程序代码的目的
2,加壳前后
- 加壳前:可执行文件能够直接在内存中运行

- 加壳后:壳程序会一同被加载进内存,壳程序会对可执行文件进行解密,这样可执行文件就能够运行了

3,加壳的可执行文件是无法反编译的
- 从iPhone上导出喜马拉雅的可执行文件

-
class-dump
:只导出一个无效.h
文件

-
Hopper
:看不到类名、方法名等信息

二,脱壳
1,介绍
- 脱壳就是将壳程序去掉,并将已加密的可执行文件进行解密
2,方法
- 硬脱壳:直接执行解密算法(常用方法)

- 动态脱壳:将壳程序加载到内存中,壳程序会对可执行文件进行解密,然后导出可执行文件即可

三,工具
1,用Clutch
脱壳(下载地址:https://github.com/KJCracks/Clutch/releases)
- 下载并修改名称

- 将
Clutch
拷贝到iPhone的/usr/bin
目录下

- 赋予
Clutch
权限:chmod +x /usr/bin/Clutch

- 查看iPhone上已安装的APP:
Clutch -i

- 开始脱壳:
Clutch -d [APP序号]


- 脱壳成功后会生成一个新的
ipa
包

2,用dumpdecrypted
脱壳(下载地址:https://github.com/stefanesser/dumpdecrypted)
- 下载并执行
make
命令,生成dumpdecrypted.dylib
动态库

- 将动态库拷贝到iPhone的
/var/root
目录下

- 查看可执行文件路径:先运行APP,然后执行
ps -A
命令

- 开始脱壳:
DYLD_INSERT_LIBRARIES=dumpdecrypted.dylib [可执行文件路径]


- 脱壳成功后会生成一个新的可执行文件

3,用frida-ios-dump
脱壳
- 在iPhone上通过
Cydia
安装frida
插件(软件源:https://build.frida.re)

- 在Mac上配置
frida
环境:sudo pip install frida

- 下载
frida-ios-dump
工具:git clone https://github.com/AloneMonkey/frida-ios-dump.git

- 把
dump.py
文件中的端口号改为10010(跟登录iPhone所用端口号保持一致即可)

- 查询APP的
bundleId
:./dump.py -l

- 先启动APP,然后开始脱壳:
./dump.py bundleId

- 脱壳成功后会生成一个新的
ipa
包

4,比较
-
Clutch
:很多APP都会失败 -
dumpdecrypted
:只能对可执行文件进行脱壳,对于动态库不太好处理,有些APP会将代码封装成动态库 -
frida-ios-dump
:能处理动态库且成功率高(推荐使用)

四,验证
1,查看是否已脱壳
MachOView


otool


2,脱壳的可执行文件才能进行反编译
class-dump

Hopper

网友评论