Skip to content

Instantly share code, notes, and snippets.

@stypr stypr/
Created Feb 7, 2015

What would you like to do?
Change WLAN MAC address randomly in OSX
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] + ":"
mac_fake += mac_hex[i]
mac_fake = final_data[:-1]
os.system("ifconfig en0 ether " + final_data)
os.system("sudo python")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.