Skip to main content

a tool to help in the arcane arts of decoding and reverse engineering binary data

Project description

hexer

Hexer is a cli command (hexer) as well as a markup language (hexer markup) which enables you to decode binary files using your favorite editor.

Install

Either get the latest development version, by cloning the gitlab repo to your system, and then installing with pip:

git clone https://gitlab.com/hexer-py/hexer.git
pip install -e hexer

Or install the latest release with pip:

pip install hexer-hx

You should now have access to the hexer command

Usage

To get help, use the -h option

hexer -h

To start decoding a theoretical file named something.bin, run:

hexer something.bin

This will output hexer markup to another theoretical file named something.bin.hx.

something.bin.hx will look very much like the output from hexdump -C:

0: 0100 0000 0200 0000 0300 0000 1000 # <..............>

You can now open the something.bin.hx file in any text editor and start replacing the hex data with other hexer markup.

For instance, to tell hexer that the data has 3 long integers followed by a short integer, you replace the file contents with:

0: L*3H

When you now re-run the hexer command, it will instead read the content of the something.bin.hx file and use the hexer markup to decode the something.bin file.

While doing this, it will also output the decoded data back into the something.bin.hx file (via a temporary file named something.bin.hx.out).

Giving you the following:

0: LLLH[1,2,3,16]

Repeating the above workflow allows you to progressively decode your binary file as you discover more and more about how it's structured.

Other useful hexer markup features, such as macros and variables, make it easy for you to decode more complex files:

<=string>B{s}S{v}*{s}</string>
00: <string name>B{s}[9]S{v}*{s}"Something"</string>
0a: <string date>B{s}[10]S{v}*{s}"2020-08-16"</string>

You can even tell hexer to output any decoded variables as a json object, by using the -j option:

hexer -j strings.bin > strings.json

hexer markup

To find out more about the hexer markup syntax, please refer to the documentation repo.

Note that the syntax might change during the development phase of this project. Check back to the docs if you are experiencing syntax errors after an update.

Warning about large files

Be careful running hexer on larger files since the hexer output will take up well over twice the amount of space as the original file. This could cause memory or disk space issues in some cases. If you really need to decode a huge file, then consider splitting it up into smaller more manageable chunks, or finding a smaller file in the same format.

Bugs

Please report any bugs using the gitlab issue tracker.

Contributing

Any help is appreciated, so feel free to create a merge request. If you want to do a change the syntax, then please create a merge request in the documentation repo as well.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

hexer-hx-0.0.2.tar.gz (12.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

hexer_hx-0.0.2-py3-none-any.whl (11.4 kB view details)

Uploaded Python 3

File details

Details for the file hexer-hx-0.0.2.tar.gz.

File metadata

  • Download URL: hexer-hx-0.0.2.tar.gz
  • Upload date:
  • Size: 12.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.1 CPython/3.9.6

File hashes

Hashes for hexer-hx-0.0.2.tar.gz
Algorithm Hash digest
SHA256 e4960d3de1adf19ee23be1d56e29e61f564c4c92c6b473055f916f251e5910af
MD5 54621580683ea687a6c3f6fc380c223c
BLAKE2b-256 603489e943a12d9f2baff10a9ee504a1d65f2cd0037120c6e01e00ca99e7710d

See more details on using hashes here.

File details

Details for the file hexer_hx-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: hexer_hx-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 11.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.1 CPython/3.9.6

File hashes

Hashes for hexer_hx-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 07aed2b350ba60d317857b2805e637f9a8d925ef34b13337f1712fe400b9e588
MD5 7c0155441b69edb47640b88f0aefbde0
BLAKE2b-256 9bcd40a66b7db4c632d78cd9025c812ed3fb3375386a2e3612e5fe7b5f75d4c4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page