mirror of https://github.com/midoks/mdserver-web
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
42 lines
960 B
42 lines
960 B
6 years ago
|
# coding: utf-8
|
||
|
|
||
|
import psutil
|
||
|
import time
|
||
|
import os
|
||
|
import sys
|
||
|
import public
|
||
|
import re
|
||
|
import json
|
||
|
import pwd
|
||
|
|
||
|
from flask import session
|
||
|
from flask import request
|
||
|
|
||
|
|
||
|
class ssl_api:
|
||
|
|
||
|
def __init__(self):
|
||
|
pass
|
||
|
|
||
|
##### ----- start ----- ###
|
||
|
# 获取证书列表
|
||
|
def getCertListApi(self):
|
||
|
try:
|
||
|
vpath = public.getServerDir() + '/ssl'
|
||
|
if not os.path.exists(vpath):
|
||
|
os.system('mkdir -p ' + vpath)
|
||
|
data = []
|
||
|
for d in os.listdir(vpath):
|
||
|
mpath = vpath + '/' + d + '/info.json'
|
||
|
if not os.path.exists(mpath):
|
||
|
continue
|
||
|
tmp = public.readFile(mpath)
|
||
|
if not tmp:
|
||
|
continue
|
||
|
tmp1 = json.loads(tmp)
|
||
|
data.append(tmp1)
|
||
|
return data
|
||
|
except:
|
||
|
return []
|
||
|
##### ----- end ----- ###
|