/printb

Print in binary file in hexadecimal and characters - 20 per line

Primary LanguageC

printb - print a block of data in hexadecimal and characters

  • Note this application expect the ASCII character set
  • You could use the "od" command but the option are hard and the format not as condense

Useful, if you have a binary file that what to peak inside for strings, special characters and binary paterns

  • 20 characters wide

Usage - these two commands do the same thing

  • cat your-file | printb | pg
  • printb <your-file | pg

Example

$ cat printb | ./printb | head -20                                                                                                          

01 df 00 05 5e b8 53 d5 00 00 14 d4 00 00 00 ce 00 48 10 02 ....^.S..........H..
01 0b 00 01 00 00 07 3c 00 00 03 84 00 00 00 04 20 00 0b 90 .......<............
10 00 01 50 20 00 08 8c 20 00 0b bc 00 02 00 01 00 02 00 02 ...P................
00 04 00 03 00 05 00 03 31 4c 00 00 00 00 00 00 00 00 00 00 ........1L..........
00 00 00 00 00 00 00 00 00 00 00 00 2e 74 65 78 74 00 00 00 .............text...
10 00 01 50 10 00 01 50 00 00 07 3c 00 00 01 50 00 00 10 fc ...P...P...<...P....
00 00 13 54 00 24 00 40 00 00 00 20 2e 64 61 74 61 00 00 00 ...T.$.@.....data...
20 00 08 8c 20 00 08 8c 00 00 03 84 00 00 08 8c 00 00 12 64 ...................d
00 00 00 00 00 18 00 00 00 00 00 40 2e 62 73 73 00 00 00 00 ...........@.bss....
20 00 0c 10 20 00 0c 10 00 00 00 04 00 00 00 00 00 00 00 00 ....................
00 00 00 00 00 00 00 00 00 00 00 80 2e 6c 6f 61 64 65 72 00 .............loader.
00 00 00 00 00 00 00 00 00 00 02 e5 00 00 0c 10 00 00 00 00 ....................
00 00 00 00 00 00 00 00 00 00 10 00 2e 64 65 62 75 67 00 00 .............debug..
00 00 00 00 00 00 00 00 00 00 02 05 00 00 0e f6 00 00 00 00 ....................
00 00 00 00 00 00 00 00 00 00 20 00 00 00 00 00 00 00 00 00 ....................
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ....................
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 80 c2 00 00 ....................
81 42 00 28 3d 20 06 01 2c 06 00 00 7c 6e 1b 78 7c 8f 23 78 .B.(=...,...|n.x|.#x
7c b0 2b 78 82 62 00 2c 3b e2 fc d0 91 c2 00 04 91 e2 00 1c |.+x.b.,;...........
  • I have on some large projects cut the printb() function into the code to allow printing of buffers and messages within the code.