728x90
๋ฐ์ํ
changeMAC.py (๊ด๋ฆฌ์ ๊ถํ ํ์)
from winreg import *
import os, time
def run(adapterName, adapterType="Wi-Fi"):
aReg = ConnectRegistry(None, HKEY_LOCAL_MACHINE)
aKey = OpenKey(aReg, r"SYSTEM\CurrentControlSet\Control\Class\{4d36e972-e325-11ce-bfc1-08002be10318}")
oKey = None
sValue = None
for i in range(255):
try:
aValue_name = EnumKey(aKey, i)
oKey = OpenKey(aKey, aValue_name)
sValue = QueryValueEx(oKey, "DriverDesc")
print("sValue:", sValue)
if adapterName == sValue[0]:
NetworkAddress_value = QueryValueEx(oKey, "NetworkAddress")[0]
NetworkAddress_value = int(NetworkAddress_value, 16)
print("NetworkAddress value:", str(hex(NetworkAddress_value)).upper().replace("0X", "").zfill(12))
# Change Mac Address
changed_NetworkAddress_value = str(hex(NetworkAddress_value+1)).upper().replace("0X", "").zfill(12)
os.system("reg add HKLM\\SYSTEM\\CurrentControlSet\\Control\\Class\\{4D36E972-E325-11CE-BFC1-08002BE10318}\\"+aValue_name+" /v NetworkAddress /d "+changed_NetworkAddress_value + " /f")
os.system("netsh interface set interface \""+adapterType+"\" disable")
os.system("netsh interface set interface \""+adapterType+"\" enable")
time.sleep(5.5)
CloseKey(oKey)
return True
except FileNotFoundError:
raise Exception("์ผ์นํ๋ ๋คํธ์ํฌ ์ด๋ํฐ๋ฅผ ์ฐพ์ง ๋ชปํ์ต๋๋ค.")
run(adapterName="[CommView] Atheros AR9485 Wireless Network Adapter", adapterType="์ด๋๋ท")
์ฐธ๊ณ :
https://stackoverflow.com/questions/15128225/python-script-to-read-and-write-a-path-to-registry
python script to read and write a path to registry
I have developed a python script where i have a setting window which has the options to select the paths for the installation of software.When clicked on OK button of the setting window, i want to ...
stackoverflow.com
https://stackoverflow.com/questions/5227107/python-code-to-read-registry
Python code to read registry
from _winreg import * """print r"*** Reading from SOFTWARE\Microsoft\Windows\CurrentVersion\Run ***" """ aReg = ConnectRegistry(None,HKEY_LOCAL_MACHINE) aKey = OpenKey(aReg, r"SOFTWARE\Microsoft\
stackoverflow.com
728x90
๋ฐ์ํ
'๐จ๐ผโ๐ป๊ฐ๋ฐ > ํ์ด์ฌ' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
ํ์ด์ฌ - ๋ ์ง์คํธ๋ฆฌ ์กฐ์(winreg) (0) | 2023.05.05 |
---|---|
ํ์ด์ฌ - pyinstaller ๊ด๋ฆฌ์ ๊ถํ์ผ๋ก ์คํ ํ๊ธฐ (0) | 2023.05.05 |
ํ์ด์ฌ - ์ฝ๋ ๋๋ ํ ๋ณํ ์ฌ์ดํธ(pyob.oxyry.com) (0) | 2023.03.16 |
ํ์ด์ฌ - ์บก์ฑ ์์ฑ๊ธฐ(captcha) (0) | 2023.03.12 |
ํ์ด์ฌ - pyinstaller์ RecursionError : maximum recursion depth exceeded ์ค๋ฅ ํด๊ฒฐ ๋ฐฉ๋ฒ (0) | 2023.03.08 |