Description
Basic tools to read, format, filter and display hex values
Installation
pip install hexlib
Usage
- The class
HexTwinis a hexadecimal representation of a fileHexTwinreads a file in 16 byte chunks- Each of this chunks is saved as as tuple together with the following information:
- tuple[0] = Offset
- tuple[1] = A bytearray containing the 16 bytes
- tuple[2] = A boolean indicating if the bytes are all zero
- tuple[3] = A boolean indicating if the bytes are all non ASCII values
- The class
Hexdumpformat and printsHexTwininstances
Example
from hexlib.HexTwin import HexTwin
from hexlib.Hexdump import Hexdump
# 1.) HexTwin instance
twin = HexTwin("path/to/file/test.txt")
dump = Hexdump()
# Activates filtering for zero rows
dump.filter(filterZeroRows=True)
dump.printTwin("path/to/result.txt", twin)
# Activates filtering for non-ascii rows (Includes also zero rows)
dump.filter(filterNonAsciiRows=True)
dump.printTwin("path/to/result.txt", twin)
# 2.) Create HexTwin from bytes (Filtering can also be used here)
f = open("path/to/file", "rb")
twinFromBytes = HexTwin.fromBytes(f.read(16))
dumpFromBytes = Hexdump()
dumpfromBytes.printTwin("path/to/bytes-result.txt", twinFromBytes)
# 3.) Create a HexTwin from a offset reading x bytes (Filtering can also be used here)
twinFromOffset = HexTwin.fromOffset("path/to/file.txt", offset=50, noOfBytes=10)
dumpFromOffset = Hexdump()
dumpFromOffset.printTwin("path/to/offset-result.txt", twinFromOffset)
License
MIT
Metadata
Release files for hexlib 2.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| hexlib-2.0.3.tar.gz | 4.2 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| hexlib-2.0.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 9.3 kB
Release files / hexlib-2.0.3.tar.gz
| Download URL | hexlib-2.0.3.tar.gz |
|---|---|
| Size | 4.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
abb9e3a7ba1754e86ee91909dea2b37ef244ca8d6b73ecd03c55042f4d96b27d
|
|
BLAKE2b-256 checksum How to use checksums |
0cc9897d14811ebf507d2fdecd02ab39778a5d9bacec7168f0e1d0d0f4f816f5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.10.6
|
Release files / hexlib-2.0.3-py3-none-any.whl
| Download URL | hexlib-2.0.3-py3-none-any.whl |
|---|---|
| Size | 5.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9b23aacd790ee34729382e6a650b60b09e48f35beafdd60393e8c3f35c0a565e
|
|
BLAKE2b-256 checksum How to use checksums |
9e361d742cbc8039fadd9d1e07a1435d54bd49fce4376389f3b9d1d9066093f7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.10.6
|
Security for hexlib 2.0.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.