Random mac address generator using Python

total_random() – Procedurely generated MAC address, using random function.
vid_file_random(file) – uses random line from wireshark’s manuf file.
vid_file_vendor(file, vendor name, desc=optional) – specify a vendor name, uses wireshark’s manuf file instead of being completely random.
import random

def generate_random_mac():
mac = [random.randint(0x00, 0xff) for _ in range(6)]
mac_str = ‘:’.join(map(lambda x: ‘%02x’ % x, mac))
return mac_str

if __name__ == “__main__”:
random_mac = generate_random_mac()
print(“Random MAC address:”, random_mac)

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top