Ghidrathon 项目教程

Ghidrathon 项目教程

GhidrathonThe FLARE team's open-source extension to add Python 3 scripting to Ghidra.项目地址:https://gitcode.com/gh_mirrors/gh/Ghidrathon

项目介绍

Ghidrathon 是一个由 Mandiant 的 FLARE 团队开发的开放源代码扩展,旨在为 Ghidra 添加 Python 3 脚本功能。Ghidra 原生支持 Java 和 Jython 脚本,但由于许多开源分析工具(如 capa、Unicorn Engine、angr 等)是用 Python 3 编写的,Ghidrathon 的开发填补了这一空白,使得这些工具可以直接在 Ghidra 中使用。

项目快速启动

安装 Ghidrathon

  1. 下载并解压最新版本的 Ghidrathon

  2. 安装依赖

    • 使用你希望与 Ghidrathon 一起使用的 Python 解释器执行以下命令(requirements.txtghidrathon_configure.py 包含在发布中):
      python -m pip install -r requirements.txt
      python ghidrathon_configure.py <absolute_path_to_ghidra_install_dir>
      

配置 Ghidra

  • 确保你的 Ghidra 版本 >= 10.3.2,并且 Java 版本 >= 17.0.0。
  • 将 Ghidrathon 解压到 Ghidra 的 Extensions 目录中,并重启 Ghidra。

应用案例和最佳实践

使用第三方 Python 模块

Ghidrathon 允许你在 Ghidra 中使用第三方 Python 模块。例如,你可以安装并使用 Unicorn 来模拟 ARM 代码:

  1. 安装 Unicorn

    pip install unicorn
    
  2. 在 Ghidra 中使用 Unicorn

    • 在 Ghidra 的 Python 脚本中导入并使用 Unicorn:
      from unicorn import *
      from unicorn.arm_const import *
      

编写 Ghidra Python 3 脚本

Ghidrathon 提供了与 Ghidra 的 Java 和 Jython 扩展类似的脚本体验,包括访问 GhidraScript 状态实例变量(如 currentProgram)和 FlatProgramAPI 方法(如 findBytes):

from ghidra.program.model.address import Address

def find_bytes(pattern):
    current_program = state.getCurrentProgram()
    address_set = current_program.getAddressFactory().getAddressSet()
    return current_program.getMemory().findBytes(address_set.getMinAddress(), pattern)

典型生态项目

capa

capa 是一个用于分析可执行文件以识别其功能的开源工具。通过 Ghidrathon,你可以在 Ghidra 中直接使用 capa 进行分析:

  1. 安装 capa

    pip install flare-capa
    
  2. 在 Ghidra 中使用 capa

    • 编写一个 Ghidra Python 脚本来调用 capa:
      import capa.main
      

Unicorn Engine

Unicorn Engine 是一个多平台、多架构的 CPU 仿真框架。通过 Ghidrathon,你可以在 Ghidra 中使用 Unicorn 进行代码仿真:

  1. 安装 Unicorn Engine

    pip install unicorn
    
  2. 在 Ghidra 中使用 Unicorn Engine

    • 编写一个 Ghidra Python 脚本来使用 Unicorn:
      from unicorn import *
      from unicorn.arm_const import *
      

通过这些案例和最佳实践,你可以充分利用 Ghidrathon 在 Ghidra 中使用 Python 3 进行高级分析和脚本编写。

GhidrathonThe FLARE team's open-source extension to add Python 3 scripting to Ghidra.项目地址:https://gitcode.com/gh_mirrors/gh/Ghidrathon

  • 23
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

廉艳含

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值