Git Product home page Git Product logo

spoofmac's Introduction

SpoofMAC - Easily spoof your MAC address

For OS X, Windows, and Linux (most flavors)

I made this because changing your MAC address in Mac OS X is harder than it should be. The biggest annoyance is that the Wi-Fi card (Airport) needs to be manually disassociated from any connected networks in order for the change to be applied correctly. Doing this manually every time is tedious and lame.

Instead of doing that, just run this Python script and change your MAC address in one command. Now for Windows and Linux, too!

Installation

You can install from PyPI using pip or easy_install:

pip install SpoofMAC
easy_install SpoofMAC

or clone/download the repository and install with setup.py. Ex:

git clone git://github.com/feross/SpoofMAC.git
cd SpoofMAC
python setup.py install

If you're not using the system Python (because you use Homebrew, for example), make sure you add '/usr/local/share/python/' (or equivalent) to your path.

Usage

SpoofMAC installs a command-line script called spoof-mac. You can always see up-to-date usage instructions by typing spoof-mac --help.

Examples

Some short usage examples.

List available devices:

spoof-mac list
- "Ethernet" on device "en0" with MAC address 70:56:51:BE:B3:00
- "Wi-Fi" on device "en1" with MAC address 70:56:51:BE:B3:01 currently set to 70:56:51:BE:B3:02
- "Bluetooth PAN" on device "en1"

List available devices, but only those on wifi:

spoof-mac list --wifi
- "Wi-Fi" on device "en0" with MAC address 70:56:51:BE:B3:6F

Randomize MAC address (requires root)

You can use the hardware port name, such as:

spoof-mac randomize wi-fi

or the device name, such as:

spoof-mac randomize en0

Set device MAC address to something specific (requires root)

spoof-mac set 00:00:00:00:00:00 en0

Reset device to its original MAC address (requires root)

While not always possible (because the original physical MAC isn't available), you can try setting the MAC address of a device back to its burned-in address using reset:

spoof-mac reset wi-fi

(older versions of OS X may call it "airport" instead of "wi-fi")

Another option to reset your MAC address is to simply restart your computer. OS X doesn't store changes to your MAC address between restarts. If you want to make change your MAC address and have it persist between restarts, read the next section.

Optional: Run automatically at startup

OS X doesn't let you permanently change your MAC address. Every time you restart your computer, your address gets reset back to whatever it was before. Fortunately, SpoofMAC can easily be set to run at startup time so your computer will always have the MAC address you want.

Startup Installation Instructions

Run the following commands in Terminal:

# Clone the code
mkdir ~/Scripts
git clone https://github.com/feross/SpoofMAC.git ~/Scripts/SpoofMAC

# Copy files to the OS X startup folder
cd ~/Scripts/SpoofMAC
sudo mkdir /Library/StartupItems/SpoofMAC
sudo cp misc/SpoofMAC misc/StartupParameters.plist /Library/StartupItems/SpoofMAC

# Set file permissions
cd /Library/StartupItems/SpoofMAC
sudo chown root:wheel SpoofMAC StartupParameters.plist
sudo chmod 0755 SpoofMAC
sudo chmod 0644 StartupParameters.plist

# Delete
rm -rf ~/Scripts/SpoofMAC

By default, the above will randomize your MAC address on computer startup. You can change the command that gets run at startup by editing the /Library/StartupItems/SpoofMAC/SpoofMAC file.

sudo vim /Library/StartupItems/SpoofMAC/SpoofMAC

Changelog

  • 1.2.1 - Fix line endings (dos2unix)
  • 1.2.0 - Add Windows and Linux support (thanks CJ!)
  • 1.1.1 - Fix "ValueError: too many values to unpack" error
  • 1.1.0 - Fix regression: List command now shows current MAC address
  • 1.0.0 - Complete rewrite to conform to PEP8 (thanks Tyler!)
  • 0.0.0 - Original version (by Feross)

Contributors

Improvements welcome! (please add yourself to the list)

MIT License

Copyright (c) 2011-2013

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

spoofmac's People

Contributors

cjbarker avatar feross avatar joostrijneveld avatar orangewarp avatar tktech avatar zachorr avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.