Objection

原文链接,这里做了简单的摘取,便于查找粘贴,更多API可以通过源码进行学习。

如下图:

1.1 获取基本信息

首先查看一下“设置”应用的包名
frida-ps -U|grep -i setting
再使用objection注入“设置”应用
objection -g com.android.settings explore
objection -N -h IP -p port -g pkgName explore

1.2 提取内存信息

查看内存中加载的库
memory list modules
查看库的导出函数
memory list exports libssl.so
将结果保存到json文件中
memory list exports libart.so --json /root/libart.json 
提取整个(或部分)内存
memory dump all from_base
搜索整个内存
memory search --string --offsets-only

1.3 内存堆搜索与执行

在堆上搜索实例
android heap search instances com.android.settings.DisplaySettings 
调用实例的方法
android heap execute 地址 getPreferenceScreenResId  
在实例上执行js代码
android heap evaluate 地址 

执行命令后,会进入一个迷你编辑器环境,输入

console.log("evaluate result:"+clazz.getPreferenceScreenResId()) 

ESC退出编辑器,然后按回车

1.4 启动activityservice

直接启动activity
android intent launch_activity com.android.settings.DisplaySettings  
查看当前可用的activity
android hooking list activities
直接启动service

查看可供开启的服务

android hooking list services

开启服务

android intent launch_service com.android.settings.bluetooth.BluetoothPairingService

2.1 objection(内存漫游)

列出内存中所有的类
android hooking list classes
内存中搜索所有的类
android hooking search classes display  
内存中搜索所有的方法
android hooking search methods display
列出类的所有方法
android hooking list class_methods com.android.settings.DisplaySettings
直接生成hook代码
android hooking generate  simple  com.android.settings.DisplaySettings  

2.2 objection(hook)

hook类的所有方法
android hooking watch class android.bluetooth.BluetoothDevice
统计Hook了多少个方法
jobs list
hook方法的参数、返回值和调用栈
android hooking watch class_method android.bluetooth.BluetoothDevice.getName --dump-args --dump-return --dump-backtrace
删除hook
jobs list jobs kill
hook方法的所有重载
android hooking watch class_method

例子:用File类的构造器来试一下效果

android hooking watch class_method java.io.File.$init --dump-args