Find the vendor for a given MAC address
Project description
Mac Vendor Lookup
This library provides an easy way to get vendor information from a MAC address. It contains a local copy of the IEEE's OUI prefix list. It has an asynchronous interface using Python 3's asyncio as well as a regular synchronous interface for old-school usage.
Installation
pip install mac-vendor-lookup
Basic Usage
from mac_vendor_lookup import MacLookup
print(MacLookup().lookup("00:80:41:12:FE"))
Output:
VEB KOMBINAT ROBOTRON
Update the vendor list
The library contains a list of MAC prefixes obtained at build-time. If you need up-to-date information, you can
download a fresh copy of the list directly from IEEE with MacLookup.update_vendors
or AsyncMacLookup.update_vendors
:
from mac_vendor_lookup import MacLookup
mac = MacLookup()
mac.update_vendors() # <- This can take a few seconds for the download
def find_mac(mac_address):
print(mac.lookup(mac_address))
Vendor list custom location or path
The library stores and looks for the list of MAC prefixes in a group predefined defaults paths. If a custom
directory is required, then override the class variable cache_path
of class BaseMacLookup(...)
from it default
location of: os.path.expanduser('~/.cache/mac-vendors.txt')
to your prefered location.
from mac_vendor_lookup import MacLookup, BaseMacLookup
BaseMacLookup.cache_path = "/relative/or/absolute/path/to/the/prefered/storage/location"
mac = MacLookup()
mac.update_vendors() # <- This can take a few seconds for the download and it will be stored in the new path
def find_mac(mac_address):
print(mac.lookup(mac_address))
Async Interface
There is also an asynchronous interface available:
from mac_vendor_lookup import AsyncMacLookup
async def main():
mac = AsyncMacLookup()
print(await mac.lookup("98:ED:5C:FF:EE:01"))
Output:
Tesla Motors, Inc
Command line interface
This library provides a rudimentary command line interface:
$ mac_vendor_lookup 50-D3-7F-00-01-00
Yu Fly Mikly Way Science and Technology Co., Ltd.
$ python3 -m mac_vendor_lookup 00:26:12:12:FE
Space Exploration Technologies
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file mac_vendor_lookup-0.1.12.tar.gz
.
File metadata
- Download URL: mac_vendor_lookup-0.1.12.tar.gz
- Upload date:
- Size: 351.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 74e1723e177d4deb02977148d3fa04a7916f4bf93268e2afe3240529272bf80d |
|
MD5 | e9b5c1e6ff59f2712cf737bd50e11a87 |
|
BLAKE2b-256 | 777c2a5ae05d5cdec7f9b9a31d968914da17e716684505b052fd79cf6b30e447 |
File details
Details for the file mac_vendor_lookup-0.1.12-py3-none-any.whl
.
File metadata
- Download URL: mac_vendor_lookup-0.1.12-py3-none-any.whl
- Upload date:
- Size: 350.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.22.0 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.30.0 importlib-metadata/4.10.1 keyring/18.0.1 rfc3986/2.0.0 colorama/0.4.3 CPython/3.8.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | aeec6eac01b07e6558d889b51f475a1e1e938e09cab409a069ab6a43b13cba58 |
|
MD5 | b84b6b54c69dd8a2122a5275e5c0ed9e |
|
BLAKE2b-256 | 1f405332072131832d6dc67847065a0524a965e97d8fc682f071d4af28fbb103 |