In this article you will discover 3 ways to change your mac address.
In this article you will discover 3 ways to change your mac address.
In the terminal you can change the MAC address with a few commands:
ifconfig wlan0 down
ifconfig wlan0
hw ether 00:11:22:33:44:55
ifconfig wlan0 up
You can check the new MAC address has been changed with ifconfig
The third way to change the Mac Address is with a Python script and I’m actually going to give two examples. The first is a basic MAC changer and the second incorporates changing the network adapter to monitor mode.
Please feel free to copy this code.
#!/usr/bin/env python
import subprocess
iface = input("Enter interface: ")
new_mac = input("Enter new MAC: ")
subprocess.call(["ifconfig", iface, "down",])
subprocess.call(["ifconfig", iface, "hw", "ether", new_mac])
subprocess.call(["ifconfig", iface, "up",])
print("Mac address changed")
As you can see when we run the macchanger.py file in the terminal, we are prompted to enter the name of the interface and the new MAC address. In this screenshot we can see the MAC address has been changed to 00:11:22:33:44:55
This Python script will allow you to change the MAC address and then enable monitor mode on the same interface. You may copy this code.
#!/usr/bin/env python
import subprocess
iface = input("Enter interface: ")
new_mac = input("Enter new MAC: ")
def mac_changer():
subprocess.call(["ifconfig", iface, "down",])
subprocess.call(["ifconfig", iface, "hw", "ether", new_mac])
subprocess.call(["ifconfig", iface, "up",])
print("Mac address changed to ", new_mac, "on interface", iface, " successfully")
mac_changer()
def mon_mode():
subprocess.call(["ifconfig", iface, "down",])
subprocess.call(["airmon-ng", "check", "kill",])
subprocess.call(["ifconfig", iface, "up",])
subprocess.call(["ifconfig", iface, "down",])
subprocess.call(["iwconfig", iface, "mode", "monitor"])
subprocess.call(["ifconfig", iface, "up",])
print("Monitor mode enabled for", iface, "successfully")
mon_mode()
If you found this blog useful on “3 ways to change your mac address”, please share it in social media channels to help others learn and do not forget to follow me on Twitter for latest blog updates. Peace.