bindiffscript
Project description
bindiffscript
Fancy diff tool for reverse engineering binary files using a scripted approach.
Most important difference to most other binary diff tools is the ability to add artificial insertions (padding) in order to align as similar parts of compared files as possible. Also, instead of modifying dozens of command line arguments you write a YAML based script which describes how you compare the provided files and how to view the content.
This screenshot is the result of the following diff-script:
#!/usr/bin/env bindiffscript
width: 8
context: 2
colors: ["green", "red bold"]
format: "%d-%x-%a"
files:
- path: ${here}/00reverse-1-init.xy
- path: ${here}/00reverse-2-metro-off.xy
padding:
- [10, 4, 0]
- [4221, 13, 0]
Install and use
You can either install bindiffscript via pipx
# have pipx installed first
pipx install bindiffscript
bindiffscript ...
.. simply run it via uvx provided by the uv package
# have uv installed first
uvx bindiffscript ...
.. or checkout the project and run it via uv run
# have git and uv installed first
git clone https://github.com/frans-fuerst/bindiffscript.git
cd bindiffscript
uv run bindiffscript ...
With all approaches you get an entry point bindiffscript with the
following syntax:
bindiffscript [<opts>..] <FILE>*
Since <FILE> can be a YAML file containing options and files to diff, you
can set a shebang to bindiffscript and make it executable:
#!/usr/bin/env bindiffscript
files:
- path: path/to/file1.txt
- path: path/to/file2.txt
.. which is the same as running bindiffscript example.yaml.
See the examples folder for syntax and inspiration!
Contribution
Initialize
git clone https://github.com/frans-fuerst/bindiffscript.git
cd bindiffscript
uv run pre-commit install
Manually run checks and fixes
# run all checks which would be executed on commit, but on unstaged stuff, too
uv run pre-commit run --hook-stage pre-commit --all-files
# run all type checking (mypy) on current (unstaged) state
uv run pre-commit run check-python-typing --all-files
uv run pre-commit run check-python-linting --all-files
uv run pre-commit run check-python-format --all-files
uv run pre-commit run check-python-isort --all-files
uv run pre-commit run check-python-unittest --all-files
uv run pre-commit run check-python-doctest --all-files
uv run pre-commit run check-yaml-linting --all-files
# these will modify the source code by applying formatting and linter rules
uv run pre-commit run fix-python-linting --hook-stage manual --all-files
uv run pre-commit run fix-python-format --hook-stage manual --all-files
uv run pre-commit run fix-python-isort --hook-stage manual --all-files
implement -> uv run pytest -> commit -> repeat
Publish to pypi.org
uv version --bump <patch|minor|major>
uv build
# manual tests
git push
uv publish --token <TOKEN>
Wishlist
- Readme
- Make width configurable via
widthattribute or command line option - Allow to specify padding value
- Clip long files via
head - Skip identical lines (i.e. context around differring lines)
- Show padding differently
- Configure cell format
- Show some sort of line number
- Update on change
- Auto-generate padding (through diff algorithms)
- Show multiple files
- Show hex/text side by side
- Highlight special/magic content
- Textual interface with mouse hover and scrolling
- Padding: set to fixed position
- Padding: insert arbitrary data
- Padding: length from macro
- Annotations
- Bash completion
External Sources
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file bindiffscript-0.3.0.tar.gz.
File metadata
- Download URL: bindiffscript-0.3.0.tar.gz
- Upload date:
- Size: 168.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
04373ed27269e165aef8bf406b41aca2315b50cf6304f36658b5a66098aee25e
|
|
| MD5 |
c9f63d48246adb360fa54b51f6013a4c
|
|
| BLAKE2b-256 |
8c8bc72e21a8ec8c76a9f48d0908d6abe9c78db1e30ff61b00501eb9b87d8512
|
File details
Details for the file bindiffscript-0.3.0-py3-none-any.whl.
File metadata
- Download URL: bindiffscript-0.3.0-py3-none-any.whl
- Upload date:
- Size: 6.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
098d7a139c964f91fd7015fd6856041681276b2f0e2430d82dca6d9e4ed9306c
|
|
| MD5 |
e0da7a86dae5b49d897f0087a8b0d7e5
|
|
| BLAKE2b-256 |
5b64ec4b0ddbeccdc587e48e1594b6aae1d4c812f9eb7bb8b0c7acf9773e5b07
|