import io, sys, time, re, os
import winreg def enableProxy(IP, Port):
proxy = IP + ":" + str(Port)
xpath = "Software\Microsoft\Windows\CurrentVersion\Internet Settings"
try:
key = winreg.OpenKey(winreg.HKEY_CURRENT_USER, xpath, 0, winreg.KEY_WRITE)
winreg.SetValueEx(key, "ProxyEnable", 0, winreg.REG_DWORD, 1)
winreg.SetValueEx(key, "ProxyServer", 0, winreg.REG_SZ, proxy)
except Exception as e:
print("ERROR: " + str(e.args))
finally:
None def disableProxy():
proxy = ""
xpath = "Software\Microsoft\Windows\CurrentVersion\Internet Settings"
try:
key = winreg.OpenKey(winreg.HKEY_CURRENT_USER, xpath, 0, winreg.KEY_WRITE)
winreg.SetValueEx(key, "ProxyEnable", 0, winreg.REG_DWORD, 0)
winreg.SetValueEx(key, "ProxyServer", 0, winreg.REG_SZ, proxy)
except Exception as e:
print("ERROR: " + str(e.args))
finally:
None def main():
proxyIP = "10.10.1.2"
proxyPort = 123 try:
disableProxy()
        enableProxy(proxyIP, proxyPort)
except Exception as e:
print("ERROR: " + str(e.args))
finally:
pass if __name__ == '__main__':
main()

python3操作注册表设置/取消IE代理的更多相关文章

  1. python3 操作注册表

    1.1 读取 import winreg key = winreg.OpenKey(winreg.HKEY_CURRENT_USER,r"Software\Microsoft\Windows ...

  2. How to:Installshield判断操作系统是否为64位,并且为操作注册表进行设置

    原文:How to:Installshield判断操作系统是否为64位,并且为操作注册表进行设置 IS脚本操作注册表在64位平台下必须有特殊的设置 if (SYSINFO.bIsWow64) then ...

  3. [转]C#操作注册表

    原文链接:http://www.cnblogs.com/txw1958/archive/2012/08/01/csharp-regidit.html 下面我们就来用.NET下托管语言C#注册表操作,主 ...

  4. c++ 操作注册表

    1.       注册表简介 注册表是为Windows NT和Windows95中所有32位硬件/驱动和32位应用程序设计的数据文件,用于存储系统和应用程序的设置信息.16位驱动在Winnt (Win ...

  5. C#操作注册表全攻略

    相信每个人对注册表并不陌生,在运行里面输入“regedit”就可以打开注册表编辑器了.这东西对Windows系统来说可是比较重要的,也是病 毒常常会光顾的地方,比如病毒和恶意软件常常会在注册表的启动项 ...

  6. C# 访问操作注册表整理

    一..net注册表操作简介 .net中Registry 类,RegistryKey 类提供了操作注册表的接口 RegistryValueKind,用于指定操作注册表的数据类型. 二.使用实例 //获取 ...

  7. Reg命令使用详解 批处理操作注册表必备

    首先要说明:编辑注册表不当可能会严重损坏您的系统.在更改注册表之前,应备份计算机上任何有价值的数据 只有在别无选择的情况下,才直接编辑注册表.注册表编辑器会忽略标准的安全措施,从而使得这些设置会降低性 ...

  8. Atitit.木马病毒的操作注册表原理 系统服务管理器 atiSysService

    Atitit.木马病毒的操作注册表原理 系统服务管理器 atiSysService 1. atiSysService1 2. atiSysService  原理1 3. Java code1 4. 参 ...

  9. Atitit.操作注册表 树形数据库 注册表的历史 java版本类库总结

    Atitit.操作注册表 树形数据库 注册表的历史 java版本类库总结 1. 注册表是树形数据库 1 2. 注册表的由来 1 3. Java  操作注册表 2 3.1. 使用Preferences  ...

随机推荐

  1. UVA 11732 - strcmp() Anyone? 字典树

    传送门:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&a ...

  2. 14、USB摄像头(V4L2接口)的图片采集

    参考网站http://www.cnblogs.com/surpassal/archive/2012/12/19/zed_webcam_lab1.html 一.一些知识 1.V4L和V4L2. V4L是 ...

  3. YUV与RGB格式转换

    YUV格式具有亮度信息和色彩信息分离的特点,但大多数图像处理操作都是基于RGB格式. 因此当要对图像进行后期处理显示时,需要把YUV格式转换成RGB格式. RGB与YUV的变换公式如下: YUV(25 ...

  4. 【53.57%】【codeforces 722D】Generating Sets

    time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard o ...

  5. Opencv在视频中静态、动态方式绘制矩形框ROI

    Opencv视频处理中的目标跟踪经常用到要在视频上画一个矩形框ROI,标注出要跟踪的物体,这里介绍两种在视频中绘制矩形框的方法,一种是"静态的",一种是"动态的" ...

  6. Django之模板过滤器

    Django 模板过滤器也是我们在以后基于 Django 网站开发过程中会经常遇到的,如显示格式的转换.判断处理等.以下是 Django 过滤器列表,希望对为大家的开发带来一些方便. 一.形式:小写 ...

  7. UE4的JSON读写方式<二>

    声明:所有权利保留. 转载必须说明出处:http://blog.csdn.net/cartzhang/article/details/43794409 Json的Writer博客地址: http:// ...

  8. KeePass v1.30

    Changes from 1.29 to 1.30: New Features:Refined application icons (thanks to Victor Andreyenkov).Add ...

  9. Thermal management in a gaming machine

    BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to wager gaming ...

  10. 【24.63%】【codefroces 686D】Kay and Snowflake

    time limit per test 3 seconds memory limit per test 256 megabytes input standard input output standa ...