Skip to main content

rawdumper

Rawdumper is a library based on adamlibrary designed to convert hexadecimal code into binary by directly dumping the hexadecimal code in Python, and to analyze hexadecimal data, offering search and reversing support.

This is a library first, CLI second: importing rawdumper never parses argv or touches stdin. The command-line interface is a thin, optional layer on top.

Install

pip install -e .

Library usage

import rawdumper

data = open("file.bin", "rb").read()

# Render a hex dump as text
print(rawdumper.dump(data, width=16))

# Search for a byte pattern
offsets = rawdumper.find(data, b"needle")
print(rawdumper.contains(data, b"needle"))

# Shannon entropy (bits per byte)
print(rawdumper.entropy(data))

# Restore a hex dump back to binary
text = rawdumper.dump(data, squeeze=False)
restored = rawdumper.restore(text)
assert restored == data

Every function in the public API (rawdumper.dump, rawdumper.find, rawdumper.entropy, rawdumper.restore, etc.) is a plain function that takes bytes in and returns a value — no global state, no CLI side effects.

Optional CLI

Installing this package also registers a rawdumper console script, and the package can be run directly as a module:

rawdumper file.bin
python -m rawdumper file.bin --width 8 --find "Wolf" --stats
python -m rawdumper --reverse dump.hex -o restored.bin

CLI flags:

Flag Description
--width N bytes per line (default 16)
--offset N starting offset, 0x.. supported
--length N number of bytes to read
--find TEXT search for a pattern and highlight matching lines
--octal show bytes in octal instead of hex
--no-squeeze disable collapsing of repeated identical lines
--stats print size and Shannon entropy before the dump
--reverse treat input as a hex dump and restore it to binary
-o, --output output path when used with --reverse

What's C-backed and why

Module adamlibrary function used Purpose
rawdumper.core adam.memcpy chunk byte copying
rawdumper.core datasetname.itoa decimal→octal string formation
rawdumper.search memreplication_cutline.memchr byte pattern search
rawdumper.stats math.log Shannon entropy calculation
rawdumper.reverse stringer.strdup owned copy of input before parsing

Package layout

rawdumper/
├── __init__.py    # public API surface (dump, find, entropy, restore, ...)
├── core.py        # dump/format logic
├── search.py      # pattern search
├── stats.py        # entropy
├── reverse.py     # hex-to-binary restore
└── __main__.py    # optional CLI, only runs via `python -m rawdumper` or the console script

Metadata

Release files for rawdumper 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for rawdumper 1.0.0
File Interpreter ABI Platform
rawdumper-1.0.0-py3-none-any.whl Python 3 none any Details

Release files / rawdumper-1.0.0-py3-none-any.whl

Download URL rawdumper-1.0.0-py3-none-any.whl
Size 21.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
851ab5dceb157d44c8999383d1da51f327cf616263a8fc485dff35e8a72dedb5
BLAKE2b-256 checksum
How to use checksums
1c9c64660c6f63c5ceba60eedb4a5b1bba62b400c832c6afa6030a810dd24c74
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.14

Release history Release notifications | RSS feed

This release

1.0.0 This release

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page