MacSpoofer

Changes a network interface's MAC address so the machine presents itself as a different class of device — a Raspberry Pi, an IP camera, a PlayStation — using real registered OUIs, and verifies the change actually took effect.

Python, rich · source on GitHub

b8:27:eb : d5:9f:86
└──────┘   └──────┘
 Raspberry  random
 Pi's OUI   per run

What it does

sudo macspoofer with no arguments asks which interface to change and what you want to look like, then builds an address inside that vendor’s registered OUI range and reads the interface back to confirm it stuck. 98 device profiles across 15 categories — phones, laptops, consoles, smart TVs, IoT, network gear, printers, IP cameras, VoIP phones, industrial controllers, single-board computers, wearables, hypervisors — plus random and explicit addresses.

Everything the wizard does is also available as flags, with --dry-run and meaningful exit codes.

Why a profile instead of a random address

A MAC address isn’t opaque. The first three octets are an OUI registered to a company in the public IEEE registry, so anything looking at the address can tell an Apple NIC from an Espressif one. A random address stands out immediately: it belongs either to no vendor at all or to one that makes nothing like the device sending the traffic.

So the registered prefix stays intact and only the three NIC-specific octets are randomised. The result is indistinguishable in form from a real address issued by that vendor.

That address is what shows up in ARP tables, DHCP leases, switch MAC tables, Wi-Fi management frames and most inventory and NAC systems. It is not a full device fingerprint — DHCP option ordering, hostname, TCP/IP stack quirks, mDNS advertisements, TLS fingerprint and traffic patterns all still describe the real machine. One strong signal, not every signal.

The catalogue is checked, not trusted

Hand-curated data is the part most likely to drift from reality, so macspoofer verify-oui compares every bundled prefix against the official MA-L registry and names the real registrant for any that disagree:

Checked 636 prefixes against 40497 IEEE assignments

  633 match the expected vendor
  3 locally administered, so absent from the registry by design

That command found 31 wrong prefixes in the first draft — a “Panasonic” prefix registered to NEC, a “Vizio” one registered to Xiaomi — and they were removed. A truncated registry download is detected and refused rather than reported as hundreds of unregistered prefixes.

Verified changes

A command that exits 0 proves nothing. Wi-Fi drivers in particular accept the change and silently keep the old address, so every change is followed by a read-back and reported as ok, unverified or failed.

The true original is recorded before the first change and never overwritten, so restore still works after several spoofs in a row. Multicast, broadcast and all-zero addresses are rejected before any privileged command runs, and the U/L bit is set correctly for random addresses.

Platform notes

macOS hands unprivileged processes the placeholder 02:00:00:00:00:00 instead of the real address; the tool recognises it and says “unreadable (needs root)” rather than reporting a fake. Wi-Fi changes often fail outright on Apple Silicon — the driver accepts the command and keeps the old address — which the read-back catches instead of claiming success. Wired and USB Ethernet work normally, and nothing survives a reboot.

On Linux it uses ip link with an ifconfig fallback, and ethtool -P for the true permanent address where it’s installed. NetworkManager may reassert its own address on a managed interface.

How it’s built

profiles.py     the device catalogue (plain data)
     │
generator.py    pick a registered OUI, randomise the NIC half
     │
oui.py          parse, validate, enforce unicast / U-L bit rules
     │
interfaces.py   discover interfaces; current vs permanent address
     │
spoof.py        apply via ifconfig / ip, then READ BACK and compare
     │
state.py        remember the true original so restore works

115 tests cover address bit semantics, catalogue integrity, generation, interface parsing (including the macOS placeholder), the apply/restore state machine against a simulated host, registry verification, and every CLI path including the wizard.

Running it

git clone https://github.com/M0rPh39s/MacSpoofer.git && cd MacSpoofer
pip install .                       # Python 3.11+

sudo macspoofer                     # the wizard
sudo macspoofer set -i en0 -d hikvision -y
sudo macspoofer restore -i en0

Use it only on networks and devices you own or are authorised to test.