forked from leitbogioro/SSR.Go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
changeprotocol.py
66 lines (63 loc) · 3.88 KB
/
changeprotocol.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#! /usr/bin/env python
# -*- coding: utf-8 -*-
from readjson import ConfProtocol
import writejson
from ssrextra import (is_number, Whether, runpy, runshell, Show_conf)
cp="changeprotocol"
Show_conf("当前传输协议", ConfProtocol)
print ("按数字键选择传输协议")
print ("")
print ("0.返回上一级")
print ("1.origin")
print ("2.verify_deflate")
print ("3.auth_sha1_v4")
print ("4.auth_sha1_v4_compatible")
print ("5.auth_aes128_md5")
print ("6.auth_aes128_sha1")
print ("7.auth_chain_a")
print ("8.auth_chain_b")
print ("9.auth_chain_c")
print ("10.auth_chain_d")
print ("11.auth_chain_e")
print ("12.auth_chain_f")
print ("13.auth_akarin_rand")
print ("14.auth_akarin_spec_a")
newprotocol = raw_input()
if ( not is_number(newprotocol) ):
print ("输入错误,请检查你输入的内容!")
runpy(cp)
else:
if (newprotocol=="0"):
runshell("/usr/local/bin/ssr", "change_config")
elif (newprotocol=="1"):
Whether("该协议来自原生shadowsocks协议,已无法适用于审查严密的环境,是否要选择?(y/n)", "y", "n", writejson.WriteProtocol, "协议", "origin", "协议选择", cp)
elif (newprotocol=="2"):
Whether("该协议压缩解压缩效率低,大量用户连接可能会导致 CPU 占用率高,是否要选择?(y/n)", "y", "n", writejson.WriteProtocol, "协议", "verify_deflate", "协议选择", cp)
elif (newprotocol=="3"):
Whether("该协议已不可抵御防火长城的重放攻击,不建议使用,是否要选择?(y/n)", "y", "n", writejson.WriteProtocol, "协议", "auth_sha1_v4", "协议选择", cp)
elif (newprotocol=="4"):
Whether("该协议已不可抵御防火长城的重放攻击,不建议使用,是否要选择?(y/n)", "y", "n", writejson.WriteProtocol, "协议", "auth_sha1_v4_compatible", "协议选择", cp)
elif (newprotocol=="5"):
Whether("防火长城可迅速探测该协议的特征,不建议使用,是否要选择?(y/n)", "y", "n", writejson.WriteProtocol, "协议", "auth_aes128_md5", "协议选择", cp)
elif (newprotocol=="6"):
Whether("防火长城可迅速探测该协议的特征,不建议使用,是否要选择?(y/n)", "y", "n", writejson.WriteProtocol, "协议", "auth_aes128_sha1", "协议选择", cp)
elif (newprotocol=="7"):
Whether("防火长城可迅速探测该协议的特征,不建议使用,是否要选择?(y/n)", "y", "n", writejson.WriteProtocol, "协议", "auth_chain_a", "协议选择", cp)
elif (newprotocol=="8"):
writejson.WriteProtocol("auth_chain_b")
Show_conf("新的传输协议", "auth_chain_b")
elif (newprotocol=="9"):
Whether("使用该协议偶尔可能会导致与服务端通信失败,是否要选择?(y/n)", "y", "n", writejson.WriteProtocol, "协议", "auth_chain_c", "协议选择", cp)
elif (newprotocol=="10"):
Whether("该协议仅 Windows 和 Android 客户端支持,是否要选择?(y/n)", "y", "n", writejson.WriteProtocol, "协议", "auth_chain_d", "协议选择", cp)
elif (newprotocol=="11"):
Whether("该协议仅支持 Windows 客户端,是否要选择?(y/n)", "y", "n", writejson.WriteProtocol, "协议", "auth_chain_e", "协议选择", cp)
elif (newprotocol=="12"):
Whether("该协议仅支持 Windows 客户端,是否要选择?(y/n)", "y", "n", writejson.WriteProtocol, "协议", "auth_chain_f", "协议选择", cp)
elif (newprotocol=="13"):
Whether("该协议尚处试验阶段,仅支持 Windows 客户端,暂不支持移动客户端,是否要选择?(y/n)", "y", "n", writejson.WriteProtocol, "协议", "auth_akarin_rand", "协议选择", cp)
elif (newprotocol=="14"):
Whether("该协议尚处试验阶段,仅支持 Windows 客户端,暂不支持移动客户端,是否要选择?(y/n)", "y", "n", writejson.WriteProtocol, "协议", "auth_akarin_spec_a", "协议选择", cp)
else:
print("输入错误,请按 1 到 14 之间的数字!")
runpy(cp)