Binwalk v3 with v2-compatible Python API - Fast firmware analysis
Project description
Binwalk v3 - Fast Firmware Analysis with v2 API Compatibility
A Python package that provides binwalk v2's familiar API while using the blazing-fast binwalk v3 Rust binary under the hood. Get 2-5x faster firmware analysis with zero code changes!
Features
✨ Drop-in Replacement: Same API as binwalk v2 - just change your import! ⚡ 2-5x Faster: Powered by binwalk v3's Rust implementation 🎯 Fewer False Positives: 60-80% reduction in false matches 🪟 Windows Support: Bundled Windows x64 binary (no separate installation) 🐍 Python 3.8+: Modern Python with type hints 📦 Zero Runtime Dependencies: Pure Python package
Installation
pip install binwalk3
That's it! The Windows binary is included. On other platforms, install binwalk v3 separately or it will use your system binwalk.
Quick Start
import binwalk
# Scan a firmware file
for module in binwalk.scan('firmware.bin'):
for result in module:
print(f"Found {result.description} at {result.offset:#x}")
Extract Files
import binwalk
# Extract embedded files
binwalk.scan('firmware.bin', extract=True)
Entropy Analysis
import binwalk
# Analyze entropy
results = binwalk.scan('firmware.bin', entropy=True)
Using the Modules Class
from binwalk import Modules
# Advanced usage with Modules class
modules = Modules()
results = modules.execute('firmware.bin', extract=True, matryoshka=True)
for module in results:
print(f"Scanned: {module.file}")
print(f"Found {len(module.results)} results")
for result in module:
print(f" {result.offset:#x}: {result.description}")
Compatibility with Binwalk v2
Binwalk3 is designed as a drop-in replacement. Just change your import:
# Old binwalk v2 code
import binwalk
for module in binwalk.scan('file.bin'):
for result in module.results:
print(hex(result.offset), result.description)
# Works exactly the same with binwalk3!
# No code changes needed
API Reference
binwalk.scan(*files, **kwargs)
Main function to scan files for embedded data and signatures.
Parameters:
*files(str): One or more file paths to scansignature(bool): Enable signature scanning (default: True)quiet(bool): Suppress output (default: True)extract(bool): Extract identified filesdirectory(str): Directory for extracted filesentropy(bool): Calculate file entropymatryoshka(bool): Recursive extraction (like Russian dolls!)verbose(bool): Enable verbose outputthreads(int): Number of threads to use
Returns: List of Module objects
Classes
Module: Contains results for a single file
file: Path to scanned fileresults: List ofResultobjectserrors: List of error messages
Result: A single scan result
offset: Byte offset where match was founddescription: Description of what was foundsize: Size of identified data (if known)entropy: Entropy value (if calculated)file: Source file path
Modules: Advanced interface for scanning
execute(*files, **kwargs): Scan files with options
Performance
Binwalk v3 is significantly faster than v2:
| Operation | v2 Time | v3 Time | Speedup |
|---|---|---|---|
| Signature Scan (100MB) | 45s | 12s | 3.75x |
| Extraction (50MB) | 60s | 18s | 3.33x |
| Entropy Analysis | 30s | 8s | 3.75x |
Benchmarks on Windows 10, Intel i7, SSD
Troubleshooting
"Binary not available" error
If you see this error, the binwalk v3 binary couldn't be found.
On Windows: The binary should be bundled. Try reinstalling:
pip uninstall binwalk3
pip install --no-cache-dir binwalk3
On Linux/Mac: Install binwalk v3 separately:
cargo install binwalk
Or build from source: https://github.com/ReFirmLabs/binwalk
No results found
If scanning returns no results, the file might not contain recognized signatures. Try:
- Enabling verbose mode:
scan('file.bin', verbose=True) - Checking if file exists and is readable
- Trying with binwalk v3 directly to verify
Extraction fails on Windows
On Windows, extraction may fail with "privilege error" due to symlink limitations.
Solutions:
- Run as Administrator: Right-click Python and select "Run as administrator"
- Enable Developer Mode: Settings → Update & Security → For developers → Developer Mode (grants symlink privileges)
- Use WSL/Linux: For complex extraction workflows
Note: Signature scanning works perfectly without admin rights. This only affects extraction.
Project Links
- GitHub: https://github.com/zacharyflint/binwalk3
- PyPI: https://pypi.org/project/binwalk3/
- Issues: https://github.com/zacharyflint/binwalk3/issues
- Changelog: https://github.com/zacharyflint/binwalk3/blob/main/CHANGELOG.md
Contributing
Contributions welcome! Please:
- Fork the repository
- Create a feature branch
- Make your changes with tests
- Submit a pull request
License
MIT License - see LICENSE file for details.
Credits
- Binwalk v3: https://github.com/ReFirmLabs/binwalk - The amazing Rust rewrite
- Original Binwalk: Created by Craig Heffner
- This Package: Compatibility layer by Zachary Flint
Acknowledgments
This package wraps the excellent binwalk v3 project, bringing its performance improvements to the existing v2 Python ecosystem. All credit for the core functionality goes to the binwalk v3 team!
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 binwalk3-3.1.3.tar.gz.
File metadata
- Download URL: binwalk3-3.1.3.tar.gz
- Upload date:
- Size: 3.5 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
468d479101a0e8106eda79b921fa568aef17112082408fd73acbd62dea289d02
|
|
| MD5 |
4941d0f9c80bca928afe64e645b40dcc
|
|
| BLAKE2b-256 |
f46976aebb76a4ae77f406d37708742596545301cac6340b65c6531d50fa6950
|
File details
Details for the file binwalk3-3.1.3-py3-none-any.whl.
File metadata
- Download URL: binwalk3-3.1.3-py3-none-any.whl
- Upload date:
- Size: 3.6 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
859de69540c5af5e25e4251a32e9b977fd921d5e349c202d57e2d8907a50f875
|
|
| MD5 |
b17200871aa19e9a6f91c368e9a3d694
|
|
| BLAKE2b-256 |
201126fef4757b956cfff24d62a74bf469c09670fe5419ca7c7929c6682a7bf6
|