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 

# This next part should be apparent. Fills in the mac with random hex 
for i in range(5): 
   mac += ":%02x" % random.randrange(256)
changer = "sudo ifconfig eth1 hw ether " + 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.