Created
October 6, 2017 09:35
-
-
Save Caffe1neAdd1ct/2298eef96f1a87521b3657c675a71dcd to your computer and use it in GitHub Desktop.
Generate mac addresses
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
#!/usr/bin/python | |
# macgen.py script to generate a MAC address for guests on Xen | |
# | |
import random | |
# | |
def randomMAC(): | |
mac = [ 0x00, 0x16, 0x3e, | |
random.randint(0x00, 0x7f), | |
random.randint(0x00, 0xff), | |
random.randint(0x00, 0xff) ] | |
return ':'.join(map(lambda x: "%02x" % x, mac)) | |
# | |
print randomMAC() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment