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.1.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.1-py3-none-any.whl (6.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pyoui-1.0.1.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.1.tar.gz
Algorithm Hash digest
SHA256 59dad1f195a65466776c7683dc8fe9e518090c2f1e14684ef88c44b262df3a7f
MD5 019647eab118a25bbffcb31132333966
BLAKE2b-256 de6cf785919045c2856079a7e1f4b582d862a9774150acbc39eb7c22628fc855

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyoui-1.0.1.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.1-py3-none-any.whl.

File metadata

  • Download URL: pyoui-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 6.3 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 237fb73a604d7f34bbfd965335fd894e80e10b62bbc3da4f7a5115b540fdf289
MD5 3ba3f62670e3e559e202eeb5c837f864
BLAKE2b-256 9758f82803b5df761887a96159b148d72f61e083d734f381a95bcd189db207a2

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyoui-1.0.1-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