iOS逆向工具集

本篇文章是我在学习逆向工程时整理的逆向工程工具集 只作为记录使用 并不是详细的教程 阅读本篇教程需要你有一定逆向工程知识

一,Cycript

介绍
iOS运行时工具 可hook运行时进程 并提供了以下能力
1,开发者可以在应用运行时查看和修改应用 得到所有正在使用的类名或方法名
2,运行时修改实例变量的值
3,Method Swizzling,替换特定方法的实现
4,运行时调用任意代码
当然Cycript远不止这些 更多细节可参考如下链接:
官网
使用手册

hook SpringBaord进程实例

ps -e | grep SpringBaord(进程名称)
//ps -e 查看所有进程
cycript -p (pid) 注入进程

Cycript语法不需要声明变量类型
结束不需要有分号 其余和oc语法一致

alertView = [[UIAlertView alloc] initWithTitle:@"t"   message:@"msg" delegate:nil cancelButtonTitle:@"ok"    otherButtonTitles:nil]

[alertView show]

或者通过内存地址访问对象

[#0x13692f840 show] 不要忘记#

如果不知道一个对象的内存地址可以通过
choose命令找到

 choose(UIViewController)

二,OpenSSH

openSSH提供了远程登录到iPhone的功能
使用前需要在iPhone中安装OpenSSH工具
OpenSSH默认登录密码为:alpine

远程登录实例

ssh root@设备ip地址
ssh [email protected]

修改openSSH默认密码:

root# passwd  
  Changing password for root.  
New password:  
  Retype new password:  
root#  

三,theos

iOS越狱程序开发框架 简化了编写越狱程序的流程

四,lldb + debugserver

iOS远程调试APP

1、将debug server文件从手机拷贝到mac

scp [email protected]:/Developer/usr/bin/debugserver ~/

2,瘦身 压缩文件 arm64根据手机指定

lipo -thin arm64 ~/debugserver -output ~/debugserver

3,给debug server添加task_for_pid权限

下载http://iosre.com/ent.xml 放到 ~/User/用户名/ 

执行命令 /opt/theos/bin/ldid -Sent.xml debug server

4,将debugserer复制到/usr/bin/debugserver

scp ~/debugserver root@iPhone设备ip:/usr/bin/debugserver

5,登录(ssh)手机 启动debugserver监听

debug server *:1234(监听的端口) -a "MobileSMS(模块名称)"
或者debug server *:1234 -a   /Applications/MobileSMS.app/MobileSMS(模块地址)

6, 启动lldb(Mac终端)
启动:lldb 连接接debug server :

 #lldb 执行lldb命令
 #process connect connect://iOSIP:端口(该端口需要和debug server指定的端口一致)

五,dyld_decache

提取iOS系统内的二进制文件

从iOS 3.1开始,包括frameworks在内的许多库文件被放入了位于“/System/Library/Caches/com.apple.dyld/dyld_shared_cache_armx” (dyld_shared_cache_armv7,dyld_shared_cache_armv7s,dyld_shared_cache_arm64),可使用dyld_decache将其中的二进制文件提取出来

1, 用iFunBox从手机中拷贝dyld_deache

System/Library/Caches/com.apple.dyld/ dyld_shared_cache_armx

2,下载提取工具dyld_decache

https://github.com/downloads/kennytm/Miscellaneous/dyld_decache[v0.1c].bz2下载dyld_decache

可将dyld_decache[v0.1c] 重命名为dyld_decache

3,赋予权限

 chmod +x dyld_decache(具体路径)

4,执行提取命令

/Users/ligh/dyld_decache -o /Users/ligh/Desktop/binarys /Users/ligh/Desktop/dyld_shared_cache_armv7s(arm64)

六,dump decrypted提取头文件

class-dump无法提取加密后的App(AppleStroe下载的App)头文件
在这种情况下 需要先解密App的可执行文件 俗称 “咂壳” dumpdecrypted就是用来咂壳的工具

  1. 下载dump decrypted源码 依次执行下面的命令
mkdir Code
cd Code/
git clone https://github.com/stefanesser/dumpdecrypted.git
cd dumpdecrypted/
make

2.关闭所有应用 开启需要咂壳的App

ps -e //找到该App的可执行文件名称
cycript -p TargetApp // 附加该进程 
 [[NSFileManager defaultManager ] URLsForDirectory:NSDocumentDirectory inDomains:NSUserDomainMask

3.拷贝dumpdecrypted.dylib 到 TaregetApp Documents 目录下

scp /Users/ligh/Desktop/Code/dumpdecrypted/dumpdecrypted.dylib root@iPhoneip:/var/mobile/Applications/XXX/Documents/ 

4.进入TaregetApp Documents目录

cd /var/mobile/Applications/XXX/Documents/

5.开始咂壳

DYLD_INSERT_LIBRARIES=dumpdecrypted.dylib /var/mobile/Applications/557619D0-29AC-40DD-9266-8A0154F634AA/WeChat.app/WeChat //可执行文件地址

在当前Documents目录下会生成xx.decrypted文件
把文件拷贝到OSX 用class-dump IDA分析文件

六,iOS-Runtime-Headers

1.iOS-Runtime-Headers:
https://github.com/nst/iOS-Runtime-Headers

2.OSXRuntimeBrowser:
https://github.com/nst/RuntimeBrowser

更多请搜索:iOS private Headers

六,plutil

1,查看plist内容

plutil    -p /Users/ligh/Desktop/com.apple.SpringBoard.plist

2, 将plist转为xml

plutil -convert xml1 /Users/ligh/Desktop/com.apple.SpringBoard.plist

3.使用帮助

 man plutil

4.语法检查

plutil -lint /Users/ligh/Desktop/com.apple.SpringBoard.plist

由于自己能力有限 如有理解不对的地方 还望各位指正
本篇文章会在我学习过程中持续更新


欢迎关注个人公众号:DevTipss

DevTipss

你可能感兴趣的:(iOS逆向工具集)