Python脚本会定期更改Mac地址

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.exemacshift.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 and os libraries in order to use related functions and API’s

    我们导入timeos库以使用相关功能和API

  • We create a while loop which is infinite python while loop in order to never end the process except CTR+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 provide macshift command to the operationg system whit related interface information which is Local Connection 3 in this example.

    os.system('macshift.exe -i "Local Connection 3"')用于向macshift相关接口信息提供macshift命令,在本示例中为Local Connection 3

LEARN MORE  Python Standard Library
了解更多Python标准库

翻译自: https://www.poftut.com/python-script-change-mac-address-periodically/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值