Build a MAC Address Changer using Python in just 4 lines of code

Build a MAC Address Changer using Python in just 4 lines of code

In order to communicate or transfer the data from one computer to ano**ther computer, we need some address. In Computer networks various types of addresses are introduced; each works at a different layer. Media Access Control Address is a physical address that works at the Data Link Layer.

1_t8KX-WzKtxqzdOur7ixRjg.png

Need of changing MAC Address:

  1. To bypass MAC Address filtering
  2. To bypass certain kind of MITM spoofing attack
  3. To avoid device tracking in a public network

There are many other tasks like becoming anonymous in a network and to avoid some network attacks where changing MAC Address becomes useful.

SOURCE CODE

#!/usr/bin/python2

import subprocess

#using this script you can also change your different kinds of wireless interface card mac addresses just replace eth0 with your wireless interface card name

subprocess.call("ifconfig eth0 down",shell=True)
subprocess.call("ifconfig eth0 hw ether 00:11:22:33:44:66",shell=True)

#00:11:22:33:44:66 it is just a example you can put any random mac address

subprocess.call("ifconfig eth0 up",shell=True)
subprocess.call("ifconfig")

OUTPUT

Capture.PNG

If you encountered any errors or doubts, please feel free to ask in the comments. I hope you enjoyed creating this small tool.