首页 > 代码库 > python重置ie代理 用于ss使用后的恢复

python重置ie代理 用于ss使用后的恢复

每次用完ss客户端,浏览器代理都不会改回来,不想手动改,只能用python脚本处理了。

 1 import winreg
 2 def disableProxy():
 3     proxy = ""
 4     xpath = "Software\Microsoft\Windows\CurrentVersion\Internet Settings"
 5     try:
 6         key = winreg.OpenKey(winreg.HKEY_CURRENT_USER, xpath, 0, winreg.KEY_WRITE)
 7         winreg.SetValueEx(key, "ProxyEnable", 0, winreg.REG_DWORD, 0)
 8         winreg.SetValueEx(key, "ProxyServer", 0, winreg.REG_SZ, proxy)
 9     except Exception as e:
10         print("ERROR: " + str(e.args))
11     finally:
12         None
13 if __name__ == __main__:
14     try:
15         disableProxy()
16     except Exception as e:
17         print("ERROR: " + str(e.args))
18     finally:
19         pass

 

python重置ie代理 用于ss使用后的恢复