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.
在本教程中,我们将看到一个简单但有用的代码,该代码可以更改Windows操作系统的Mac地址。 Mac地址是指定网络接口的唯一地址。 人们普遍认为可以更改mac地址。 但这不是真的。 Mac地址由网卡提供给操作系统网络堆栈。 但是可以通过具有足够特权的操作系统进行更改。
从Github下载Periodic-Mac-Changer (Download Periodic-Mac-Changer From Github)
The code can be downloaded with the following git
command.
可以使用以下git
命令下载代码。
> 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
https://github.com/ibaydan/periodic-mac-changer/archive/master.zip
Macshift.exe (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.
为了进行低级的mac更改操作,我们将使用macshift.exe
。 macshift.exe
的名称建议更改给定接口的mac地址。 它由git仓库提供,因此我们不需要显式下载。
计时器 (Timer.py)
The periodic operations are managed by Timer.py
python file. Here the simply code provided by Timer.py
定期操作由Timer.py
python文件管理。 这是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我们导入
time
和os
库以使用相关功能和APIWe create a
while
loop which is infinite python while loop in order to never end the process exceptCTR+C
我们创建一个
while
循环,它是无限的python while循环,以便永远不会结束除CTR+C
之外的进程time.sleep(5)
function is used to sleep current loop for 5 seconds in every step.time.sleep(5)
函数用于在每个步骤中将电流循环睡眠5秒钟。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.os.system('macshift.exe -i "Local Connection 3"')
用于向macshift
相关接口信息提供macshift
命令,在本示例中为Local Connection 3
。
翻译自: https://www.poftut.com/python-script-change-mac-address-periodically/