Python script to change MAC address of Linux machine
What is MAC Address: In a computer network, the MAC Address is used at the lowest networking level, where network interfaces communicate with one another. See details here.
Need of changing MAC Address:
- To bypass MAC Address filtering
- To bypass certain kind of MITM spoofing attack
- 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.
Changing MAC Address in Linux Machine: In Linux, a simple way to change MAC address is by using
If it is not already installed, we can install it using:
sudo apt-get update sudo apt-get install ifconfig
After installing this package, we can change the MAC Address using:
sudo ifconfig <interface-name> down sudo ifconfig <interface-name> hw ether <new-mac-address> sudo ifconfig <interface-name> up
We can see the list of interfaces using:
Automation using Python: Since it is not possible for us to manually change the MAC Address every time, we can automate the process of changing the MAC Address using Python. This script will keep changing the MAC Address in a constant period of time.
Below is the implementation of above idea.
Please Login to comment...