Hex Editing - TechSecCTF/CTF-pwn-tips GitHub Wiki
Oftentimes you'll want to figure out how to edit a binary file. The "right" way to do this is with a good hex editor. (We recommend the 010 hex editor for which you can get a free 30 day trial).
If you're in a constrained environment and just want something quick and fast, a good approach is to use xxd
, which is a command-line tool that outputs an easy-to-read hexdump. We can save the hexdump:
xxd binary_file > binary_file.xxd
and then edit it using whatever hex editor we prefer:
vim binary_file.xxd
and then recover our modified binary using the -r
option:
xxd -r binary_file.xxd > new_binary_file