如何在radare2中使用核心文件?

逆向工程 雷达2
2021-06-19 21:46:46

在 gdb 中,我可以使用核心文件和可执行文件进行回溯。
似乎radare2可以读取核心文件。像这样

$ r2 core
Setting up coredump: asm.arch <-> x86 and asm.bits <-> 64
Setting up coredump: Registers have been set
Setting up coredump: 22 maps have been found and created
[0x00000000]> 

但在那之后我不知道下一步该怎么办?
我找不到有关在radare2 中使用核心文件的任何文档。

1个回答

这是比 RE 更常规的编程问题。核心转储文件是创建文件时的进程状态(通常是由于崩溃),因此调试器命令最适合这种情况。在 Radare2 中,这些是来自d?类别的。

Usage: d   # Debug commands
| db[?]                    Breakpoints commands
| dbt[?]                   Display backtrace based on dbg.btdepth and dbg.btalgo
| dc[?]                    Continue execution
| dd[?]                    File descriptors (!fd in r1)
| de[-sc] [perm] [rm] [e]  Debug with ESIL (see de?)
| dg <file>                Generate a core-file (WIP)
| dH [handler]             Transplant process to a new handler
| di[?]                    Show debugger backend information (See dh)
| dk[?]                    List, send, get, set, signal handlers of child
| dL[?]                    List or set debugger handler
| dm[?]                    Show memory maps
| do[?]                    Open process (reload, alias for 'oo')
| doo[args]                Reopen in debugger mode with args (alias for 'ood')
| dp[?]                    List, attach to process or thread id
| dr[?]                    Cpu registers
| ds[?]                    Step, over, source line
| dt[?]                    Display instruction traces (dtr=reset)
| dw <pid>                 Block prompt until pid dies
| dx[?]                    Inject and run code on target process (See gs)

您可以在通过发出dr命令创建 coredump 时获取寄存器的值,或者通过dbt.

但在那之后我不知道下一步该怎么办?

接下来的步骤实际上取决于您的情况 - 您想从该转储中获得什么。

我找不到有关在radare2 中使用核心文件的任何文档。

可能这不是 r2 中最常用的函数;)