randmac

raw JSON →
0.1 verified Fri May 01 auth: no python maintenance

A simple library to generate random 12-digit MAC addresses. Current version is 0.1, with no active development since 2014.

pip install randmac
error ImportError: No module named randmac
cause Package not installed or installed in wrong environment.
fix
Run 'pip install randmac' in your current Python environment.
error TypeError: 'RandMac' object is not callable
cause Attempting to call the object as a function instead of converting to string.
fix
Use str(mac) to get the MAC address string, e.g., mac_address = str(RandMac()).
gotcha The library has not been updated since 2014 and is purely for generating random MAC addresses. Do not use for network security or production-critical tasks.
fix Consider using more modern or actively maintained libraries if additional MAC address functionality is needed.
gotcha RandMac() generates a new random MAC on each instantiation; there is no method to specify a vendor prefix or OUI. Generated MACs are completely random and may not be valid for real network interfaces.
fix If a specific OUI is required, you need to implement custom logic or use a different library.

Instantiate a RandMac object and convert to string to generate a random MAC address.

from randmac import RandMac

mac = RandMac()
mac_address = str(mac)
print(mac_address)
# Example output: '00:0c:29:1a:2b:3c'