Learn Something New Every Day
Thomas Ptacek | September 8th, 2005 | Filed Under: Uncategorized
A little known (to me) trick with hexdump(1):
( echo ‘u_char buf[] = {’ && hexdump -ve ‘/1 “0x%.2x,”’ binary.dump && echo && echo ‘};’ ) > foo.c
Makes hexdump print a valid C-language representation of a binary file, suitable for inclusion into a program that, say, replays the the dump with minor (or major) modifications.
I learned something else new today using this trick, but it’ll have to wait for the advisory publication.

