A professional-grade, cross-platform MAC address spoofing tool designed for network testing and security research. Features real vendor OUI pattern matching, automatic error detection and recovery, transaction-based rollback capabilities, and support for Windows, Linux, and macOS. Built with security, reliability, and ease of use in mind.
Built by: MrAmirRezaie
- Features
- Prerequisites
- Installation
- Quick Start
- CLI Usage
- Python API
- Configuration Profiles
- MAC Address History
- Task Scheduling
- Interface Filtering & Search
- Transaction & Rollback
- Platform Notes
- Warnings & Legal Notice
- Troubleshooting
- Testing
- Contributing
- License & Attribution
- Contact
- Cross-platform support: Windows, Linux, macOS
- Real vendor OUI pattern matching: 70+ vendor MACs for realistic randomization
- Locally administered MAC generation and vendor-specific OUI-based MAC generation
- Online OUI refresh to keep vendor prefix data up to date
- Interface-aware MAC validation for wireless, bridge, virtual, and loopback restrictions
- RFC 5342-compliant MAC validation and realistic MAC generation
- Transaction-based changes with automatic rollback on errors
- Pre/post verification of applied changes with detailed reporting
- CLI and Python API for automation and scripting
- Configuration Profiles: Save and load MAC mappings for multiple interfaces
- MAC History Database: Track all MAC address changes with backup/recovery options
- Advanced Interface Filtering: Search and filter interfaces by name, status, vendor, driver, IP
- Task Scheduling: Schedule periodic MAC address randomization (hourly, daily, weekly, monthly, custom)
- Extended Interface Information: Retrieve IP addresses, MTU, network type, and more
- Settings Management: Persist configuration and preferences across sessions
- Export/Import: Backup and restore profiles, history, and schedules
- Batch Operations: Apply changes to multiple interfaces with atomic rollback on failure
- Python 3.7 or newer (3.12 recommended). The project uses only the Python standard library.
- Platform-specific utilities (for full functionality):
- Windows: PowerShell and WMI access (some older helpers may use
wmic) - Linux:
ip,ethtool, and root/sudo privileges - macOS:
ifconfigand sudo privileges
- Windows: PowerShell and WMI access (some older helpers may use
- Administrative privileges are required to actually change MAC addresses. Without them, the tool can validate and generate MACs but cannot apply them.
If you are unsure whether your system has required utilities, run:
python install_requirements.py- Clone the repository or download the source into a working folder.
- (Optional) Create and activate a virtual environment:
python -m venv .venv
# Windows
.\.venv\Scripts\activate
# Linux/macOS
source .venv/bin/activate- No external packages required—this project uses the standard library only. Use
install_requirements.pyto validate your environment:
python install_requirements.pyFrom the repository root, list network interfaces:
python mac_spoofer_cli.py listValidate an existing MAC address:
python mac_spoofer_cli.py validate 00:25:86:12:34:56Generate realistic MAC addresses (3 examples):
python mac_spoofer_cli.py generate -c 3Spoof a specific interface (requires admin):
python mac_spoofer_cli.py spoof --interface Ethernet0 --mac 02:00:5e:10:00:00Spoof a random realistic MAC for an interface:
python mac_spoofer_cli.py random --interface eth0Show transaction history and committed changes:
python mac_spoofer_cli.py historyRollback the last transaction:
python mac_spoofer_cli.py rollbackUse -h with any command for more details, or --json to get machine-readable output where supported.
Primary commands provided by mac_spoofer_cli.py:
Core Commands:
list— enumerate detected network interfaces with detailsvalidate <mac>— validate MAC format, vendor, and flagsgenerate— generate realistic MAC(s) from real OUIsspoof <interface> <mac>— set a provided MAC on an interface (requires admin)random <interface>— generate and apply a realistic random MAChistory— display transaction history with optional JSON outputrollback— run rollback callbacks for all transactions
Profile Management:
profile list— list all saved MAC profilesprofile create --name <name> [--description <text>]— create new profileprofile show --name <name>— display profile details and mappingsprofile delete --name <name>— delete a profile
MAC History:
mac-history list [--interface <name>]— display MAC address change historymac-history stats— show statistics about MAC historymac-history clear [--interface <name>]— clear history entries
Task Scheduling:
schedule list— list all scheduled tasksschedule create --name <name> --interface <iface> --action <action> --frequency <freq>— create scheduled taskschedule enable --name <name>— enable a scheduled taskschedule disable --name <name>— disable a scheduled taskschedule delete --name <name>— delete a scheduled task
Interface Search & Filter:
search [--search <keyword>] [--status <up|down>] [--driver <driver>] [--active-only] [--sort-by <field>]— search and filter interfaces
Examples:
# List all active interfaces
python mac_spoofer_cli.py search --active-only
# Search for Intel interfaces
python mac_spoofer_cli.py search --search "intel"
# Create a profile for work network
python mac_spoofer_cli.py profile create --name work --description "Work network MACs"
# Schedule daily MAC randomization
python mac_spoofer_cli.py schedule create --name daily_spoof --interface eth0 --action spoof_random --frequency daily
# View MAC history statistics
python mac_spoofer_cli.py mac-history statsYou can use the core engine from your scripts. Example:
from mac_spoofer import MacAddressSpoofer
spoofer = MacAddressSpoofer(auto_rollback=True)
interfaces = spoofer.get_interfaces()
print(interfaces)
# Generate a realistic MAC and apply to first interface (requires admin)
new_mac = spoofer.generate_random_mac_for_interface(interfaces[0])
spoofer.spoof_mac_address(interfaces[0].name, new_mac)Refer to the module docstrings for full API signatures: mac_validator.py, transaction_manager.py, platform_handlers.py, mac_spoofer.py.
The validator module now includes:
generate_locally_administered_mac()for LAA random MACsgenerate_vendor_specific_mac()for vendor OUI-based MACsrefresh_oui_database()to update OUI mappings from an online sourcevalidate_for_interface()for interface-specific validation constraints
Save and manage MAC address configurations for multiple interfaces as named profiles.
Features:
- Create named profiles with descriptions and tags
- Associate interfaces with specific MAC addresses
- Clone profiles for easy duplication
- Search profiles by name or tags
- Export/import profiles for backup and sharing
Example Usage:
from config_manager import ConfigManager
config = ConfigManager()
# Create a profile
profile = config.create_profile("work", "Work network configuration")
profile.add_interface("eth0", "00:25:86:AA:BB:CC")
profile.add_interface("eth1", "52:54:00:AA:BB:CC")
config._save_profile(profile)
# List profiles
for p in config.list_profiles():
print(f"{p['name']}: {p['interface_count']} interfaces")
# Clone a profile
config.clone_profile("work", "work_backup")Profiles are stored in ~/.mac-spoofer/profiles/ as JSON files.
Keep a complete history of all MAC address changes with the ability to restore previous MACs.
Features:
- Automatic recording of all MAC spoofs and restores
- Original MAC detection and storage
- Search history by interface, MAC, or notes
- Restore previous MACs with one command
- Export/import history for archival
- Statistics on spoofing activity
Example Usage:
from mac_history import MacHistory
history = MacHistory()
# Record a MAC change
history.record_spoof("eth0", "00:11:22:33:44:55", "00:25:86:AA:BB:CC")
# Get interface history
entries = history.get_interface_history("eth0")
for entry in entries:
print(f"{entry['timestamp']}: {entry['mac_address']}")
# Restore original
original = history.restore_original_mac("eth0")
print(f"Original MAC: {original}")
# View statistics
stats = history.get_statistics()
print(f"Total MACs recorded: {stats['unique_macs']}")History is stored in ~/.mac-spoofer/history/mac_history.json.
Schedule automatic MAC address randomization at regular intervals.
Features:
- Multiple frequency options: once, hourly, daily, weekly, monthly, custom
- Enable/disable tasks without deletion
- Track execution history with run counts
- Automatic task execution in background thread
- Search and filter scheduled tasks
Supported Frequencies:
once— Run a single timehourly— Every hourdaily— Every 24 hoursweekly— Every 7 daysmonthly— Every 30 dayscustom— Custom interval in seconds
Example Usage:
from scheduler import Scheduler, ScheduleFrequency
scheduler = Scheduler()
# Create a daily task
task = scheduler.create_task(
name="daily_randomize",
interface="eth0",
action="spoof_random",
frequency=ScheduleFrequency.DAILY,
description="Randomize MAC daily at startup"
)
# List tasks
for task in scheduler.list_tasks(enabled_only=True):
print(f"{task['name']}: {task['frequency']}")
# Start scheduler in background
scheduler.start(interval_seconds=60)
# Later...
scheduler.stop()Scheduled tasks are stored in ~/.mac-spoofer/schedules/ as JSON files.
Advanced filtering, searching, and sorting of network interfaces.
Filter Capabilities:
- By name (exact or regex pattern)
- By status (up/down)
- By type (Ethernet/Wireless)
- By vendor name
- By driver
- By IP address presence
- Multiple filters combined
Sort Options:
- name, MAC address, status
- IP address, vendor, driver
- Interface type
Example Usage:
from interface_filter import InterfaceFilter
from mac_spoofer import MacAddressSpoofer
spoofer = MacAddressSpoofer()
interfaces = spoofer.get_available_interfaces()
# Convert to NetworkInterface objects
from platform_handlers import NetworkInterface
net_ifaces = [
NetworkInterface(
name=i['name'],
mac_address=i['mac_address'],
status=i['status'],
driver=i['driver']
)
for i in interfaces
]
# Filter active Ethernet interfaces
filters = {
'status': 'up',
'type': 'Ethernet'
}
filtered = InterfaceFilter.apply_filters(net_ifaces, filters)
# Search for Intel devices
intel_ifaces = InterfaceFilter.filter_by_vendor(net_ifaces, "Intel")
# Sort by MAC address
sorted_ifaces = InterfaceFilter.sort_by_field(net_ifaces, 'mac', reverse=False)
# Display as table
print(InterfaceFilter.to_table(filtered))All state-changing operations are performed inside transactions. Each action can register a rollback callback. If any step fails, the transaction manager runs registered callbacks in LIFO order to restore previous state.
Key points:
- Transactions are logged and can be inspected with the
historycommand. - Auto-rollback is enabled by default; you can disable it when orchestrating multi-interface operations if you handle recovery yourself.
- Rollbacks attempt best-effort restoration; some platform limitations may make full restoration impossible (see Troubleshooting).
- Windows: Administrative PowerShell is required to modify interface registry settings or use advanced WMI features. On modern Windows,
wmicmay be absent—PowerShell/WMI alternatives are used where available. - Linux: Requires
ipand usuallyethtoolfor persistent driver-level spoofing. Some distributions may block MAC changes on certain interfaces (e.g., managed by NetworkManager); stop network manager or use its tools for persistent changes. - macOS:
ifconfigis used for on-the-fly changes. System Integrity Protection (SIP) and Apple-managed drivers can interfere with persistent changes.
Always test in a controlled environment first.
- This tool can disrupt network connectivity. Use only on systems and networks you own or are explicitly authorized to test.
- Unauthorized MAC spoofing may violate local laws, organizational policies, or service agreements.
- The included
LICENSEcontains additional ethical and usage restrictions. By using this software you agree to follow those terms. - The author is not responsible for misuse. Use responsibly and ethically.
If you need explicit exceptions for legitimate security research, obtain written authorization before running tests on third-party networks.
- "Permission denied" or inability to apply MAC: run the CLI from an elevated shell (Administrator on Windows,
sudoon Linux/macOS). - Missing tools (e.g.,
ethtool,ip): install via your package manager (apt, yum, brew). - After spoofing, some network stacks cache the hardware address—restarting the interface or OS may be required.
- If a change fails halfway through a bulk operation, the transaction manager attempts rollback; check
historyandlogsfor details.
If you need more help, open an issue using the provided templates in .github/ISSUE_TEMPLATE/.
Run the full unit test suite to verify local functionality (no external dependencies required):
python tests.pyAll tests should pass in a healthy environment (24/24 as provided).
See CONTRIBUTING.md for contribution guidelines, code style, and testing requirements.
This project is distributed under the terms in the LICENSE file in this repository. The LICENSE includes additional restrictions and ethical use requirements—read it before use.
If you reuse or redistribute components, please attribute the original author: MrAmirRezaie.
Project author: MrAmirRezaie
For security issues, follow the policy in SECURITY.md and use the responsible disclosure path described there.
Thank you for using MacChanger. Use responsibly.