57b362fa6b
1、清除旧逻辑代码; 2、优化监听逻辑; 3、调整包版本的兼容性python3.8、3.9、3.10。
27 lines
833 B
Python
27 lines
833 B
Python
|
||
import winreg
|
||
|
||
#关闭系统代理
|
||
def disable_windows_proxy():
|
||
settings_key = r'Software\Microsoft\Windows\CurrentVersion\Internet Settings'
|
||
try:
|
||
registry = winreg.ConnectRegistry(None, winreg.HKEY_CURRENT_USER)
|
||
settings = winreg.OpenKey(registry, settings_key, 0, winreg.KEY_WRITE)
|
||
|
||
# 设置代理启用值为0(禁用)
|
||
winreg.SetValueEx(settings, 'ProxyEnable', 0, winreg.REG_DWORD, 0)
|
||
|
||
# 清空代理服务器和代理覆盖设置
|
||
winreg.SetValueEx(settings, 'ProxyServer', 0, winreg.REG_SZ, '')
|
||
winreg.SetValueEx(settings, 'ProxyOverride', 0, winreg.REG_SZ, '')
|
||
|
||
winreg.CloseKey(settings)
|
||
winreg.CloseKey(registry)
|
||
except Exception as e:
|
||
pass
|
||
|
||
|
||
if __name__ == '__main__':
|
||
disable_windows_proxy()
|
||
|
||
|