forked from bigbigbigboss/v2ray.fun-2
-
Notifications
You must be signed in to change notification settings - Fork 2
/
changesecurity.py
executable file
·45 lines (40 loc) · 1.06 KB
/
changesecurity.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
#! /usr/bin/env python
# -*- coding: utf-8 -*-
import readjson
import writejson
#判断是否为数字的函数
def is_number(s):
try:
float(s)
return True
except ValueError:
pass
try:
import unicodedata
unicodedata.numeric(s)
return True
except (TypeError, ValueError):
pass
return False
#主要程序部分
print ("当前加密方式为:%s") % str(readjson.ConfSecurity)
print ("请选择新的加密方式:")
print ("1.aes-128-cfb")
print ("2.aes-128-gcm")
print ("3.chacha20-poly1305")
print ("4.none")
newsecurity=raw_input()
if ( not is_number(newsecurity)):
print ("输入错误,请检查输入是否为数字")
exit
else:
if (newsecurity=="1"):
writejson.WriteSecurity("aes-128-cfb")
elif(newsecurity=="2"):
writejson.WriteSecurity("aes-128-gcm")
elif(newsecurity=="3"):
writejson.WriteSecurity("chacha20-poly1305")
elif(newsecurity=="4"):
writejson.WriteSecurity("none")
else:
print("请输入1-4之间的数字!")