วันศุกร์ที่ 10 ตุลาคม พ.ศ. 2557

 

How to print any strings on GDB.

The good command in order to examine data inside binary is “x” command.




x/[nfu] <address>

Print memory.

n: How many units to print (default 1).
f: Format character
u: Unit.
Unit is one of:
b: Byte
h: Half-word (two bytes)
u: Integer, unsigned decimal.
x: Integer, print as hexadecimal.
w: Word (four bytes)
g: Giant word (eight bytes)

Format

a: Pointer.
c: Read as integer, print as character.
d: Integer, signed decimal.
f: Floating point number.
o: Integer, print as octal.
s: Try to treat as C string.
t: Integer, print as binary.

example

(gdb) x/10sb buffer
0x1f9bb3d4: “”
0x1f9bb3d5: “01\216″
0x1f9bb3d8: “”
0x1f9bb3d9: “34s”
0x1f9bb3dc: “n”
0x1f9bb3de: “I’m hiding in binary”
0x1f9bb3f0: “to”
0x1f9bb3f3: “60”
0x1f9bb3f6: “”
0x1f9bb3f7: “”

ไม่มีความคิดเห็น:

แสดงความคิดเห็น