Skip to main content

hwid

CI Coverage PyPI - Version PyPI - Python Version License Latest Commit

Downloads Downloads/Month Downloads/Week

Extract the hwid on Windows, Linux, Mac. Cross-platform using Python, native OS detection.


Table of Contents

Installation

pip install hwid

Install with Homebrew (macOS/Linux):

brew install hasansezertasan/tap/hwid

Install with Scoop (Windows):

scoop bucket add hasansezertasan https://github.com/hasansezertasan/scoop-bucket
scoop install hasansezertasan/hwid

Verify the installation

The package root is importable after installation:

>>> from hwid import __doc__
>>> isinstance(__doc__, str)
True

Usage

As a Module

import hwid

print(hwid.get_hwid())

As a CLI Tool

The bare command prints the machine's hardware ID:

uvx hwid

Or, once installed, invoke the console script:

hwid            # prints the hardware ID
hwid version    # prints the package version
hwid info       # prints version, Python, and platform information

Motivation

TL;DR I don't want to copy and paste it again...

I have created a bunch of desktop applications for Windows. I needed a way to license my applications for my users to use it without distributing to other people. I decided to use the hwid of the computer to license my applications. I needed a way to get the hwid of the computer, so I created this module. It has only one purpose: getting the hwid of the computer. It is cross-platform and does not require any external dependencies.

Features

Library:

  • Cross-platform (Windows, Linux, macOS) with native OS detection
  • No external runtime dependencies
  • Usable as a module or a CLI

Engineering:

  • Type Safety: Full type hints checked by mypy, basedpyright, ty, pyrefly, and zuban
  • Code Quality: Comprehensive linting and formatting with ruff, plus architecture-contract enforcement with import-linter
  • Testing: pytest with coverage reporting and parallel execution
  • Documentation: Sphinx documentation with the Shibuya theme, GitHub Pages deployment, and live per-PR documentation previews
  • CI/CD: Automated testing, building, and publishing across multiple platforms
  • Security: CodeQL, OpenSSF Scorecard, dependency review, secret scanning (gitleaks), dependency auditing (pip-audit), GitHub Actions static analysis (zizmor — a blocking prek/CI gate plus a Security-tab dashboard, over hardened least-privilege workflows), and a CycloneDX SBOM attached to every release
  • Managed .gitignore: kept in sync with the upstream github/gitignore templates by cobo, with a weekly drift check
  • Modern Python: uv for dependency management, hatch for building

Warning

I do not recommend using this module for licensing purposes all alone. You can use it as a part of your licensing system.

If you are using server-client architecture, you can send the encrypted hwid to the server and check if it is valid. But keep in mind, It's easy to intercept the http requests with mitmproxy or other tools.

If you are using a local licensing system, you can encrypt the hwid and store it in a file. Then you can check if the encrypted hwid is valid. You can use pyarmor to obfuscate your code. It will make it harder to reverse engineer your code. Here is a NeuralNine Tutorial using Oxyry

Development

Clone the repository and cd into the project directory:

git clone https://github.com/hasansezertasan/hwid
cd hwid

The commands below can also be executed using the xc task runner, which combines the usage instructions with the actual commands. Simply run xc, it will popup an interactive menu with all available tasks.

checks

Run all checks to ensure code quality:

uvx "validate-pyproject[all]" pyproject.toml
uvx typos
uvx vulture src
uvx ruff check
uvx taplo lint pyproject.toml
uvx ruff format
uvx taplo format pyproject.toml
uvx mypy src

docs:serve

Serve the documentation locally:

uv run --locked tox run -e docs-server

docs:build

Build the documentation locally:

uv run --locked tox run -e docs-build

Releasing

Versioning and releases are automated with release-please, driven by Conventional Commit PR titles squash-merged into main. release-please maintains a release PR that bumps the version and CHANGELOG.md; merging it tags the release and publishes to PyPI. See the Contributing Guidelines for the commit conventions, and the Repository setup guide for one-time configuration and optional post-launch integrations such as a social preview, downstream packaging, and Repology.

Pause merges that change .github/workflows/, including Renovate action-pin updates, from merging a release PR until the entire Release run finishes. Workflow differences between the release commit and current main can block tag or release creation with a 403 when using GITHUB_TOKEN. See Release recovery for prevention and recovery steps.

For adopting this project's tooling into an existing package, or reconciling a template update with existing project behavior, see the Template updates and Adopting into an existing project sections of REPOSITORY_SETUP.rst. They cover the baseline, workflow and required-check overlap, custom tooling and documentation, and ask for a decision before consequential cleanup. Work through the repository settings and release steps in the same file.

Author

Generated from copier-pyproject.

Disclaimer

This module is not intended to be used for malicious purposes. The author is not responsible for any damage caused by this module. Use at your own risk.

License

hwid is distributed under the terms of the MIT license.

Metadata

Release files for hwid 0.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for hwid 0.4.0
File Size Uploaded Provenance Actions
hwid-0.4.0.tar.gz 39.2 kB With provenance Details for hwid-0.4.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for hwid 0.4.0
File Interpreter ABI Platform Actions
hwid-0.4.0-py3-none-any.whl Python 3 none any Details for hwid-0.4.0-py3-none-any.whl

Total release size: 59.2 kB

Release files / hwid-0.4.0.tar.gz

Download URL hwid-0.4.0.tar.gz
Size 39.2 kB
Tags Source
SHA-256 checksum
How to use checksums
502c7ffd2bd8dfc4cbd50fe9ef8336351e9c19ea75c83e4b8f5c76789e5b4b1b
BLAKE2b-256 checksum
How to use checksums
8a8c80f03e58b2cfd5c96bf3b00dde129f6c58d2f03fc278232e02e432f199ea
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 19, 2026.

Transparency log

Release files / hwid-0.4.0-py3-none-any.whl

Download URL hwid-0.4.0-py3-none-any.whl
Size 19.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4a10138b1554ef0d2e5dfd73db666759340ae09670b211b2379d1f2b0769b411
BLAKE2b-256 checksum
How to use checksums
7e06b9795b5c7ff73a288b5db7e0f6b7f4c7234b5d10b504bc98683420714c9e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 19, 2026.

Transparency log

Security for hwid 0.4.0

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for hwid-0.4.0.tar.gz

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 Nov 19, 2026.

Transparency log

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page