Skip to content

Installation

hwntools needs Python 3.10 or newer and runs on Linux, macOS and Windows (the pseudo-terminal simulator, PtyBridge, is POSIX only).

pip install hwntools            # core: zero third-party dependencies
pip install "hwntools[serial]"  # + pyserial for real serial ports

The core (tubes over TCP and processes, the U-Boot and Linux shell helpers, the OpenOCD client, firmware analysis and the utilities) imports without any extra packages. Installing the package also puts the hwn command on your PATH.

Extras

Extra Pulls in Needed for
serial pyserial serial() / serialtube, hwn uboot ..., hwn autobaud, PtyBridge
all pyserial everything that is pip-installable and light
dev pytest, ruff, mypy, build, twine, ... development (see Contributing)
docs MkDocs Material, mkdocstrings building this documentation site

Optional external programs

hwntools never installs or downloads these for you. They are used when present:

Program Used by
flashrom Flashrom (SPI flash read/write)
openocd OpenOCD; you start OpenOCD yourself, hwntools connects to its TCL RPC port
unblob (native, or the ghcr.io/onekey-sec/unblob Docker image) firmware.unpack()
binwalk (v2 or v3) firmware.unpack() fallback
unsquashfs, ubireader_extract_files, jefferson SquashFS, UBI and JFFS2 in the built-in extractor
fwsift, bootlint, baudhound, mcpwarden firmware.analyze() and hwntools.tools

The Reflex Rust tools

fwsift, bootlint, baudhound and mcpwarden are standalone Rust command-line tools from Reflex Hardware Security. They are not on crates.io yet, so install them from their Git repositories with a Rust toolchain:

cargo install --git https://github.com/reflex-hs/fwsift
cargo install --git https://github.com/reflex-hs/bootlint
cargo install --git https://github.com/reflex-hs/baudhound
cargo install --git https://github.com/reflex-hs/mcpwarden

hwntools finds each binary through $HWNTOOLS_<NAME> (for example HWNTOOLS_FWSIFT, the path to the executable), then PATH, then ~/.cargo/bin (or $CARGO_HOME/bin).

Check the installation

$ hwn --version
hwntools 0.3.0
$ python -c "import hwntools; print(hwntools.__version__)"
0.3.0

Next: try everything against the simulator, no hardware needed.