跳转到主要内容

纯Python Game Boy Advance反汇编器

项目描述

Luvdis

PyPI - Python Version PyPI GitHub

一个智能的纯Python GBA (Game Boy Advance) 反汇编器。

Luvdis是一个用于反汇编GBA ROM的工具。功能包括

  • 可配置输出:将反汇编输出到stdout、单个文件,或者根据配置将输出分别输出到模块。
  • 平台准确性:其他反汇编引擎(如Capstone)会在GBA处理器的ARMv4上识别非法指令。Luvdis的定制解码器和反汇编器通过尽可能紧密地模拟硬件行为来解决这个问题,并且只支持ARMv4。
  • 函数发现:检测可能的THUMB函数,并区分代码和数据。
  • 匹配输出:即使出现错误,标签与数据重叠等问题,Luvdis的反汇编输出也应该与原始ROM完全相同地汇编。
  • ROM检测:不确定您是否有好的ROM副本?Luvdis可以通过luvdis info告诉您!

内容

安装

从PyPI

Luvdis需要Python 3.6或更高版本。

$ python3 -m pip install luvdis --user

从发布版

可以从GitHub下载任意稳定的发布版并安装

$ python3 -m pip install <path-to-zip> --user

对于Windows用户,也提供了预构建的二进制文件。

从最新源代码

$ python3 -m pip install git+git://https://github.com/arantonitis/luvdis#egg=luvdis

用法

使用Luvdis的最简单方法是只需提供一个ROM和一个输出文件

$ luvdis <path-to-rom> -o rom.s

为了帮助发现/标记函数,可以提供一个函数列表

$ luvdis -c functions.cfg rom.gba -o rom.s

此列表应具有以下结构

# '#' starts a comment line.
# Function names are not mandatory; unknown funcs are named sub_<ADDRESS> when output.
arm_func 0x80000D0
thumb_func 0x800024C AgbMain
# If 'thumb_func' or 'arm_func' is omitted, the type is assumed to be 'thumb_func'.
# A module path may also be provided. Each time a new module is encountered, output switches to that path.
# Omitting the module will continue outputting to the same path.
0x80003b0 main.s CallCallbacks

要拆解ROM的一部分,例如,到只读数据的开始,请提供起始和结束地址

$ luvdis rom.gba --start 0x0800024C --stop 0x0x81b32b4 -o rom.s

常见问题解答

如何从反汇编中去除大块原始字节?

默认情况下,Luvdis将无法确定是否可执行的区域视为字节数据。您可以使用default_mode选项更改此行为

$ luvdis rom.gba --default_mode THUMB -o rom.s

选项

Usage: luvdis disasm [OPTIONS] ROM

  Analyze and disassemble a GBA ROM.

Options:
  --version                   Show the version and exit.
  -o, --output FILE           Disassembly output path. If configuration
                              contains module information, this is only the
                              initial output path.
  -c, --config FILE           Function configuration file.

  -co, --config-out FILE      Output configuration. If any functions are
                              'guessed' by Luvdis, they will appear here.
  -D, --debug                 Turn on/off debugging behavior.
  --start INTEGER             Starting address to disassemble. Defaults to
                              0x8000000 (the start of the ROM).
  --stop INTEGER              Stop disassembly at this address. Defaults to
                              0x9FFFFFF (maximum ROM address).
  --macros FILE               Assembler macro file to '.include' in
                              disassembly. If not specified, default macros
                              are embedded.
  --guess / --no-guess        Turn on/off function guessing & discovery.
                              Default is to perform guessing.
  --min-calls INTEGER RANGE   Minimum number of calls to a function required
                              in order to 'guess' it. Must be at least 1,
                              defaults to 2.
  --min-length INTEGER RANGE  Minimum valid instruction length required in
                              order to 'guess' a function. Must be at least 1,
                              defaults to 3.
  --default-mode [THUMB|BYTE|WORD]
                              Default disassembly mode when the nature of
                              an address is unknown. Defaults to 'BYTE'.
  --help                      Show this message and exit.

ROM检测

显示有关ROM的信息并检查其哈希值是否在数据库中

$ luvdis info unknown_rom.gba
ROM detected: 'Pocket Monsters - Ruby (Japan)' ✔

项目详情


下载文件

下载您平台上的文件。如果您不确定选择哪个,请了解更多关于安装包的信息。

源分发

Luvdis-0.8.0.tar.gz (304.0 kB 查看哈希值)

上传

构建分发

Luvdis-0.8.0-py3-none-any.whl (306.7 kB 查看哈希值)

上传 Python 3

由以下机构支持