ios ~逆向逆向

iOS逆向(四)-APP砸壳和class-dump工具的使用

2017-08-18  本文已影响492人  Yochi

逆向工具集的安装和使用

iOS 逆向工程的工具分类

class-dump介绍

class-dump可以将Mach-O文件中的Objective-C运行时的声明信息导出,即编写OC代码时的.h文件。class-dump只能导出未加密的app头文件,class-dump是对"otool -ov"信息的翻译.以一种我们熟悉的易读的方式呈现。

```
-f print the fat headers
-a print the archive header
-h print the mach header
-l print the load commands
-L print shared libraries used
-D print shared library id name
-t print the text section (disassemble with -v)
-p <routine name>  start dissassemble from routine name
-s <segname> <sectname> print contents of section
-d print the data section
-o print the Objective-C segment
-r print the relocation entries
-S print the table of contents of a library
-T print the table of contents of a dynamic shared library
-M print the module table of a dynamic shared library
-R print the reference table of a dynamic shared library
-I print the indirect symbol table
-H print the two-level hints table
-G print the data in code table
-v print verbosely (symbolically) when possible
-V print disassembled operands symbolically
-c print argument strings of a core file
-X print no leading addresses or headers
-m don't use archive(member) syntax
-B force Thumb disassembly (ARM objects only)
-q use llvm's disassembler (the default)
-Q use otool(1)'s disassembler
-mcpu=arg use `arg' as the cpu for disassembly
-j print opcode bytes
-P print the info plist section as strings
-C print linker optimization hints
--version print the version of /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/otool
 ```

classdump的使用

1、点击 class-dump下载dmg安装包
2、将class-dump执行文件拖入到/usr/local/bin目录下
3、终端输入class-dump查看版本号检查是否安装成功
4、class-dump的使用命令:
$class-dump -s -S -H /../xx00.app -o /.../heads
5、框架一样可以导出:
$class-dump -s -S -H /System/Library/Frameworks/AppKit.framework -o /.../heads
解释:
/../xx00.app 是app的路径
/../heads 是存放dump出来头文件的文件夹路径

dumpdecrypted砸壳工具

打开两个终端窗口:
打开两个终端窗口:
打开两个终端窗口:
== 一个ssh登录iPhone后,对iPhone进行操作
== 一个操作本地电脑

==bundle文件路径 (我们需要砸壳的app路径)

方式一:知道app名称情况
$ps -e | grep WeChat 
 1787 ??         0:05.98 /var/containers/Bundle/Application/D28A1C43-2F50-435D-AD0E-DDB14992D63B/WeChat.app/WeChat
 1794 ttys001    0:00.01 grep WeChat

方式二:不知道APP名称,只打开砸壳app
$ps -e 找到含bundle的路径,只会存在一个

/var/containers/Bundle/Application/D28A1C43-2F50-435D-AD0E-DDB14992D63B/WeChat.app/WeChat

==Data文件路径 (放锤子的地方)

$ cycript -p WeChat
cy# directory = NSHomeDirectory()
@"/var/mobile/Containers/Data/Application/E9232D81-80E3-4684-BB0E-FC3643703947"

/var/mobile/Containers/Data/Application/E9232D81-80E3-4684-BB0E-FC3643703947

退出:control+D

为什么要把dumpdecrypted.dylib拷贝到Documents目录下操作?
StoreApp对沙盒以外的绝大多数目录是没有写权限。dumpdecrypted.dylib要写一个decrypted文件,但它是运行在StoreApp中的,与StoreApp的权限相同,那么它的写操作就必须发生在StoreApp拥有写权限的路径下才能成功。StoreApp一定是能写入其Documents目录的,因此我们在Documents目录下使用dumpdecrypted.dylib时,保证它能在当前目录下写一个decrypted文件,这就是把dumpdecrypted.dylib拷贝到Documents目录下操作的原因。

网上搜索错误信息,得出结论:
1、class-dump是利用Object-C语言的runtime特性,提取头文件,使用swift或其它语言混编无法提取头信息
2、使用dumpdecrypted.dylib得不到decrypted破解文件,
(1)可能是app未加壳,
(2)无法破解,例如同样的操作对微信无效。
(3)探索中。。。有见解望留言
本次砸壳iOS10.0.2

上一篇 下一篇

猜你喜欢

热点阅读