Giter Site home page Giter Site logo

spoof's Introduction

spoof travis npm downloads javascript style guide

Easily spoof your MAC address in macOS, Windows, & Linux!

Node.js port of the popular SpoofMAC Python utility (GitHub: feross/SpoofMAC).

anonymous

Why?

I made this because changing your MAC address on macOS is harder than it should be. The Wi-Fi card needs to be manually disassociated from any connected networks in order for the change to apply correctly – super annoying! Doing this manually each time is tedious and lame.

Instead, just run spoof and change your MAC address in one command.

Now for Windows and Linux, too!

Instructions for beginners

Here are some easy install instructions for complete beginners.

  1. Install node.js (it's a programming platform like Python, Java, etc.)

  2. Open Terminal. Let's use Spotlight to find it.

terminal

  1. Install spoof by typing this command and pressing Enter.
npm install spoof -g

That's it! spoof is installed.

  1. Now, let's print out the help page. Just like before, run this command in Terminal.
spoof --help
  1. Now, let's print out all our network devices.
spoof list
  1. Find the device you want to set or randomize the MAC address for in the list. Wi-Fi is usually called en0 on modern Macs. Then, run this command:
sudo spoof randomize en0

You may need to reconnect to the Wi-Fi hotspot you were connected to. But, that's it! Your MAC address is changed. You can confirm by re-running:

spoof list

Full command list

You can always see up-to-date usage instructions by running spoof --help.

List available devices

spoof 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 Wi-Fi

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

or the device name, such as:

spoof randomize en0

Set device MAC address to something specific (requires root)

spoof set 00:00:00:00:00:00 en0

Reset device to its original MAC address (requires root)

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

spoof reset wi-fi

On macOS, another option to reset your MAC address is to simply restart your computer. macOS doesn't preserve changes to your MAC address between restarts.

Linux support?

Yep!

Linux support requires the ifconfig utility to be installed. It comes pre-installed with most Linux distributions.

Windows support?

Yep!

Automatically randomize MAC address on startup

If you want to set or randomize your MAC address and have it persist between restarts on macOS, consider using the Python version of this program, SpoofMAC, and following the instructions for running automatically on startup.

License

MIT. Copyright Feross Aboukhadijeh.

spoof's People

Contributors

feross avatar greenkeeper[bot] avatar greenkeeperio-bot avatar haroenv avatar kevinji avatar kokarn avatar taoeffect avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

spoof's Issues

How to fix "Error: Could not find device for Wi-Fi" on Windows 11

Hello! I'm not sure if this is the right place to do this but i recently stumbled upon this error a little bit ago on windows 11 even tho this command was working perfectly before. Running spoof list returned devices without a name but with a MAC address and i couldnt do anything to randomize my adapter. I just figured out how to fix it so i thought i'd save you guys the time and effort

  1. Simply open your settings, go to Network & Internet > Advanced Network Settings

  2. Under Network Adapters, find your Wifi Adapter. For me it was the second one.

  3. Click the Dropdown and under "Rename this adapter", rename it to something like wi-fi

  4. Restart your command line and then run spoof list. You should see Wi-Fi come back

  5. Run spoof randomize Wi-Fi or whatever the device name is under that command

I hope this is helpful to anyone. I know nothing about node js so i cant really help much, i kind of just aimlessly stumbled upon a solution after two days. Thank you feross for creating this amazing command, it's saved me a bunch :)

Not changing MAC address

Hi, I was using this for a while now then all of a sudden it won't change the MAC address.
It says it has but it has not changed anything.

I'm using latest version and on macOS 1.13.6

Error: Cannot read property 'forEach' of undefined

Windows 10, node.js 10.9.0

$ spoof list
Error: Cannot read property 'forEach' of undefined

No stack trace, only that message.

$ spoof version
2.0.1

Also:

$ spoof reset wi-fi
Error: Could not find device for wi-fi

$ spoof randomize wi-fi
Error: Could not find device for wi-fi

(Same when using "Wi-Fi" as ID)

My network:

$ ipconfig

Windows IP Configuration


Wireless LAN adapter Local Area Connection* 15:

   Media State . . . . . . . . . . . : Media disconnected
   Connection-specific DNS Suffix  . :

Wireless LAN adapter Local Area Connection* 16:

   Media State . . . . . . . . . . . : Media disconnected
   Connection-specific DNS Suffix  . :

Wireless LAN adapter Wi-Fi:

   Connection-specific DNS Suffix  . : fritz.box
   IPv6 Address. . . . . . . . . . . : 2003:ea:93d0:f500:1850:c080:15ca:a08b
   Temporary IPv6 Address. . . . . . : 2003:ea:93d0:f500:f409:fa1f:aec5:5195
   Link-local IPv6 Address . . . . . : fe80::1850:c080:15ca:a08b%21
   IPv4 Address. . . . . . . . . . . : 192.168.178.28
   Subnet Mask . . . . . . . . . . . : 255.255.255.0
   Default Gateway . . . . . . . . . : fe80::3631:c4ff:fefb:6967%21
                                       192.168.178.1

Ethernet adapter Bluetooth Network Connection 6:

   Media State . . . . . . . . . . . : Media disconnected
   Connection-specific DNS Suffix  . :

Error when using spoof command in Ubuntu 16.04

Error when try to use spoof command in terminal

spoof --help
/usr/local/lib/node_modules/spoof/bin/cmd.js:6
const { stripIndent } = require('common-tags')
      ^

SyntaxError: Unexpected token {
    at exports.runInThisContext (vm.js:53:16)
    at Module._compile (module.js:374:25)
    at Object.Module._extensions..js (module.js:417:10)
    at Module.load (module.js:344:32)
    at Function.Module._load (module.js:301:12)
    at Function.Module.runMain (module.js:442:10)
    at startup (node.js:136:18)
    at node.js:966:3

Request: Randomise MAC after X MB

Hello!

This is a great tool but something that would make it even better is the ability to randomise after X MB is sent and/or received from the server.

An in-range update of standard is breaking the build 🚨

The devDependency standard was updated from 13.0.0 to 13.0.1.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

standard is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • continuous-integration/travis-ci/push: The Travis CI build failed (Details).

Commits

The new version differs by 4 commits.

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

brew formulae question

Q: Is it possible to use this repository as the default brew formulae?

Rather than the default python brew option.

  • label:enhancement
  • label:question

Re-connect to wireless network on Windows

This is mostly a placeholder issue till me or somebody else implements it.

I believe the correct commands are

netsh wlan disconnect
netsh wlan connect name="WIFI-NAME"

Assumption of ifconfig for Linux

Wasn't able to play with this due to its reliance on ifconfig, where I use iproute2.
The equivalent commands to randomize your MAC using iproute2:

ip link set dev eth0 down
ip link set dev eth0 address `hexdump -n3 -e'/3 "00:60:2F" 3/1 ":%02X"' /dev/urandom`
ip link set dev eth0 up

Up to you if this information is useful or not, just putting it out there for others.

Cannot list devices on Linux 20.04

I do no get any output from this tool when I run spoof list on Linux OS.

I've narrowed down the condition it is failing to pass, it is the regular expression for parsing the output of ifconfig.

spoof/index.js

Line 117 in 58dd7de

const result = /(.*?)HWaddr(.*)/mi.exec(output)

Here is the output of `ifconfig`
br-420df7a1a7ee: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        inet 172.27.0.1  netmask 255.255.0.0  broadcast 172.27.255.255
        inet6 fe80::42:10ff:fe81:e45a  prefixlen 64  scopeid 0x20<link>
        ether 02:42:10:81:e4:5a  txqueuelen 0  (Ethernet)
        RX packets 11438  bytes 2596038 (2.5 MB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 17119  bytes 2419291 (2.4 MB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

docker0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        inet 172.17.0.1  netmask 255.255.0.0  broadcast 172.17.255.255
        inet6 fe80::42:efff:fe5b:5ba7  prefixlen 64  scopeid 0x20<link>
        ether 02:42:ef:5b:5b:a7  txqueuelen 0  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 3  bytes 306 (306.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 3953586  bytes 723678103 (723.6 MB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 3953586  bytes 723678103 (723.6 MB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

wlp0s20f3: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.178.35  netmask 255.255.255.0  broadcast 192.168.178.255
        inet6 2001:a61:243f:5101:94c1:c4f1:ccb6:5c1c  prefixlen 64  scopeid 0x0<global>
        inet6 2001:a61:243f:5101:5324:51f6:1c7d:6  prefixlen 64  scopeid 0x0<global>
        inet6 fd00::6adc:ffea:e940:a20c  prefixlen 64  scopeid 0x0<global>
        inet6 fe80::702d:52ab:7674:588d  prefixlen 64  scopeid 0x20<link>
        inet6 fd00::4bd6:4c28:c115:4ef6  prefixlen 64  scopeid 0x0<global>
        ether dc:41:a9:9f:a8:d5  txqueuelen 1000  (Ethernet)
        RX packets 20323810  bytes 13583854451 (13.5 GB)
        RX errors 0  dropped 334652  overruns 0  frame 0
        TX packets 13009338  bytes 7201165364 (7.2 GB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

Do we know why the pattern of (.*?)HWaddr(.*) is expected? Can we improve this parsing?

Package for Debian

Hi Feross,

I have a quick question. I plan to package this software (or SpoofMac) for Debian. Which of these two (this nodejs version or the python version) is more stable and maintained? Is your intention to replace the python version with this nodejs version? Or is the nodejs version experimental?

Cheers,
Kevin

-v flag throws error

First of all: Thank you very much for building and maintaining this package, it's very useful.

Today, I noticed what I assume to be a bug:

# Preparation
npm i -g spoof

# see the corresponding help message
spoof --help
#
# spoof version | --version | -v          Show package version.
#

# While these two lines work:
spoof version # (prints "2.0.1")
spoof --version # (prints "2.0.1")

# The following results in an error:
spoof -v
/usr/local/lib/node_modules/spoof/node_modules/minimist/index.js:65
            setKey(argv, x.split('.'), value);
                           ^

TypeError: x.split is not a function
    at /usr/local/lib/node_modules/spoof/node_modules/minimist/index.js:65:28
    at Array.forEach (<anonymous>)
    at setArg (/usr/local/lib/node_modules/spoof/node_modules/minimist/index.js:64:30)
    at module.exports (/usr/local/lib/node_modules/spoof/node_modules/minimist/index.js:179:21)
    at Object.<anonymous> (/usr/local/lib/node_modules/spoof/bin/cmd.js:8:14)
    at Module._compile (internal/modules/cjs/loader.js:1128:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1167:10)
    at Module.load (internal/modules/cjs/loader.js:983:32)
    at Function.Module._load (internal/modules/cjs/loader.js:891:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)

This bug is of course not too much of a problem when using the tool, it is only about retrieving the version number, after all, and there are other ways to obtain that information, but I thought I should report it here anyway.

Support "ip" command

Hi,

Ifconfig command is deprecated. Please support ip command. which is supporting on spoofMac project.

Thank you

While spoofing Wi-Fi on en1 works, Blootooth PAN on device en2 does not

$ sudo spoof set XX:XX:XX:XX:XX:X9 en1
$ spoof list

  • Ethernet on device en0 with MAC address XX:XX:XX:XX:XX:XX
  • FireWire on device fw0 with MAC address XX:XX:XX:XX:XX:XX
  • Wi-Fi on device en1 with MAC address XX:XX:XX:XX:XX:X8 currently set to XX:XX:XX:XX:XX:X9
  • Bluetooth PAN on device en2 with MAC address XX:XX:XX:XX:XX:X8
    $ sudo spoof set XX:XX:XX:XX:XX:XX en2
    ifconfig: interface en2 does not exist
    Error: Unable to change MAC address

Have you ever (or anybody else) been able to spoof a Bluetooth PAN MAC address in any way?
Seems to me that it cannot be done with ifconfig since ifconfig command does not ever show that interface on my system, as opposed to networksetup -listallhardwareports which does

Spoofing fails on Mojave with no error message

Encountering this issue with a 2018 MacBook Air on macOS Mojave 10.14.6.

Running the following command fails without any status messages:

sudo spoof set aa:bb:cc:dd:ee:ff en0

I run the command, enter my password, and the command seems to complete. However, running spoof list reveals the Mac Address has not changed.

This issue appears to affect manually setting the address with ifconfig as well. Running this command also does not change anything and does not throw an error:

sudo ifconfig en0 ether aa:bb:cc:dd:ee:ff

Not sure if or how Mac spoofing might be disabled system-wide, or if something else is going on here. Any help is appreciated.

`ifconfig` output is inconsistent across distros

I think you should be using the newer ip command as ifconfig is not only deprecated, but also inconsistent across linux distros.

E.g., my output is incompatible with spoof (Ubuntu 16.10):

br-aaaf777a4e49: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        inet 172.18.0.1  netmask 255.255.0.0  broadcast 0.0.0.0
        ether 02:42:0b:29:dd:90  txqueuelen 0  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

docker0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        inet 172.17.0.1  netmask 255.255.0.0  broadcast 0.0.0.0
        ether 02:42:9b:59:49:b4  txqueuelen 0  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1  (Local Loopback)
        RX packets 188143  bytes 11719536 (11.7 MB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 188143  bytes 11719536 (11.7 MB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

wlp2s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.43.69  netmask 255.255.255.0  broadcast 192.168.43.255
        inet6 fe80::b60f:1f73:168b:9d98  prefixlen 64  scopeid 0x20<link>
        ether 60:6d:c7:c6:25:cb  txqueuelen 1000  (Ethernet)
        RX packets 53917  bytes 35312965 (35.3 MB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 47734  bytes 11155012 (11.1 MB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

I'll make the necessary changes if you're willing to accept the move from ipconfig to ip.

Windows not listing device / can't select device

Hello, not sure if this is a bug or something wrong with my system but I thought I'd report it anyways, perhaps someone could look into it.

The output below, notice lines such as "- on device Wifi with MAC address B8:EE:65:98:0C:4F " immediately after the - in the beginning of the line, there should be the name of the device. Without said line I am not able to properly select the adapter I want to change MAC for.

Below is complete output of my experience
Windows 7 x64, up to date
ASUS i5 Laptop
node -v: v6.11.2
npm -v: 3.10.10

C:\Users\John-Laptop\Desktop\nodeProjects\spoof (master) ([email protected])
λ spoof list

  • on device
  • on device Wifi with MAC address B8:EE:65:98:0C:4F
  • on device isatap.{5DBC0C49-96D9-4618-92EE-A9987567484B} with MAC address 00:00:

C:\Users\John-Laptop\Desktop\nodeProjects\spoof (master) ([email protected])
λ spoof randomize Wifi

C:\Users\John-Laptop\Desktop\nodeProjects\spoof (master) ([email protected])
λ spoof list

  • on device
  • on device Wifi with MAC address B8:EE:65:98:0C:4F
  • on device isatap.{5DBC0C49-96D9-4618-92EE-A9987567484B} with MAC address 00:00:
    00:00:00:00

C:\Users\John-Laptop\Desktop\nodeProjects\spoof (master) ([email protected])
λ spoof randomize Wifi

C:\Users\John-Laptop\Desktop\nodeProjects\spoof (master) ([email protected])
λ spoof list

  • on device
  • on device Wifi with MAC address B8:EE:65:98:0C:4F
  • on device isatap.{5DBC0C49-96D9-4618-92EE-A9987567484B} with MAC address 00:00:
    00:00:00:00

C:\Users\John-Laptop\Desktop\nodeProjects\spoof (master) ([email protected])
λ spoof list wifi

  • on device
  • on device Wifi with MAC address B8:EE:65:98:0C:4F
  • on device isatap.{5DBC0C49-96D9-4618-92EE-A9987567484B} with MAC address 00:00:
    00:00:00:00

Thank you for looking into this!

Not sure this works on Ubuntu

Hi, I'm running Elementary OS and using your script via Node.

I uses another script to change my MAC address that also edits it in /etc/NetworkManager/System-Connections/MYNETWORKNAME

I ran your script and it did not change it in that file. When I logged in to my router, the old MAC is still listed for my connection but running ifconfig lists the MAC your utility gave me. Sorta odd.
I'm actually surprised it connected to the network in the first place.

Any ideas what might be happening?

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.