# MacTools
MacTools is a MAC-centric library for aiding in network handling and automation.
Full test coverage and fully type annoted.
## Installation
This is a publicly available library on PyPI and can be installed with:
`pip install mactools`
## Features
### MacAddress
MAC object similar to Python's `ipaddress` library. Performs validation on
creation and allows quick and easy format changing for the user. Accepts
EUI-48 and EUI-64 formats.
#### Usage
Built-in `MacAddress` attributes allow for conversion between the common formats
of either delimiters, decimal, or binary. Such as:
```python
from mactools import MacAddress
mac = MacAddress('00:11:22:AA:BB:CC')
# returns the MAC without an delimiters or spaces
mac.clean
# returns the MAC with period delimiters
mac.period
# returns the decimal/numeric form
mac.decimal
# returns the OUI
mac.oui
```
The full format list includes: clean, colon, period, hyphen, space, oui,
decimal, binary
### OUICache
Local cache of the IEEE OUI MA-L, MA-M, and MA-S registries for quick look-ups without needing to
consistently hit API endpoints for individual queries.
`MacAddress` currently automatically performs the look-up on creation.
The full information is available, including OUI, Vendor, Address, etc.
The cache also contains specific references to commonly defined non-vendor OUIs
such as Multicast, IEEE protocols (STP, LLDP, etc), Locally administered and others.
#### Usage
Intakes a string MAC/OUI or `MacAddress` object for either vendor or full record
from the IEEE OUI MA-L registry. The cache will be built if one is not present
(or if manually prompted) or the version of the code has changed.
```python
from mactools import get_oui_cache
# the `mac` defined above already has the look-up performed and recorded on creation, if the record was found
vendor = mac.vendor
cache = get_oui_cache()
oui = '01000C'
# These methods would also work with the `mac` defined above as well
vendor = cache.get_vendor(oui)
```
`vendor` will be the string of vendor registered to IEEE.
It will also identify common protocol MACs (such as Spanning Tree, Cisco/Extreme, etc.) and randomized MACs (locally administered).
## License
This project is under the MIT license (see the LICENSE file for full text).
Raw data
{
"_id": null,
"home_page": null,
"name": "MacTools",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": "python, networking, network, mac, oui, ieee",
"author": "Michael Buckley",
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/41/d6/f8ac0e9022ceefdff1e6a98cf9ad94bbf1062adfb21c1b59439fe7b17ec1/MacTools-1.4.0.tar.gz",
"platform": null,
"description": "# MacTools\n\nMacTools is a MAC-centric library for aiding in network handling and automation.\n\nFull test coverage and fully type annoted.\n\n## Installation\n\nThis is a publicly available library on PyPI and can be installed with:\n\n`pip install mactools`\n\n## Features\n\n### MacAddress\n\nMAC object similar to Python's `ipaddress` library. Performs validation on\ncreation and allows quick and easy format changing for the user. Accepts\nEUI-48 and EUI-64 formats.\n\n#### Usage\n\nBuilt-in `MacAddress` attributes allow for conversion between the common formats\nof either delimiters, decimal, or binary. Such as:\n\n```python\nfrom mactools import MacAddress\nmac = MacAddress('00:11:22:AA:BB:CC')\n\n# returns the MAC without an delimiters or spaces\nmac.clean\n\n# returns the MAC with period delimiters\nmac.period\n\n# returns the decimal/numeric form\nmac.decimal\n\n# returns the OUI\nmac.oui\n```\n\nThe full format list includes: clean, colon, period, hyphen, space, oui,\ndecimal, binary\n\n### OUICache\n\nLocal cache of the IEEE OUI MA-L, MA-M, and MA-S registries for quick look-ups without needing to\nconsistently hit API endpoints for individual queries.\n\n`MacAddress` currently automatically performs the look-up on creation.\n\nThe full information is available, including OUI, Vendor, Address, etc.\n\nThe cache also contains specific references to commonly defined non-vendor OUIs\nsuch as Multicast, IEEE protocols (STP, LLDP, etc), Locally administered and others.\n\n#### Usage\n\nIntakes a string MAC/OUI or `MacAddress` object for either vendor or full record\nfrom the IEEE OUI MA-L registry. The cache will be built if one is not present\n(or if manually prompted) or the version of the code has changed.\n\n```python\nfrom mactools import get_oui_cache\n\n# the `mac` defined above already has the look-up performed and recorded on creation, if the record was found\n\nvendor = mac.vendor\n\ncache = get_oui_cache()\noui = '01000C'\n\n# These methods would also work with the `mac` defined above as well \nvendor = cache.get_vendor(oui)\n```\n\n`vendor` will be the string of vendor registered to IEEE.\nIt will also identify common protocol MACs (such as Spanning Tree, Cisco/Extreme, etc.) and randomized MACs (locally administered).\n\n## License\n\nThis project is under the MIT license (see the LICENSE file for full text).\n\n",
"bugtrack_url": null,
"license": null,
"summary": "('MAC Address-focused library similar to `ipaddress`',)",
"version": "1.4.0",
"project_urls": null,
"split_keywords": [
"python",
" networking",
" network",
" mac",
" oui",
" ieee"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "0dc22f01d10541c2340ea5729a5c32787beb8812b66cc9cde6f704ff2a791001",
"md5": "069e60067f60ac8aee1958f63e8f5689",
"sha256": "0e4183c2b1e11ecf3b34e843eeb27d5def7f77c5ad6faf204924923541d2e081"
},
"downloads": -1,
"filename": "MacTools-1.4.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "069e60067f60ac8aee1958f63e8f5689",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 1549772,
"upload_time": "2024-04-06T12:52:55",
"upload_time_iso_8601": "2024-04-06T12:52:55.602304Z",
"url": "https://files.pythonhosted.org/packages/0d/c2/2f01d10541c2340ea5729a5c32787beb8812b66cc9cde6f704ff2a791001/MacTools-1.4.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "41d6f8ac0e9022ceefdff1e6a98cf9ad94bbf1062adfb21c1b59439fe7b17ec1",
"md5": "ec276d6c10948b06550e6e90dbc06341",
"sha256": "8c962d2acb091b64568f137e07710ab07b97cf2bc3779babd592d9643b47e0ca"
},
"downloads": -1,
"filename": "MacTools-1.4.0.tar.gz",
"has_sig": false,
"md5_digest": "ec276d6c10948b06550e6e90dbc06341",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 1538176,
"upload_time": "2024-04-06T12:52:57",
"upload_time_iso_8601": "2024-04-06T12:52:57.771892Z",
"url": "https://files.pythonhosted.org/packages/41/d6/f8ac0e9022ceefdff1e6a98cf9ad94bbf1062adfb21c1b59439fe7b17ec1/MacTools-1.4.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-04-06 12:52:57",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "mactools"
}