forked from bigbigbigboss/v2ray.fun-2
-
Notifications
You must be signed in to change notification settings - Fork 3
/
changetls.py
executable file
·48 lines (37 loc) · 1.07 KB
/
changetls.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
#! /usr/bin/env python
# -*- coding: utf-8 -*-
import readjson
import getssl
import writejson
import urllib2
def get_ip():
myip = urllib2.urlopen('https://api.ipify.org/').read()
myip = myip.strip()
return str(myip)
def open_tls():
print("请将您的域名解析到本VPS的IP地址,否则程序会出错!!")
print("本机器IP地址为:" + get_ip())
inputdomain = str(raw_input("请输入您绑定的域名:"))
print("")
print("正在获取SSL证书,请稍等。")
getssl.getssl(inputdomain)
writejson.WriteTLS("on", inputdomain)
print("操作完成!")
def close_tls():
writejson.WriteTLS("off", "")
print("操作完成!")
if (readjson.ConfStreamSecurity == "tls"):
mystreamsecurity = "TLS:开启"
else:
mystreamsecurity = "TLS:关闭"
print("当前状态:\n" + mystreamsecurity)
print("")
print("1.开启TLS")
print("2.关闭TLS")
choice = int(input("请输入数字选择功能:"))
if choice == 1:
open_tls()
elif choice == 2:
close_tls()
else:
print("输入错误,请重试!")