Advertisement
infodox

Mac Changer v1.0

Dec 2nd, 2011
186
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.53 KB | None | 0 0
  1. #!/usr/bin/env python
  2. # Python Mac Changer BETA....
  3. # By infodox - credit to Trip from Hak5 for the getmac function, as mine did not work!
  4. import os
  5. import commands
  6. import sys
  7. # Checking are you r00t
  8. def amiroot():
  9.     if os.geteuid() != 0:
  10.         print "[-] sorry, you need to run this as root"
  11.         sys.exit(1)
  12.     else:
  13.         pass
  14.  
  15. def getmac(iface):
  16.     data = commands.getoutput("ifconfig " + iface)
  17.     words = data.split()
  18.     found = 0
  19.     for x in words:
  20.         #print x
  21.         if found != 0:
  22.             mac = x
  23.             break
  24.         if x == "HWaddr":
  25.             found = 1
  26.     if len(mac) == 0:
  27.         mac = 'Mac not found'
  28.     mac = mac[:17]
  29.     print mac
  30.  
  31. print("Welcome to the Pythonized MAC changer v1.0 by infodox")
  32. print("This code is still under development - I have a lot of work to do!")
  33. print("Have fun...")
  34. amiroot()
  35. print("Using GNU macchanger to change your MAC address...")
  36. iface = raw_input("what interface are you changing: ") # Sets the interface to fuck with...
  37. print("[*] Your Current MAC address is: ")
  38. getmac(iface)
  39. print("[+] Putting " + iface + " down") # Nice status report
  40. os.popen("ifconfig " + iface + " down") # Puts interface DOWN
  41. print("[+] Changing your MAC address to something totally random...") # More statuses
  42. os.popen("macchanger --random " + iface) # CHANGES MAC ADDRESS!!!!!!!
  43. print("[+] Putting " + iface + " back up") # Status Report
  44. os.popen("ifconfig " + iface + " up") # Puts interface back up :)
  45. print("[*] Your New MAC address is: ")
  46. getmac(iface)
  47.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement