Yes..who would have thought?
Being a vim user, I hoped it would be able to edit hex files. I didn’t know for sure if it can do it or not so I decided to start digging into the manuals. This nice feature of vim has proven to be really important for me lately, now that I’m testing a protocol by modifying valid pcap files.
So, here it goes: first open your pcap file with vim, as you would any other file:
Once inside vim, hit Esc key and type:
– to go into hex mode
After you’re done modifying stuff, hit Esc again and type:
– to return to default visual mode
Note: if you decide to save the modification while in hex mode, the file will now contain the hex data represented as strings (just like copy/pasting the hexa visual data into a new text file). Remember to return to the default visual mode with :%!xxd -r before saving the file!