📕
Radare2手册
  • 简介
  • 历史
  • Radare2框架
  • 下载radare2
  • 编译与可移植性
  • Compilation on Windows
  • Compilation on Android
  • 用户界面
  • 快速上手
    • 命令行选项
    • 命令格式
    • 表达式
    • 基本的debug操作
    • Contributing to radare2
  • 配置
    • Colors
    • 配置项
    • radare2相关文件
  • 基本命令
    • 定位
    • 块大小
    • 节区
    • 映射文件
    • 输出模式
    • 标记符(Flags)
    • 写入数据
    • Zoom模式
    • 复制/粘贴
    • 字节比较
    • SDB
    • Dietline
  • 可视化模式
    • 反汇编界面
    • 汇编界面
    • 变量编辑器界面
    • 可视化面板
  • 搜索字节
    • 基本的搜索用法
    • 配置搜索引擎
    • 搜索重复字节序列
    • 搜索中的自动化
    • 回溯搜索
    • 搜索汇编指令
    • Searching for AES Keys
  • 反汇编
    • 为反汇编添加元数据
    • ESIL
  • 分析
    • 代码分析
    • 变量
    • 类型
    • 调用约定
    • 虚函数表
    • 系统调用
    • 模拟执行
    • Symbols 信息
    • 函数签名
    • 图形化命令
  • 脚本化
    • 循环(Loops)
    • 宏(Macros)
    • R2pipe
  • 调试器
    • 入门
    • 从ida, GDB 或 WinDBG迁移到radare2
    • 寄存器(Registers)
    • 内存映射(Memory Maps)
    • 堆(Heap)
    • 文件(Files)
    • 反向调试
    • Windows消息(Messages)
  • 远程访问
    • 远程GDB调试
    • 远程WinDbg
  • 命令行工具
    • Rax2
    • Rafind2
    • Rarun2
    • Rabin2
      • 文件信息识别
      • 入口点(EP)
      • 导入(Imports)
      • 导出(Exports)
      • Symbols (exports)
      • 库文件
      • 字符串(String)
      • 节区(Sections)
    • Radiff2
      • 二进制文件比较
    • Rasm2
      • 汇编
      • 反汇编
      • 配置项
    • Ragg2
      • Language
    • Rahash2
      • Rahash Tool
  • 插件
    • IO 插件
    • Asm 插件
    • Analysis 插件
    • Bin 插件
    • 其它插件
    • Python插件
    • 对插件进行调试
    • 测试
    • 打包
  • Crackmes
    • IOLI
      • IOLI 0x00
      • IOLI 0x01
    • Avatao R3v3rs3 4
      • .radare2
      • .first_steps
      • .main
      • .vmloop
      • .instructionset
      • .bytecode
      • .outro
  • Reference Card
  • Acknowledgments
由 GitBook 提供支持
在本页
  • Survival Guide
  • Flags
  • Flagspaces
  • Information
  • Print string
  • Visual mode
  • Searching
  • Saving
  • Usable variables in expression

这有帮助吗?

Reference Card

This chapter is based on the Radare 2 reference card by Thanat0s, which is under the GNU GPL. Original license is as follows:

This card may be freely distributed under the terms of the GNU
general public licence — Copyright by Thanat0s - v0.1 -

Survival Guide

Those are the basic commands you will want to know and use for moving around a binary and getting information about it.

Command

Description

s (tab)

Seek to a different place

x [nbytes]

Hexdump of nbytes, $b by default

aa

Auto analyze

pdf@fcn(Tab)

Disassemble function

f fcn(Tab)

List functions

f str(Tab)

List strings

fr [flagname] [newname]

Rename flag

psz [offset]~grep

Print strings and grep for one

arf [flag]

Find cross reference for a flag

Flags

Flags are like bookmarks, but they carry some extra information like size, tags or associated flagspace. Use the f command to list, set, get them.

Command

Description

f

List flags

fd $$

Describe an offset

fj

Display flags in JSON

fl

Show flag length

fx

Show hexdump of flag

fC [name] [comment]

Set flag comment

Flagspaces

Flags are created into a flagspace, by default none is selected, and listing flags will list them all. To display a subset of flags you can use the fs command to restrict it.

Command

Description

fs

Display flagspaces

fs *

Select all flagspaces

fs [sections]

Select one flagspace

Information

Binary files have information stored inside the headers. The i command uses the RBin api and allows us to the same things rabin2 do. Those are the most common ones.

Command

Description

ii

Information on imports

iI

Info on binary

ie

Display entrypoint

iS

Display sections

ir

Display relocations

iz

List strings (izz, izzz)

Print string

There are different ways to represent a string in memory. The ps command allows us to print it in utf-16, pascal, zero terminated, .. formats.

Command

Description

psz [offset]

Print zero terminated string

psb [offset]

Print strings in current block

psx [offset]

Show string with scaped chars

psp [offset]

Print pascal string

psw [offset]

Print wide string

Visual mode

The visual mode is the standard interactive interface of radare2.

To enter in visual mode use the v or V command, and then you'll only have to press keys to get the actions happen instead of commands.

Command

Description

V

Enter visual mode

p/P

Rotate modes (hex, disasm, debug, words, buf)

c

Toggle (c)ursor

q

Back to Radare shell

hjkl

Move around (or HJKL) (left-down-up-right)

Enter

Follow address of jump/call

sS

Step/step over

o

Go/seek to given offset

.

Seek to program counter

/

In cursor mode, search in current block

:cmd

Run radare command

;[-]cmt

Add/remove comment

x+-/[]

Change block size, [] = resize hex.cols

>||<

Seek aligned to block size

i/a/A

(i)nsert hex, (a)ssemble code, visual (A)ssembler

b/B

Toggle breakpoint / automatic block size

d[f?]

Define function, data, code, ..

D

Enter visual diff mode (set diff.from/to)

e

Edit eval configuration variables

f/F

Set/unset flag

gG

Go seek to begin and end of file (0-$s)

mK/’K

Mark/go to Key (any key)

M

Walk the mounted filesystems

n/N

Seek next/prev function/flag/hit (scr.nkey)

o

Go/seek to given offset

C

Toggle (C)olors

R

Randomize color palette (ecr)

t

Track flags (browse symbols, functions..)

T

Browse anal info and comments

v

Visual code analysis menu

V/W

(V)iew graph (agv?), open (W)ebUI

uU

Undo/redo seek

x

Show xrefs to seek between them

yY

Copy and paste selection

z

Toggle zoom mode

Searching

There are many situations where we need to find a value inside a binary or in some specific regions. Use the e search.in=? command to choose where the / command may search for the given value.

Command

Description

/ foo\00

Search for string ’foo\0’

/b

Search backwards

//

Repeat last search

/w foo

Search for wide string ’f\0o\0o\0’

/wi foo

Search for wide string ignoring case

/! ff

Search for first occurrence not matching

/i foo

Search for string ’foo’ ignoring case

/e /E.F/i

Match regular expression

/x a1b2c3

Search for bytes; spaces and uppercase nibbles are allowed, same as /x A1 B2 C3

/x a1..c3

Search for bytes ignoring some nibbles (auto-generates mask, in this example: ff00ff)

/x a1b2:fff3

Search for bytes with mask (specify individual bits)

/d 101112

Search for a deltified sequence of bytes

/!x 00

Inverse hexa search (find first byte != 0x00)

/c jmp [esp]

Search for asm code (see search.asmstr)

/a jmp eax

Assemble opcode and search its bytes

/A

Search for AES expanded keys

/r sym.printf

Analyze opcode reference an offset

/R

Search for ROP gadgets

/P

Show offset of previous instruction

/m magicfile

Search for matching magic file

/p patternsize

Search for pattern of given size

/z min max

Search for strings of given size

/v[?248] num

Look for a asm.bigendian 32bit value

Saving

By default, when you open a file in write mode (r2 -w) all changes will be written directly into the file. No undo history is saved by default.

Use e io.cache.write=true and the wc command to manage the write cache history changes. To undo, redo, commit them to write the changes on the file..

If, instead, we want to save the analysis information, comments, flags and other user-created metadata, we may want to use projects with r2 -p and the P command.

Command

Description

Po [file]

Open project

Ps [file]

Save project

Pi [file]

Show project information

Usable variables in expression

The ?$? command will display the variables that can be used in any math operation inside the r2 shell. For example, using the ? $$ command to evaluate a number or ?v to just the value in one format.

All commands in r2 that accept a number supports the use of those variables.

Command

Description

$$

here (current virtual seek)

$$$

current non-temporary virtual seek

$?

last comparison value

$alias=value

alias commands (simple macros)

$b

block size

$B

base address (aligned lowest map address)

$f

jump fail address (e.g. jz 0x10 => next instruction)

$fl

flag length (size) at current address (fla; pD $l @ entry0)

$F

current function size

$FB

begin of function

$Fb

address of the current basic block

$Fs

size of the current basic block

$FE

end of function

$FS

function size

$Fj

function jump destination

$Ff

function false destination

$FI

function instructions

$c,$r

get width and height of terminal

$Cn

get nth call of function

$Dn

get nth data reference in function

$D

current debug map base address ?v $D @ rsp

$DD

current debug map size

$e

1 if end of block, else 0

$j

jump address (e.g. jmp 0x10, jz 0x10 => 0x10)

$Ja

get nth jump of function

$Xn

get nth xref of function

$l

opcode length

$m

opcode memory reference (e.g. mov eax,[0x10] => 0x10)

$M

map address (lowest map address)

$o

here (current disk io offset)

$p

getpid()

$P

pid of children (only in debug)

$s

file size

$S

section offset

$SS

section size

$v

opcode immediate value (e.g. lui a0,0x8010 => 0x8010)

$w

get word size, 4 if asm.bits=32, 8 if 64, ...

${ev}

get value of eval config variable

$r{reg}

get value of named register

$k{kv}

get value of an sdb query value

$s{flag}

get size of flag

RNum

$variables usable in math expressions

上一页.outro下一页Acknowledgments

最后更新于4年前

这有帮助吗?