pybinwalk
Python bindings for Binwalk v3, built with PyO3 and maturin.
Provides direct access to binwalk's signature scanning and extraction from Python. Also exposes a C API for use from other languages.
Requirements
- Python >= 3.8
- Rust toolchain (for building from source)
Installation
pip install pybinwalk
To build from source:
pip install maturin
maturin build --release
pip install target/wheels/pybinwalk-*.whl
Wheels
Prebuilt wheels are published via GitHub Actions for:
- macOS: universal2 (arm64 + x86_64)
- Windows: x86_64
- Linux: manylinux (x86_64)
If a wheel isn’t available for your Python/platform, pip will build from source (requires Rust).
Usage
Scan bytes in memory
import pybinwalk
bw = pybinwalk.Binwalk()
data = open("firmware.bin", "rb").read()
for result in bw.scan_bytes(data):
print(f"0x{result.offset:08X} {result.name} {result.description}")
Scan a file from disk
bw = pybinwalk.Binwalk()
for result in bw.scan_path("/path/to/firmware.bin"):
print(f"0x{result.offset:08X} {result.name} {result.description}")
Configure with filters
bw = pybinwalk.Binwalk.configure(
include=["gzip", "squashfs"],
exclude=["jpeg"],
full_search=False,
)
results = bw.scan_path("firmware.bin")
Extract
bw = pybinwalk.Binwalk.configure(
target_file_name="firmware.bin",
output_directory="./extracted",
)
analysis = bw.analyze_path(bw.base_target_file, do_extraction=True)
for sig in analysis.file_map:
print(f"0x{sig.offset:08X} {sig.name}")
for sig_id, extraction in analysis.extractions.items():
print(f"{sig_id}: success={extraction.success}, dir={extraction.output_directory}")
Version
print(pybinwalk.version())
API reference
Binwalk
| Method | Description |
|---|---|
Binwalk() |
Create an instance with default settings. |
Binwalk.configure(...) |
Create an instance with custom options. |
scan_bytes(data: bytes) |
Scan in-memory data. Returns list[SignatureResult]. |
scan_path(file_path: str) |
Scan a file on disk. Returns list[SignatureResult]. |
extract_bytes(data, file_path, file_map) |
Extract from in-memory data using a prior scan result. Returns dict[str, ExtractionResult]. |
analyze_path(target_file, do_extraction) |
Scan and optionally extract a file. Returns AnalysisResults. |
Properties: signature_count, base_target_file, base_output_directory.
Binwalk.configure() parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
target_file_name |
str or None |
None |
Path to target file (required for extraction). |
output_directory |
str or None |
None |
Directory for extracted files. |
include |
list[str] or None |
None |
Only scan for these signature types. |
exclude |
list[str] or None |
None |
Skip these signature types. |
full_search |
bool |
False |
Search all offsets instead of optimized locations. |
SignatureResult
Properties: offset, id, size, name, confidence, description, always_display, extraction_declined, preferred_extractor.
ExtractionResult
Properties: size, success, extractor, do_not_recurse, output_directory.
AnalysisResults
Properties: file_path, file_map (list of SignatureResult), extractions (dict mapping signature id to ExtractionResult).
C API
When built without the python feature (cargo build --release --no-default-features), the library exposes a C-compatible API:
| Function | Description |
|---|---|
bw_scan(data, len) |
Scan a buffer. Returns JSON string. |
bw_scan_with_options(data, len, options_json) |
Scan with filter options. Returns JSON string. |
bw_version() |
Get version info. Returns JSON string. |
bw_list_signatures() |
List available signatures. Returns JSON string. |
bw_free(ptr) |
Free a string returned by any of the above. |
All C API functions return a *mut c_char pointer to a JSON string. The caller must free it with bw_free().
License
MIT
Metadata
Release files for pybinwalk 0.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 | |
|---|---|---|---|
| pybinwalk-0.0.3.tar.gz | 22.0 kB | Details |
Built distributions (wheels)
| File | Reset | |||
|---|---|---|---|---|
| pybinwalk-0.0.3-pp311-pypy311_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl | PyPy 3.11 | PyPy 3.11 7.3 | Linux glibc 2.17+ x86-64 | Details |
| pybinwalk-0.0.3-cp38-abi3-win_amd64.whl | CPython 3.8 | abi3 | Windows x86-64 | Details |
| pybinwalk-0.0.3-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl | CPython 3.8 | abi3 | Linux glibc 2.17+ x86-64 | Details |
| pybinwalk-0.0.3-cp38-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl | CPython 3.8 | abi3 | macOS 10.12+ universal2 (ARM64, x86-64), macOS 11.0+ ARM64, macOS 10.12+ x86-64 | Details |
Total release size: 4.8 MB
Release files / pybinwalk-0.0.3.tar.gz
| Download URL | pybinwalk-0.0.3.tar.gz |
|---|---|
| Size | 22.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
60ae1e619546c04cc89c9c8cfb868c62689d04a19713d693c1217bd31c7dada6
|
|
BLAKE2b-256 checksum How to use checksums |
7bc1db562769805b6a2ecf9f010d26f3bc7a7a684be91c2e25f43f01bc0920d7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Feb 16, 2026.
Transparency logRelease files / pybinwalk-0.0.3-pp311-pypy311_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | pybinwalk-0.0.3-pp311-pypy311_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 1.1 MB |
| Tags | Linux glibc 2.17+ x86-64 PyPy 3.11 PyPy 3.11 7.3 |
|
SHA-256 checksum How to use checksums |
dcfd8f10e5ae902db5afba5a4eb877c538cdbb590e76200d1eeab3c13d83849a
|
|
BLAKE2b-256 checksum How to use checksums |
d202927fc47135d584f841afa5ebb9a8b3f61d084d061cbdef3965e089ab1586
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Feb 16, 2026.
Transparency logRelease files / pybinwalk-0.0.3-cp38-abi3-win_amd64.whl
| Download URL | pybinwalk-0.0.3-cp38-abi3-win_amd64.whl |
|---|---|
| Size | 877.4 kB |
| Tags | CPython 3.8 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
3ef03485c3bfb95178c1f82d47f09d2d4485dfb7eb2ffc67e0a0baf020595b03
|
|
BLAKE2b-256 checksum How to use checksums |
21f6747df92cd7216e7fd3581ddd845eec623b1927308f92a47162e3c1fcaf92
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Feb 16, 2026.
Transparency logRelease files / pybinwalk-0.0.3-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | pybinwalk-0.0.3-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 1.1 MB |
| Tags | CPython 3.8 Linux glibc 2.17+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
bae2e24f5cca1183a34d5ebc24391e6069e6eca3e123d22a4f4cf633dabad4ab
|
|
BLAKE2b-256 checksum How to use checksums |
44bb9b959ae74878e4439518b579a5a6fac0394a1fc75ac0412ca7590e4a905c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Feb 16, 2026.
Transparency logRelease files / pybinwalk-0.0.3-cp38-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
| Download URL | pybinwalk-0.0.3-cp38-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl |
|---|---|
| Size | 1.8 MB |
| Tags | CPython 3.8 abi3 macOS 10.12+ universal2 (ARM64, x86-64) macOS 10.12+ x86-64 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
8559340606bc9c2b8af924c9376e0e0d1a20112583601d9c8b944a303be438c0
|
|
BLAKE2b-256 checksum How to use checksums |
6702f6acf9a4e52641da4cebf4949319b90574c1914fcbc4a821900b5d6095be
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Feb 16, 2026.
Transparency log