The Official Radare2 Book | страница 65
the given offset
| pf 10xiz pointer length string Print a size 10 array of
the xiz struct with its field names
| pf 5sqw string quad word Print an array with sqw
struct along with its field names
| pf {integer}? (bifc) Print integer times the
following format (bifc)
| pf [4]w[7]i Print an array of 4 words
and then an array of 7 integers
| pf ic...?i foo bar "(pf xw yo foo)troll" yo Print nested anonymous
structures
| pf ;..x Print value located 6
bytes from current offset
| pf [10]z[3]i[10]Zb Print an fixed size str,
widechar, and var
| pfj +F @ 0x14 Print the content at
given offset with flag
| pf n2 print signed short (2
bytes) value. Use N instead of n for printing unsigned values
| pf [2]? (plop)structname @ 0 Prints an array of
structs
| pf eqew bigWord beef Swap endianness and print
with given labels
| pf.foo rr (eax)reg1 (eip)reg2 Create object referencing
to register values
| pf tt troll plop print time stamps with
labels troll and plop
Some examples are below:
[0x4A13B8C0]> pf i
0x00404888 = 837634441
[0x4A13B8C0]> pf
0x00404888 = 837634432.000000
Valid print code formats for human-readable languages are:
• pc C
• pc* print 'wx' r2 commands
• pch C half-words (2 byte)
• pcw C words (4 byte)
• pcd C dwords (8 byte)
• pci C array of bytes with instructions
• pca GAS .byte blob
• pcA .bytes with instructions in comments
• pcs string
• pcS shellscript that reconstructs the bin
• pcj json
• pcJ javascript
• pco Objective-C
• pcp python
• pck kotlin
• pcr rust
• pcv JaVa
• pcV V (vlang.io)
• pcy yara
• pcz Swift
If we need to create a .c file containing a binary blob, use the pc command, that creates this output. The default size is like in many other commands: the block size, which can be changed with the b command.
We can also just temporarily override this block size by expressing it as an argument.
[0xB7F8E810]>
pc 32
#define _BUFFER_SIZE 32
unsigned char buffer[_BUFFER_SIZE] = {
0x89, 0xe0, 0xe8, 0x49, 0x02, 0x00, 0x00, 0x89, 0xc7, 0xe8, 0xe2, 0xff,
0xff, 0xff, 0x81, 0xc3, 0xd6, 0xa7, 0x01, 0x00, 0x8b, 0x83, 0x00, 0xff,