chrome使用的是ie的代理设置,切换代理 用python写了段代码
一般用两个代理 gapproxy 使用的是 http代理
另一个 ssh tunnel
#!/usr/bin/env python
#-*- coding:utf-8 -*-
import sys
from _winreg import *
subkey = "Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings"
def usage():
print " 0 exit"
print " 1 no proxy"
print " 2 1080"
print " 3 8000"
if __name__ == '__main__':
key = OpenKey(HKEY_CURRENT_USER, subkey, 0, KEY_ALL_ACCESS)
print QueryValueEx(key, "ProxyServer")
proxyEnable = 1#"00000001"
proxyServer = "socks=127.0.0.1:1080"
usage()
c = int(input("input command 0/1/2/3: "))
while(c != 0):
if c == 1:
proxyEnable = 0 # "00000000"
elif c == 2:
proxyEnable = 1 #"00000001"
proxyServer = "socks=127.0.0.1:1080"
elif c == 3:
proxyEnable = 1 #"00000001"
proxyServer = "http=127.0.0.1:8000"
SetValueEx(key, "ProxyEnable", 0, REG_DWORD, proxyEnable)
SetValueEx(key, "ProxyServer", 0, REG_SZ, proxyServer)
print "Current State:"
print " ", QueryValueEx(key, "ProxyEnable")
print " ", QueryValueEx(key, "ProxyServer")
c = int(input("Input command 0/1/2/3: "))
CloseKey(key)
0 comments:
Post a Comment