Python Script Change Mac Address Periodically – POFTUT

Python Script Change Mac Address Periodically

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 command.

> git clone

OR we can download from following link as compressed archive.


In order to do low level mac change operations we will use macshift.exe .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 python file. Here the simply code provided by

import time 
import os 
while True: 
        os.system('macshift.exe -i "Local Area Connection 3"')
  • We import time and os libraries in order to use related functions and API’s
  • We create a while loop which is infinite python while loop in order to never end the process except CTR+C
  • 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 macshift command to the operationg system whit related interface information which is Local Connection 3 in this example.

LEARN MORE  Javascript For and While Loop Iteration

Leave a Comment