Skip to content

Instantly share code, notes, and snippets.

@stypr stypr/wlan_mac.py
Created Feb 7, 2015

Embed
What would you like to do?
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
You can’t perform that action at this time.