Skip to main content

randmac.py

a utility that generates 12-digit mac addresses; either the NIC portion or full 12-digit MAC.

the optional -f argument will return a random 12-digit MAC address that can be identified by the locally administrated address (LAA) format. This means you will always see x2, x6, xA, or xE at the beginning of a MAC address generated by randmac.

installation

to install with pip:

pip install randmac

requirements

Python >3.2 required.

mac address formats

Supported MAC address formats:

  • MM:MM:MM:SS:SS:SS
  • MM-MM-MM-SS-SS-SS
  • MM.MM.MM.SS.SS.SS
  • MMMM.MMSS.SSSS
  • MMMMMMSSSSSS

where M stands for the manufacturer or vendor, and S stands for the NIC specific portion.

usage

you can from randmac import RandMac and use it like RandMac().

if you wish to change the mac address format. provide a sample mac so randmac knows what the output format should be.

you can from randmac import RandMac and use it like RandMac("0000.0000.0000").

from a terminal (if the the console scripts entry point randmac is in your path and executable) you can use randmac to get a generate a new 12-digit LAA address, or randmac 00:00:00:00:00:00 -p to generate a MAC with the same OUI, but a different NIC portion.

example usage

>>> from randmac import RandMac
>>> RandMac()
'a6:9b:6b:8e:b3:42'
>>> RandMac("00:00:00:00:00:00", True)
'00:00:00:3f:8a:06'
>>> RandMac("0000:0000:0000", True)
'0000007ce662'
>>> RandMac("0000:0000:0000")
'06eb4584d1e3'

or

> randmac
fa:bf:7c:5d:65:3e
> randmac 00-00-00-00-00-00 -p
00-00-00-dd-5f-16

license

license can be found here.

Metadata

Release files for randmac 0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for randmac 0.1
File Size Uploaded
randmac-0.1.tar.gz 5.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for randmac 0.1
File Interpreter ABI Platform
randmac-0.1-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 12.0 kB

Release files / randmac-0.1.tar.gz

Download URL randmac-0.1.tar.gz
Size 5.5 kB
Tags Source
SHA-256 checksum
How to use checksums
5dd6e7ac87bc4d66cb1c2c7e34c3d8bf6cf275ef5b5f0ed9a34e05bc829c3001
BLAKE2b-256 checksum
How to use checksums
16b320d576848fa4fd338a46b8e5eeafce574e57ab649b1f2980fdddaf2b59f8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.7.4

Release files / randmac-0.1-py2.py3-none-any.whl

Download URL randmac-0.1-py2.py3-none-any.whl
Size 6.5 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
d7694f0be05c8d4b76a7da6b2d76d18265e7c3b3f69cfc91c7083ed0390ee56a
BLAKE2b-256 checksum
How to use checksums
d126c0ddab42738dcef6dd563a3186e9fec33acedf2a47c14406fb0812531076
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.7.4

Release history Release notifications | RSS feed

This release

0.1 This release

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page