Created
January 17, 2013 07:14
-
-
Save kevinwallace/4554285 to your computer and use it in GitHub Desktop.
Startup script to set a random MAC address at boot. Usage: sudo mkdir /Library/StartupItems/SpoofMAC
sudo cp SpoofMAC StartupParameters.plist /Library/StartupItems/SpoofMAC
cd /Library/StartupItems/SpoofMAC
sudo chown root:wheel SpoofMAC StartupParameters.plist
sudo chmod 0755 SpoofMAC
sudo chmod 0644 StartupParameters.plist Modified from https:…
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
. /etc/rc.common | |
StartService () | |
{ | |
ConsoleMessage "Running SpoofMAC script." | |
/usr/sbin/networksetup -setairportpower en0 on | |
/System/Library/PrivateFrameworks/Apple80211.framework/Resources/airport -z | |
/sbin/ifconfig en0 ether `python -c 'import random;print ":".join("%02x" % octet for octet in [random.randint(0,64) << 2] + [random.randint(0,127) for _ in range(5)])'` | |
/usr/sbin/networksetup -detectnewhardware | |
} | |
StopService () | |
{ | |
return 0 | |
} | |
RestartService () | |
{ | |
return 0 | |
} | |
RunService "$1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
Description = "SpoofMAC"; | |
Provides = ("SpoofMAC"); | |
Requires = ("Network", "Disks"); | |
OrderPreference = "None"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment