泄密无花 发表于 2023-2-15 14:09

安卓逆向笔记 - Frida逆向入门之环境搭建

本帖最后由 泄密无花 于 2023-2-15 14:45 编辑

# 0x00 前言

《安卓Frida逆向与抓包实战》学习笔记 - Frida环境搭建

# 0x01 Frida 环境搭建

官方项目:https://github.com/frida/frida/tree/12.8.0

## 1、准备工作

### 确定系统及架构

笔记使用逍遥模拟器 Android 9

确定 **frida-server** 的架构需要和测试机的系统以及架构一致

进入测试机的 **adb shell**,即用 **getprop** 命令查看系统的架构

```Shell
getprop ro.product.cpu.abi
```

![架构.png](data/attachment/forum/202302/15/141124hn8mhm9dp8qm7b48.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/300 "架构.png")

下载对应的 **frida-server**

![架构-2.png](data/attachment/forum/202302/15/141414uj811u1pjb77gll7.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/300 "架构-2.png")

## 安装 Frida

在安装自定义版本的 Frida 时,仅仅需要先使用 pip 安装特定版本的Frida和相对应版本的 frida-tools 即可。12.8.0版本的 Frida 和相应的 frida-tools 版本的对应关系如下所示:

![版本对应.png](data/attachment/forum/202302/15/142446ctsftowbfmzsoiff.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/300 "版本对应.png")

使用 miniconda 方便切换 Python 环境,笔记内使用的 Python 版本为 3.7

```powershell
# 创建 Python 环境
conda create -n py37 python=3.7
# 激活环境
conda activate py37
```

使用相对比较稳定的12.8.0版本的Frida

```powershell
# 安装 frida
pip install frida==12.8.0
# 安装 frida-tools
pip install frida-tools==5.3.0
```

# 0x02 验证

## 1、下载与测试机系统和架构对应的 **frida-server 并解压缩**

```powershell
frida-server-12.8.0-android-x86_64.xz
```

## 2、在测试机上运行 frida-server

推送 **frida-server** 到 **/data/local/tmp/**,并运行

```powershell
# 执行完命令不能关闭该终端
$ adb root
$ adb push frida-server /data/local/tmp/
$ adb shell "chmod 755 /data/local/tmp/frida-server"
$ adb shell "/data/local/tmp/frida-server &"

# 新开一个终端执行
frida-ps -U
```

!(data/attachment/forum/202302/15/143845et57oszo201o87qi.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/300 "ml.png")

运行测试命令(在 CMD 中激活 conda 环境,再运行测试命令)

![测试.png](data/attachment/forum/202302/15/144103pabtb01qg07jja0b.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/300 "测试.png")

## 3、在 Chrome 中跟踪 open() 调用

在设备上启动 Chrome 并返回到终端并运行

```powershell
frida-trace -U -i open com.android.chrome
```

只要点击 Chrome 就能看到 hook 的提示信息

!(data/attachment/forum/202302/15/144358nkitl36l8czwokjt.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/300 "open.png")

曾经沧海 发表于 2023-2-25 23:19

真厉害,大佬,我学到了

曾经沧海 发表于 2023-2-28 08:16

感谢,正好有需要,非常感谢~

槐树 发表于 2023-3-13 11:25

学习学习

一生逍遥 发表于 2023-3-25 15:07

楼主辛苦了,谢谢分享!

爱编 发表于 2023-6-2 17:32

先收藏 下,后面不明白再回来查看对照

sjtkxy 发表于 2023-9-13 05:06

爱编 发表于 2024-2-28 10:52

感谢分享

九天一叶 发表于 2024-12-26 20:07

感谢楼主的分享!
页: [1]
查看完整版本: 安卓逆向笔记 - Frida逆向入门之环境搭建