/ Published in: Python
This python function generates a valid(random(mac address string)) :-)
Expand |
Embed | Plain Text
#! /usr/bin/env python import random def random_mac(): mac = ['00'] for i in xrange(5): octet = random.randint(0, 255) #mac_addr.append(hex(octet)[2:].zfill(2)) mac.append('%02X' % octet) return ':'.join(mac) print random_mac()
You need to login to post a comment.
