Hexdump module and script
xd.hexdump provides the core function. It is a generator with the following signature:
(file, offset=0, start=0, stop=None, step=16, sep=’x08’)
where file is a binary file, offset adjusts the address column, start and stop denote how far into the file to start reading and at which byte to stop and step sets how many bytes are displayed per row. sep defaults to backspace but will accept a different character to separate the rows.
xd.hexdump provides another generator that makes use of the above by yielding a
* instead of a duplicate row, omitting
any following repetitions. If this occurs at EOF, the very last row will be shown to indicate just how many duplicates
In the same module are four other functions used by
test_xd.tests that will get the integer base 16 value of
each hex formatted character in a given hexdump.
xd.hexdump.wb may be used to restore a binary file.
To run from the command line,
xd.run_hexdump takes in as many arguments as
xd.hexdump.hexdump_gen, named the same
--compress, and will write to
To test, add binary files to test_xd\test_samples.