Skip to content

Instantly share code, notes, and snippets.

@stypr
Created February 7, 2015 06:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stypr/75b0d1320cee4ac77c8d to your computer and use it in GitHub Desktop.
Save stypr/75b0d1320cee4ac77c8d to your computer and use it in GitHub Desktop.
Change WLAN MAC address randomly in OSX
#!/usr/bin/python
import os
import sys
check_root = os.popen("whoami").read().strip()
if check_root == "root":
mac_real = os.popen("ifconfig en0 | grep ether") \
.read().strip().replace("ether ", "")
mac_hex = os.popen("openssl rand -hex 6").read().strip()
mac_fake = ""
for i in range(len(mac_hex)):
if(i % 2 == 1):
mac_fake += mac_hex[i] + ":"
else:
mac_fake += mac_hex[i]
mac_fake = final_data[:-1]
os.system("ifconfig en0 ether " + final_data)
else:
os.system("sudo python wlan_mac.py")
sys.exit()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment