Created
May 10, 2014 11:08
-
-
Save nboubakr/c3a6e3edf04b8c6be113 to your computer and use it in GitHub Desktop.
Generate a random MAC Address using the VM OUI code.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random | |
def generate_random_mac_address(): | |
"""Generate a random MAC Address using the VM OUI code""" | |
rand_mac_addr = [0x00, 0x50, 0x56, random.randint(0x00, 0x7f), random.randint(0x00, 0xff), random.randint(0x00, 0xff)] | |
return ':'.join(map(lambda x: "%02x" % x, rand_mac_addr)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment