Hak5
Save 10% at GoDaddy.com with coupon code HAK

MAC Randomizer

From Hak5

Jump to: navigation, search

Contents

[edit] Requirements

  • Linux/Bsd or other flavors of Unix
  • Python
  • For windows, head to Windows headline

[edit] The Script

#!/usr/bin/python 
# mac_spoof.py - Randomizes wireless MAC Address 
# Hacked together for your pleasure by a5an0 

# So far it only works on Linux. Windows version (maybe) coming soon 

import os, random 

mac = "00" # MAC Addressed typically start with 00. Looks more legit 

i=0 
# This next part should be apparent. Fills in the mac with random hex 
while (i<5): 
   mac = mac + ":" + str(hex(random.randint(0,15))[2:]) 
   mac = mac + str(hex(random.randint(0,15))[2:])    
   i = i+1 
changer = "sudo ifconfig eth1 hw ether " + str(mac) 

# Stops network services, assigns new mac, restarts networking 
os.system("sudo /etc/init.d/networking stop") # You may need to change this. 
os.system(changer) 
os.system("sudo /etc/init.d/networking start")

[edit] Notes

  • To run this at startup you can simply put this in startup, or simply run the script when necessary.
  • If your disto's networking scripts are somewhere other than /etc/init.d, then you'll have to change the appropriate lines.

[edit] Windows

Head on over to this page to get the tool to change your mac address in windows.