How to randomize your MAC address on OS X
zdziarski.com
zdziarski.com
https://github.com/feross/SpoofMAC
> spoof-mac randomize en0
spoof-mac reset en0 from random import randint
from os import getenv
from subprocess import call
from sys import argv
if len(argv) > 1:
# get network interface from cmdline parameter
intf = argv[1]
else:
# get network interface from ENVIRONMENT variables
intf = getenv('INTERFACE', '')
if intf:
# generate random mac address
r = lambda: randint(0,255)
randmac = '%02X:%02X:%02X:%02X:%02X:%02X' % (r(),r(),r(),r(),r(),r())
# change mac address
call(["ifconfig", "%s hw ether %s" % (intf, randmac)])
else:
print "Couldn't determine network interface"[1] http://en.wikipedia.org/wiki/MAC_address#Address_details
http://packetsdropped.wordpress.com/2011/01/13/mac-address-u...
But you can collapse that as so or suchlike:
ifconfig eth34 hw ether $(openssl rand 6 | xxd -p | sed 's/\(..\)/\1:/g; s/:$//')
Obviously doing this is wrong anyway but that will do what your script does. from random import randint
from random import choice
from os import getenv
from subprocess import call
from sys import argv
if len(argv) > 1:
# get network interface from cmdline parameter
intf = argv[1]
else:
# get network interface from ENVIRONMENT variables
intf = getenv('INTERFACE', '')
if intf:
# generate random mac address
r = lambda: randint(0,255)
# Universally or Locally Administered Bit and Individual/Group Bit
# See http://packetsdropped.wordpress.com/2011/01/13/
# mac-address-universally-or-locally-administered-bit-and-individualgroup-bit/
sbyte = choice(['%02X' % i for i in range(255) \
if bin(i)[-2] == '0' and \
bin(i)[-1] == '0'])
randmac = sbyte + ':%02X:%02X:%02X:%02X:%02X' % (r(),r(),r(),r(),r())
# change mac address
call(["ifconfig", "%s hw ether %s" % (intf, randmac)])
else:
print "Couldn't determine network interface"[0]https://github.com/alobbs/macchanger [1]https://www.zufallsheld.de/2013/08/07/mac-spoofing-under-lin...
sudo ifconfig en1 ether `openssl rand -hex 6 | sed 's/\(..\)/\1:/g; s/.$//'`
Credit where it's due: http://osxdaily.com/2012/03/01/change-mac-address-os-x/ /opt/local/etc/oui.txt
but the plist runs bash /opt/local/bin/macrandomize.sh
I think one or the other probably needs to be changed, unless I'm missing something here.I would argue that you're far more likely to have stuff already installed in /usr/local than in /opt/local.
Homebrew is currently trendy but there was nothing wrong with MacPorts. Declaring the entire project to be "a terrible idea" is simply ignorant.
(Same goes for the Python solution posted in another comment here).
/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -z
Then you can change MAC-address: ifconfig en0 ether aa:aa:aa:aa:aa:aa[1] http://en.wikipedia.org/wiki/Address_Resolution_Protocol#Exa...
I find it interesting how many people will stumble over this concept. A lot of technically minded people know that a MAC address is a "unique identifier" for the network card. They have that phrase "unique identifier" fixed in their heads and they know that MACs are this. Pull out a question like "why would you want a unique identifier?" and you get a lot of blank looks. It's almost like it's too easy to latch onto a phrase like "unique identifier" and get distracted from its practical purpose. (That thing that tells you whose packet this is.)
MAC addresses are OSI Layer 2, so your one wouldn't normally get passed through to Dropbox's servers.
I'm guessing their client reads in your computer's MAC address and sends it as part of the login?
I wonder if it's possible to spoof it just for their client.
There are some downsides (having to relogin to certain wireless networks every boot) but by-and-large it's worth it.