Created
June 7, 2014 19:25
-
-
Save manugarri/122f17a64ce884d04f92 to your computer and use it in GitHub Desktop.
Change mac address
This file contains 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/env python | |
#Totally copied from http://www.reddit.com/r/Python/comments/27gumv/share_your_helper_scripts/ | |
import os, random | |
def random_mac(): | |
mac = [ 0x00, 0x16, 0x3e, | |
random.randint(0x00, 0x7f), | |
random.randint(0x00, 0xff), | |
random.randint(0x00, 0xff) ] | |
return ':'.join(map(lambda x: "%02x" % x, mac)) | |
if __name__ == '__main__': | |
mac = random_mac() | |
print "Switching en0 to %s..." % mac | |
os.system("sudo ifconfig en0 ether %s" % mac) | |
os.system("ifconfig en0 | grep ether") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment