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 https://github.com/ibaydan/periodic-mac-changer.git
OR we can download from following link as compressed archive.
https://github.com/ibaydan/periodic-mac-changer/archive/master.zip
Macshift.exe
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.
Timer.py
The periodic operations are managed by Timer.py
python file. Here the simply code provided by Timer.py
import time import os while True: time.sleep(5) os.system('macshift.exe -i "Local Area Connection 3"')
- We import
time
andos
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 exceptCTR+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 providemacshift
command to the operationg system whit related interface information which isLocal Connection 3
in this example.