Skip to main content

Lookup the IEEE's OUI table by MAC, MAC prefix, organization name, or country

Project description

pyoui

CodeFactor

Installation

  • Pip (users):
    pip install pyoui
    
  • uv (inside your project):
    uv add pyoui
    
  • Install from the main branch:
    pip install git+https://github.com/nbdy/pyoui
    

CLI usage

Run:

pyoui --help

Options:

  • -o, --outfile: file path for the downloaded IEEE OUI text file
  • -d, --debug: enable debug logging
  • -p, --prefix: search by MAC prefix (e.g., 00:22:72)
  • -org, --organization: search by organization name
  • -cc, --country-code: search by 2-letter country code (e.g., US)
  • -cn, --country-name: search by country name (e.g., United States)

Examples:

pyoui -p 00:22:72
pyoui -org "national security"
pyoui -cc US

... use by code:

from pyoui import OUI

entries = OUI(debug=True).parse()

print("entries:", entries.size())

e = next(entries.by_organization("national security"))
print("organization", e.organization.__dict__, e.prefix)

e = next(entries.by_prefix("00:22:72"))
print("prefix", e.organization.__dict__, e.prefix)

e = next(entries.by_mac("BC:23:92:42:42:42"))
print("mac", e.organization.__dict__, e.prefix)

e = list(entries.by_country_code("US"))
print("length:", len(e))
print("first item:", e[0].prefix, e[0].organization.__dict__)

ae = list(entries.by_country_name("United States"))
print("by country code length:", len(e), " | by name length:", len(ae))
print("lengths should be equal")

Development

This project uses uv for dependency management and builds.

  • Create and sync a virtual environment:
    uv venv
    uv sync
    
  • Run tests:
    uv run pytest
    
  • Build the package (sdist and wheel):
    uv build
    
  • Run the CLI without installing:
    uv run pyoui --help
    

Publishing

Releases are published automatically to PyPI via GitHub Actions using PyPI Trusted Publishing.

  • Create a GitHub release (or trigger the workflow manually). Upon a published release, the workflow will:
    • Build the package with uv build.
    • Upload the artifacts to PyPI using pypa/gh-action-pypi-publish with OpenID Connect (OIDC).

To enable trusted publishing, ensure the PyPI project is configured to trust this GitHub repository. See: https://github.com/pypa/gh-action-pypi-publish

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyoui-1.0.0.tar.gz (5.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyoui-1.0.0-py3-none-any.whl (6.2 kB view details)

Uploaded Python 3

File details

Details for the file pyoui-1.0.0.tar.gz.

File metadata

  • Download URL: pyoui-1.0.0.tar.gz
  • Upload date:
  • Size: 5.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pyoui-1.0.0.tar.gz
Algorithm Hash digest
SHA256 d7618b702af910f9f9e1e3636e4c5cd8087e0abcddaa2cb5a7bb84feda2996f6
MD5 fbe2809f4b290ce09edbdee4ff56b9f9
BLAKE2b-256 ee3905a3949891a8521de74d2f65ce14db6da8d86cf7edc1529ec14fe289e55d

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyoui-1.0.0.tar.gz:

Publisher: publish.yml on nbdy/pyoui

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyoui-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: pyoui-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 6.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pyoui-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d29b9dfa8434ad917d8979c3865c84cb9db090db71d7605abbc3ba7ce1e0eaee
MD5 6eba247caf4e7bbdd69966af81b817df
BLAKE2b-256 1bb97bcb531d776865744ca909befdd752fc7c01a508146cdf8bcd46596d2897

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyoui-1.0.0-py3-none-any.whl:

Publisher: publish.yml on nbdy/pyoui

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page