About this project
hwid is a lightweight Python library and command-line tool designed to extract the hardware ID (hwid) of a computer across Windows, Linux, and macOS. It uses native OS detection to retrieve the hardware identifier without requiring any external runtime dependencies.
The project was created by the author to solve a practical problem: licensing desktop applications without distributing them to unauthorized users. By using the computer's hardware ID as a unique identifier, developers can implement licensing systems that tie software to specific machines.
Installation is straightforward via pip (`pip install hwid`), Homebrew on macOS/Linux, or Scoop on Windows. Once installed, the library can be used as a Python module by importing `hwid` and calling `hwid.get_hwid()`, or as a CLI tool by running `hwid` to print the hardware ID, `hwid version` to check the package version, or `hwid info` to display version, Python, and platform information.
Key features include cross-platform support with native OS detection, zero external runtime dependencies, and dual usage as both a module and a CLI tool. The project emphasizes engineering quality with full type hints checked by multiple tools (mypy, basedpyright, ty, pyrefly, zuban), comprehensive linting and formatting with ruff, architecture-contract enforcement with import-linter, pytest testing with coverage reporting, Sphinx documentation with GitHub Pages deployment, and automated CI/CD for testing, building, and publishing across multiple platforms.
Security measures include CodeQL, OpenSSF Scorecard, dependency review, secret scanning with gitleaks, dependency auditing with pip-audit, GitHub Actions static analysis with zizmor, and a CycloneDX SBOM attached to every release. The project also uses uv for dependency management and hatch for building.
The author includes an important warning: hwid should not be used as the sole component of a licensing system. For server-client architectures, the encrypted hwid can be sent to a server for validation, though HTTP requests can be intercepted with tools like mitmproxy. For local licensing, the hwid can be encrypted and stored in a file, with code obfuscation tools like pyarmor recommended to make reverse engineering more difficult.
The project is distributed under the MIT license and is not intended for malicious purposes.
Comments
0 Rating appears after 10 ratings
Sign in to join the discussion.