In this tutorial we will look a simple but useful code that changes windows operating system Mac address. Mac address is the unique address that specifies the network interface. A general thought that mac addresses can be changed. But is it not true. Mac addressee is provided by the network card to the operations system network stack. But can be changed by operating system with sufficient privileges.
Download Periodic-Mac-Changer From Github
The code can be downloaded with the following
> git clone https://github.com/ibaydan/periodic-mac-changer.git
OR we can download from following link as compressed archive.
In order to do low level mac change operations we will use
macshift.exe as its name suggest changes the mac address of given interface. It is provided by git repository so we do not need to download explicitly.
The periodic operations are managed by
Timer.py python file. Here the simply code provided by
import time import os while True: time.sleep(5) os.system('macshift.exe -i "Local Area Connection 3"')
- We import
oslibraries in order to use related functions and API’s
- We create a
whileloop which is infinite python while loop in order to never end the process except
time.sleep(5)function is used to sleep current loop for 5 seconds in every step.
os.system('macshift.exe -i "Local Connection 3"')is used provide
macshiftcommand to the operationg system whit related interface information which is
Local Connection 3in this example.