Async OUI lookups
Maintained. Last release 2 months ago, commits in 2 of the last 26 weeks. Weaker on commit activity and release cadence.
pip install aioouiAsync OUI lookups
Maintained. Last release 2 months ago, commits in 2 of the last 26 weeks. Weaker on commit activity and release cadence.
pip install aioouiSource Code: https://github.com/bluetooth-devices/aiooui
Async OUI lookups
Install this via pip (or your favourite package manager):
pip install aiooui
Start by importing it:
import aiooui
await aiooui.async_load()
aiooui.get_vendor("00:00:00:11:22:33") # "XEROX CORPORATION"
The OUI table (src/aiooui/oui.data, ~40k entries, ~770 KB) is not loaded into a
dict. async_load() memory-maps the file read-only in an executor, and
get_vendor() binary-searches the key array in place with bisect, so the search
itself runs in C. The process keeps almost no private memory for the table
(against ~5.6 MB for a dict). async_load() touches every page once, in the
executor, so lookups on the event loop never wait on disk. Those pages are clean,
shared page cache that the kernel can reclaim under memory pressure. If mmap is
unavailable, the file is read into bytes and searched the same way.
oui.data is a small binary table, all integers little-endian uint32:
| section | contents |
|---|---|
| magic | OUI1 |
| count | number of entries, n |
| keys | n OUIs as 24-bit integers, sorted ascending, unique |
| offsets | n byte offsets of each entry's vendor name inside the blob |
| blob | UTF-8 vendor names, each terminated by \n, deduplicated |
Regenerate it only with python build_oui.py, which downloads the IEEE list,
then validates, sorts and packs the entries. The release build runs it before
packaging, so every release ships fresh data. tests/test_init.py::test_data_file_is_valid fails if the file is out of
order or malformed. An unsorted key array would make lookups silently return
None.
Thanks goes to these wonderful people (emoji key):
This project follows the all-contributors specification. Contributions of any kind welcome!
This package was created with Copier and the browniebroke/pypackage-template project template.
Use instead of aiooui: tools that do the same job, closest first.
Compare with mac-vendor-lookup →
Find the vendor for a given MAC address