前言
砸壳网站 https://decrypt.day/ 广告太多,而且砸完的 APP 经常不能用。
本文介绍如何使用flexdecrypt工具对iOS应用进行砸壳(解密),获取可用于逆向分析的IPA文件。
注意
Clutch 已经不能用了,现在一般使用 flexdecrypt 来砸壳。
开始
工具下载
1. Flexdecrypt
- GitHub仓库: https://github.com/JohnCoates/flexdecrypt
直接下载:
# 下载预编译版本 wget https://github.com/JohnCoates/flexdecrypt/releases/download/1.1/flexdecrypt.deb # 或下载二进制文件 wget https://github.com/JohnCoates/flexdecrypt/releases/download/1.1/flexdecrypt
2. Flexdump辅助脚本
- Gist地址: https://gist.github.com/defparam/71d67ee738341559c35c684d659d40ac
下载命令:
curl -o flexdump https://gist.githubusercontent.com/defparam/71d67ee738341559c35c684d659d40ac/raw/flexdump
3. 其他可选工具
- frida-ios-dump: https://github.com/AloneMonkey/frida-ios-dump
- CrackerXI+: Cydia/Sileo商店安装
安装步骤
方法一:使用自动化脚本
创建flexdecrypt_install.sh脚本:
#!/bin/bash
# 配置
IPHONE_IP="192.168.50.57" # 修改为你的iPhone IP
IPHONE_USER="root"
IPHONE_PASS="alpine" # 修改为你的root密码
# 下载flexdecrypt
if [ ! -f flexdecrypt ]; then
echo "Downloading flexdecrypt..."
curl -L -o flexdecrypt https://github.com/JohnCoates/flexdecrypt/releases/download/1.1/flexdecrypt
fi
# 下载flexdump
if [ ! -f flexdump ]; then
echo "Downloading flexdump..."
curl -o flexdump https://gist.githubusercontent.com/defparam/71d67ee738341559c35c684d659d40ac/raw/flexdump
fi
# 传输到iPhone
echo "Transferring files to iPhone..."
sshpass -p "$IPHONE_PASS" scp flexdecrypt root@$IPHONE_IP:/var/jb/usr/bin/
sshpass -p "$IPHONE_PASS" scp flexdump root@$IPHONE_IP:/var/jb/usr/bin/
# 设置权限
echo "Setting permissions..."
sshpass -p "$IPHONE_PASS" ssh root@$IPHONE_IP "chmod +x /var/jb/usr/bin/flexdecrypt /var/jb/usr/bin/flexdump"
# 创建符号链接(flexdump需要)
sshpass -p "$IPHONE_PASS" ssh root@$IPHONE_IP "ln -sf /var/jb/usr/bin/flexdecrypt /var/jb/usr/bin/flexdecrypt2"
echo "Installation complete!"方法二:手动安装
连接到iPhone:
ssh root@192.168.50.57 # 输入密码传输文件:
# 在Mac上执行 scp flexdecrypt root@192.168.50.57:/var/jb/usr/bin/ scp flexdump root@192.168.50.57:/var/jb/usr/bin/设置权限:
# 在iPhone上执行 chmod +x /var/jb/usr/bin/flexdecrypt chmod +x /var/jb/usr/bin/flexdump ln -s /var/jb/usr/bin/flexdecrypt /var/jb/usr/bin/flexdecrypt2
使用方法
1. 列出所有应用
# 使用flexdump列出应用
ssh root@192.168.50.57 "/var/jb/usr/bin/flexdump list"
# 手动列出应用
ssh root@192.168.50.57 "ls /var/containers/Bundle/Application/*/2. 砸壳指定应用
使用flexdump(推荐)
# 在iPhone上执行
/var/jb/usr/bin/flexdump dump AppName.app
# 例如:
/var/jb/usr/bin/flexdump dump WeChat.app
/var/jb/usr/bin/flexdump dump DUApp.app直接使用flexdecrypt
# 找到应用路径
cd /var/containers/Bundle/Application/[UUID]/AppName.app
# 解密二进制文件
flexdecrypt AppName AppName_decrypted
# 手动打包IPA(需要额外步骤)3. 下载砸壳后的IPA
# IPA默认保存在 /var/root/dump/
scp root@192.168.50.57:/var/root/dump/AppName_*.ipa ~/Desktop/验证砸壳结果
1. 检查文件大小
砸壳后的IPA通常会比App Store版本小(去除了加密层):
ls -lh ~/Desktop/*.ipa2. 解压IPA检查
# 解压IPA
unzip -q AppName.ipa -d AppName_extracted
# 检查二进制文件加密状态
cd AppName_extracted/Payload/AppName.app
otool -l AppName | grep -A 4 LC_ENCRYPTION_INFO如果cryptid为0,表示已成功解密。
3. 使用class-dump验证
# 安装class-dump
brew install class-dump
# 导出头文件(只对Objective-C有效)
class-dump -H AppName -o headers/4. 在IDA Pro/Hopper中打开
成功砸壳的二进制文件可以直接在逆向工具中分析。
参考资源
已测试应用
| 应用名称 | Bundle Name | 版本 | IPA大小 | 状态 |
|---|---|---|---|---|
| 微信 | WeChat.app | 8.0.50 | 198MB | ✅ 成功 |
| 得物 | DUApp.app | 5.81.5 | 127MB | ✅ 成功 |