The Official Radare2 Book | страница 67



[0x4A13B8C0]> pf 2*xw pointer type @ esp

0x00404888 [0] {

pointer :

(*0xffffffff8949ed31) type : 0x00404888 = 0x8949ed31

0x00404890 = 0x48e2

}

0x00404892 [1] {

(*0x50f0e483) pointer : 0x00404892 = 0x50f0e483

type : 0x0040489a = 0x2440

}

A practical example for using pf on a binary of a GStreamer plugin:

$ radare2 /usr/lib/gstreamer-1.0/libgstflv.so

[0x00006020]> aa; pdf @ sym.gst_plugin_flv_get_desc

[x] Analyze all flags starting with sym. and entry0 (aa)

sym.gst_plugin_flv_get_desc ();

[...]

0x00013830 488d0549db0000 lea rax, section..data.rel.ro ; 0x21380

0x00013837 c3 ret

[0x00006020]> s section..data.rel.ro

[0x00021380]> pf ii*z*zp*z*z*z*z*z*z major minor name desc init version license source package origin release_datetime

major : 0x00021380 = 1

minor : 0x00021384 = 18

name : (*0x19cf2)0x00021388 = "flv"

desc : (*0x1b358)0x00021390 = "FLV muxing and demuxing plugin"

init : 0x00021398 = (qword)0x0000000000013460

version : (*0x19cae)0x000213a0 = "1.18.2"

license : (*0x19ce1)0x000213a8 = "LGPL"

source : (*0x19cd0)0x000213b0 = "gst-plugins-good"

package : (*0x1b378)0x000213b8 = "GStreamer Good Plugins (Arch Linux)"

origin : (*0x19cb5)0x000213c0 = "https://www.archlinux.org/"

release_datetime : (*0x19cf6)0x000213c8 = "2020-12-06"

The pd command is used to disassemble code. It accepts a numeric value to specify how many instructions should be disassembled. The pD command is similar but instead of a number of instructions, it decompiles a given number of bytes.

   • d : disassembly N opcodes count of opcodes

   • D : asm.arch disassembler bsize bytes

[0x00404888]> pd 1

;-- entry0:

0x00404888 31ed xor ebp, ebp

The architecture flavor for the disassembler is defined by the asm.arch eval variable. You can use e asm.arch=?? to list all available architectures.

[0x00005310]> e asm.arch=??

_dAe _8_16 6502 LGPL3 6502/NES/C64/Tamagotchi/T-1000 CPU

_dAe _8 8051 PD 8051 Intel CPU

_dA_ _16_32 arc GPL3 Argonaut RISC Core

a___ _16_32_64 arm.as LGPL3 as ARM Assembler (use ARM_AS environment)

adAe _16_32_64 arm BSD Capstone ARM disassembler

_dA_ _16_32_64 arm.gnu GPL3 Acorn RISC Machine CPU

_d__ _16_32 arm.winedbg LGPL2 WineDBG's ARM disassembler