Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

💼 Change your MAC address for debugging

NotificationsYou must be signed in to change notification settings

feross/SpoofMAC

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NOTE: Consider usingspoof, a node.js port of this package.

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

I made this because changing your MAC address in Mac OS X is harder than itshould be. The biggest annoyance is that the Wi-Fi card (Airport) needs to bemanually disassociated from any connected networks in order for the changeto 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 addressin one command.Now for Windows and Linux, too!

Note for Windows 10: While it may appear that this script does not work anymore, it does. The reason for this is that the change only appears in the Network Adapter properties in the Control Panel. Commands such as getmac or ipconfig will still show the original MAC address even though it has been changed. (Note: this actually appears to depend on the NIC (Network Interface Card). I tested it with my desktop and ipconfig showed the change, however it does not show the change on my laptop)

To see this for yourself, follow the below steps:

  1. Open Control Panel
  2. Click 'Network and Internet'
  3. Click 'Network and Sharing Center'
  4. On the panel to the left, click 'Change adapter settings'
  5. A new window will appear showing all of the network adapters. Right-click the one that is currently active/enabled, and click 'Properties'
  6. Near the top, click the button that says 'Configure'
  7. Another window will open. At the top, click the 'Advanced' tab.
  8. In the list to the left, select either 'Network Address' or 'Locally Administered Address'. This will depend on your system. You should see your MAC address in the text box to the right. This MAC address should change when you run this script on Windows 10. If the text box is empty and 'Not Present' is selected, run the script once to generate a new MAC address and follow the above steps. The 'Value' checkbox should now be selected and there should be a new MAC address in the text box.

Installation

You can install fromPyPI usingpip oreasy_install:

pip install SpoofMACeasy_install SpoofMAC

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

git clone git://github.com/feross/SpoofMAC.gitcd SpoofMACpython 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.

Or, consider usingspoof, a node.js port of this package.

Usage

SpoofMAC installs a command-line script calledspoof-mac.py. You can alwayssee up-to-date usage instructions by typingspoof-mac.py --help.

Examples

Some short usage examples.

List available devices:

spoof-mac.py 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 currentlyset to 70:56:51:BE:B3:02-"Bluetooth PAN" on device"en1"

List available devices, but only those on wifi:

spoof-mac.py 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.py randomize wi-fi

or the device name, such as:

spoof-mac.py randomize en0

Set device MAC address to something specific(requires root)

spoof-mac.pyset 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'tavailable), you can try setting the MAC address of a device backto its burned-in address usingreset:

spoof-mac.py 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 wantto make change your MAC address and have it persist between restarts, readthe 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

First, make sure SpoofMAC isinstalled. Then, run the following commands in Terminal:

# Download the startup file for launchdcurl https://raw.githubusercontent.com/feross/SpoofMAC/master/misc/local.macspoof.plist> local.macspoof.plist# Customize location of `spoof-mac.py` to match your systemcat local.macspoof.plist| sed"s|/usr/local/bin/spoof-mac.py|`which spoof-mac.py`|"| tee local.macspoof.plist# Copy file to the OS X launchd foldersudo cp local.macspoof.plist /Library/LaunchDaemons# Set file permissionscd /Library/LaunchDaemonssudo chown root:wheel local.macspoof.plistsudo chmod 0644 local.macspoof.plist

By default, the above will randomize your MAC address on computer startup. You can change the command that gets run at startup by editing thelocal.macspoof.plist file.

sudo vim /Library/LaunchDaemons/local.macspoof.plist

Changelog

  • 2.1.1 - Useip command when available, in more situations
  • 2.1.0 - Useip command when available;ifconfig is deprecated on Arch Linux
  • 2.0.6 - Increase MAC address randomness
  • 2.0.5 - Allow 2nd character in MAC address to be a letter

  • 2.0.4 - Warn when trying to use a multicast address
  • 2.0.3 - More Python 2.7 compatibility fixes
  • 2.0.2 - Python 2.7 compatibility fixes
  • 2.0.0 - Python 3 support
  • 1.2.2 - Fix for Ubuntu 14.04
  • 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)

Ports

MIT License

Copyright (c) 2011-2017

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.


[8]ページ先頭

©2009-2025 Movatter.jp