mirror of
https://github.com/midoks/mdserver-web.git
synced 2026-10-18 23:45:52 +08:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
44c6a4ffe3 | ||
|
|
1ff071a59f | ||
|
|
6ae756d5ea | ||
|
|
744f1eb524 | ||
|
|
c8494ddcb4 | ||
|
|
9633a54643 | ||
|
|
7e64e37ca2 | ||
|
|
14808a44e5 | ||
|
|
289c7765d4 | ||
|
|
37032d935f | ||
|
|
5378df1cf3 | ||
|
|
0c44305a01 | ||
|
|
9c4d482471 | ||
|
|
713f77c1ad | ||
|
|
db2b71582b | ||
|
|
ccc750cce3 | ||
|
|
0dc26232b6 | ||
|
|
fa0fc8eefe | ||
|
|
1cadcde740 | ||
|
|
a602cad2db | ||
|
|
0a400aeda9 | ||
|
|
aaca85bc7e | ||
|
|
fcba8a9269 | ||
|
|
8931a28286 | ||
|
|
8d4d72e14d | ||
|
|
fa40d1dc92 | ||
|
|
4007d14517 | ||
|
|
389db5404c | ||
|
|
763065e7ab | ||
|
|
c697f016aa | ||
|
|
1df3b8efd0 | ||
|
|
bfce862180 | ||
|
|
3f0cc58bdc | ||
|
|
710482e9ed | ||
|
|
49dc230feb | ||
|
|
bf6cca7b95 | ||
|
|
6281e7ae2d | ||
|
|
4f488ba75f | ||
|
|
1fa59d0a08 | ||
|
|
ccc9bd26c5 | ||
|
|
1436a508a5 | ||
|
|
a9aabdfa0c | ||
|
|
a6d2081d22 | ||
|
|
88dba0e876 | ||
|
|
88c9680682 | ||
|
|
1e1157159a | ||
|
|
b2fe48e1f2 | ||
|
|
e1b5d6f8b1 | ||
|
|
003a0bfacc | ||
|
|
08b73394ee | ||
|
|
ec9d4c050f | ||
|
|
6460a0d7db | ||
|
|
f709a033a5 | ||
|
|
851d6829ee | ||
|
|
8b5f2aec6b | ||
|
|
32f911c3cf | ||
|
|
ef74376c21 | ||
|
|
2752d758b5 | ||
|
|
296d4fb96d | ||
|
|
69f8a492c8 | ||
|
|
21cf32852b | ||
|
|
5eff5e7b1a | ||
|
|
9edd79e5f1 | ||
|
|
4c2a42fc48 | ||
|
|
10446a1934 | ||
|
|
3aeb2b0959 | ||
|
|
e9807280d5 | ||
|
|
395f8b456a | ||
|
|
ef7c9d4e47 |
@@ -11,4 +11,4 @@ try:
|
|||||||
HOST = '0.0.0.0'
|
HOST = '0.0.0.0'
|
||||||
socketio.run(app, host=HOST, port=PORT)
|
socketio.run(app, host=HOST, port=PORT)
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
print ex
|
print(ex)
|
||||||
|
|||||||
@@ -46,8 +46,8 @@ def initDB():
|
|||||||
for index in range(len(csql_list)):
|
for index in range(len(csql_list)):
|
||||||
sql.execute(csql_list[index], ())
|
sql.execute(csql_list[index], ())
|
||||||
|
|
||||||
except Exception, ex:
|
except Exception as ex:
|
||||||
print str(ex)
|
print(str(ex))
|
||||||
|
|
||||||
|
|
||||||
def initInitD():
|
def initInitD():
|
||||||
|
|||||||
@@ -278,7 +278,7 @@ class config_api:
|
|||||||
if len(cert_ca) > 100 and len(private_key) > 100:
|
if len(cert_ca) > 100 and len(private_key) > 100:
|
||||||
mw.writeFile('ssl/certificate.pem', cert_ca)
|
mw.writeFile('ssl/certificate.pem', cert_ca)
|
||||||
mw.writeFile('ssl/privateKey.pem', private_key)
|
mw.writeFile('ssl/privateKey.pem', private_key)
|
||||||
print cert_ca, private_key
|
print(cert_ca, private_key)
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|||||||
@@ -274,7 +274,7 @@ class crontab_api:
|
|||||||
|
|
||||||
# 取数据列表
|
# 取数据列表
|
||||||
def getDataListApi(self):
|
def getDataListApi(self):
|
||||||
stype = request.form.get('type', '').encode('utf-8')
|
stype = request.form.get('type', '')
|
||||||
if stype == 'databases':
|
if stype == 'databases':
|
||||||
db_list = {}
|
db_list = {}
|
||||||
db_list['orderOpt'] = []
|
db_list['orderOpt'] = []
|
||||||
|
|||||||
+8
-8
@@ -26,7 +26,7 @@ class Sql():
|
|||||||
try:
|
try:
|
||||||
if self.__DB_CONN == None:
|
if self.__DB_CONN == None:
|
||||||
self.__DB_CONN = sqlite3.connect(self.__DB_FILE)
|
self.__DB_CONN = sqlite3.connect(self.__DB_FILE)
|
||||||
except Exception, ex:
|
except Exception as ex:
|
||||||
return "error: " + str(ex)
|
return "error: " + str(ex)
|
||||||
|
|
||||||
def dbfile(self, name):
|
def dbfile(self, name):
|
||||||
@@ -96,7 +96,7 @@ class Sql():
|
|||||||
del(tmp)
|
del(tmp)
|
||||||
self.__close()
|
self.__close()
|
||||||
return data
|
return data
|
||||||
except Exception, ex:
|
except Exception as ex:
|
||||||
return "error: " + str(ex)
|
return "error: " + str(ex)
|
||||||
|
|
||||||
def getField(self, keyName):
|
def getField(self, keyName):
|
||||||
@@ -142,7 +142,7 @@ class Sql():
|
|||||||
self.__close()
|
self.__close()
|
||||||
self.__DB_CONN.commit()
|
self.__DB_CONN.commit()
|
||||||
return id
|
return id
|
||||||
except Exception, ex:
|
except Exception as ex:
|
||||||
return "error: " + str(ex)
|
return "error: " + str(ex)
|
||||||
|
|
||||||
def checkInput(self, data):
|
def checkInput(self, data):
|
||||||
@@ -176,7 +176,7 @@ class Sql():
|
|||||||
"(" + keys + ") " + "VALUES(" + values + ")"
|
"(" + keys + ") " + "VALUES(" + values + ")"
|
||||||
result = self.__DB_CONN.execute(sql, param)
|
result = self.__DB_CONN.execute(sql, param)
|
||||||
return True
|
return True
|
||||||
except Exception, ex:
|
except Exception as ex:
|
||||||
return "error: " + str(ex)
|
return "error: " + str(ex)
|
||||||
|
|
||||||
def commit(self):
|
def commit(self):
|
||||||
@@ -206,7 +206,7 @@ class Sql():
|
|||||||
self.__close()
|
self.__close()
|
||||||
self.__DB_CONN.commit()
|
self.__DB_CONN.commit()
|
||||||
return result.rowcount
|
return result.rowcount
|
||||||
except Exception, ex:
|
except Exception as ex:
|
||||||
return "error: " + str(ex)
|
return "error: " + str(ex)
|
||||||
|
|
||||||
def delete(self, id=None):
|
def delete(self, id=None):
|
||||||
@@ -221,7 +221,7 @@ class Sql():
|
|||||||
self.__close()
|
self.__close()
|
||||||
self.__DB_CONN.commit()
|
self.__DB_CONN.commit()
|
||||||
return result.rowcount
|
return result.rowcount
|
||||||
except Exception, ex:
|
except Exception as ex:
|
||||||
return "error: " + str(ex)
|
return "error: " + str(ex)
|
||||||
|
|
||||||
def execute(self, sql, param):
|
def execute(self, sql, param):
|
||||||
@@ -232,7 +232,7 @@ class Sql():
|
|||||||
result = self.__DB_CONN.execute(sql, param)
|
result = self.__DB_CONN.execute(sql, param)
|
||||||
self.__DB_CONN.commit()
|
self.__DB_CONN.commit()
|
||||||
return result.rowcount
|
return result.rowcount
|
||||||
except Exception, ex:
|
except Exception as ex:
|
||||||
return "error: " + str(ex)
|
return "error: " + str(ex)
|
||||||
|
|
||||||
def query(self, sql, param):
|
def query(self, sql, param):
|
||||||
@@ -243,7 +243,7 @@ class Sql():
|
|||||||
# 将元组转换成列表
|
# 将元组转换成列表
|
||||||
data = map(list, result)
|
data = map(list, result)
|
||||||
return data
|
return data
|
||||||
except Exception, ex:
|
except Exception as ex:
|
||||||
return "error: " + str(ex)
|
return "error: " + str(ex)
|
||||||
|
|
||||||
def create(self, name):
|
def create(self, name):
|
||||||
|
|||||||
+59
-57
@@ -25,11 +25,11 @@ class files_api:
|
|||||||
|
|
||||||
##### ----- start ----- ###
|
##### ----- start ----- ###
|
||||||
def getBodyApi(self):
|
def getBodyApi(self):
|
||||||
path = request.form.get('path', '').encode('utf-8')
|
path = request.form.get('path', '')
|
||||||
return self.getBody(path)
|
return self.getBody(path)
|
||||||
|
|
||||||
def getLastBodyApi(self):
|
def getLastBodyApi(self):
|
||||||
path = request.form.get('path', '').encode('utf-8')
|
path = request.form.get('path', '')
|
||||||
line = request.form.get('line', '100')
|
line = request.form.get('line', '100')
|
||||||
|
|
||||||
if not os.path.exists(path):
|
if not os.path.exists(path):
|
||||||
@@ -42,30 +42,30 @@ class files_api:
|
|||||||
return mw.returnJson(False, u'无法正确读取文件!' + str(ex))
|
return mw.returnJson(False, u'无法正确读取文件!' + str(ex))
|
||||||
|
|
||||||
def saveBodyApi(self):
|
def saveBodyApi(self):
|
||||||
path = request.form.get('path', '').encode('utf-8')
|
path = request.form.get('path', '')
|
||||||
data = request.form.get('data', '').encode('utf-8')
|
data = request.form.get('data', '')
|
||||||
encoding = request.form.get('encoding', '').encode('utf-8')
|
encoding = request.form.get('encoding', '')
|
||||||
return self.saveBody(path, data, encoding)
|
return self.saveBody(path, data, encoding)
|
||||||
|
|
||||||
def downloadApi(self):
|
def downloadApi(self):
|
||||||
filename = request.args.get('filename', '').encode('utf-8')
|
filename = request.args.get('filename', '')
|
||||||
if not os.path.exists(filename):
|
if not os.path.exists(filename):
|
||||||
return ''
|
return ''
|
||||||
response = make_response(send_from_directory(
|
response = make_response(send_from_directory(
|
||||||
os.path.dirname(filename).encode('utf-8'), os.path.basename(filename).encode('utf-8'), as_attachment=True))
|
os.path.dirname(filename), os.path.basename(filename), as_attachment=True))
|
||||||
return response
|
return response
|
||||||
|
|
||||||
def zipApi(self):
|
def zipApi(self):
|
||||||
sfile = request.form.get('sfile', '').encode('utf-8')
|
sfile = request.form.get('sfile', '')
|
||||||
dfile = request.form.get('dfile', '').encode('utf-8')
|
dfile = request.form.get('dfile', '')
|
||||||
stype = request.form.get('type', '').encode('utf-8')
|
stype = request.form.get('type', '')
|
||||||
path = request.form.get('path', '').encode('utf-8')
|
path = request.form.get('path', '')
|
||||||
return self.zip(sfile, dfile, stype, path)
|
return self.zip(sfile, dfile, stype, path)
|
||||||
|
|
||||||
# 移动文件或目录
|
# 移动文件或目录
|
||||||
def mvFileApi(self):
|
def mvFileApi(self):
|
||||||
sfile = request.form.get('sfile', '').encode('utf-8')
|
sfile = request.form.get('sfile', '')
|
||||||
dfile = request.form.get('dfile', '').encode('utf-8')
|
dfile = request.form.get('dfile', '')
|
||||||
if not self.checkFileName(dfile):
|
if not self.checkFileName(dfile):
|
||||||
return mw.returnJson(False, '文件名中不能包含特殊字符!')
|
return mw.returnJson(False, '文件名中不能包含特殊字符!')
|
||||||
if not os.path.exists(sfile):
|
if not os.path.exists(sfile):
|
||||||
@@ -84,11 +84,11 @@ class files_api:
|
|||||||
return mw.returnJson(False, '移动文件或目录失败!')
|
return mw.returnJson(False, '移动文件或目录失败!')
|
||||||
|
|
||||||
def deleteApi(self):
|
def deleteApi(self):
|
||||||
path = request.form.get('path', '').encode('utf-8')
|
path = request.form.get('path', '')
|
||||||
return self.delete(path)
|
return self.delete(path)
|
||||||
|
|
||||||
def fileAccessApi(self):
|
def fileAccessApi(self):
|
||||||
filename = request.form.get('filename', '').encode('utf-8')
|
filename = request.form.get('filename', '')
|
||||||
data = self.getAccess(filename)
|
data = self.getAccess(filename)
|
||||||
return mw.getJson(data)
|
return mw.getJson(data)
|
||||||
|
|
||||||
@@ -97,8 +97,8 @@ class files_api:
|
|||||||
if mw.isAppleSystem():
|
if mw.isAppleSystem():
|
||||||
return mw.returnJson(True, '开发机不设置!')
|
return mw.returnJson(True, '开发机不设置!')
|
||||||
|
|
||||||
filename = request.form.get('filename', '').encode('utf-8')
|
filename = request.form.get('filename', '')
|
||||||
user = request.form.get('user', '').encode('utf-8')
|
user = request.form.get('user', '')
|
||||||
access = request.form.get('access', '755')
|
access = request.form.get('access', '755')
|
||||||
sall = '-R'
|
sall = '-R'
|
||||||
try:
|
try:
|
||||||
@@ -119,12 +119,13 @@ class files_api:
|
|||||||
return mw.returnJson(False, '设置失败!')
|
return mw.returnJson(False, '设置失败!')
|
||||||
|
|
||||||
def getDirSizeApi(self):
|
def getDirSizeApi(self):
|
||||||
path = request.form.get('path', '').encode('utf-8')
|
path = request.form.get('path', '')
|
||||||
tmp = self.getDirSize(path)
|
tmp = self.getDirSize(path)
|
||||||
|
print(tmp)
|
||||||
return mw.returnJson(True, tmp[0].split()[0])
|
return mw.returnJson(True, tmp[0].split()[0])
|
||||||
|
|
||||||
def getDirApi(self):
|
def getDirApi(self):
|
||||||
path = request.form.get('path', '').encode('utf-8')
|
path = request.form.get('path', '')
|
||||||
if not os.path.exists(path):
|
if not os.path.exists(path):
|
||||||
path = mw.getRootDir() + "/wwwroot"
|
path = mw.getRootDir() + "/wwwroot"
|
||||||
search = request.args.get('search', '').strip().lower()
|
search = request.args.get('search', '').strip().lower()
|
||||||
@@ -137,7 +138,7 @@ class files_api:
|
|||||||
return self.getDir(path, int(page), int(row), search)
|
return self.getDir(path, int(page), int(row), search)
|
||||||
|
|
||||||
def createFileApi(self):
|
def createFileApi(self):
|
||||||
file = request.form.get('path', '').encode('utf-8')
|
file = request.form.get('path', '')
|
||||||
try:
|
try:
|
||||||
if not self.checkFileName(file):
|
if not self.checkFileName(file):
|
||||||
return mw.returnJson(False, '文件名中不能包含特殊字符!')
|
return mw.returnJson(False, '文件名中不能包含特殊字符!')
|
||||||
@@ -156,7 +157,7 @@ class files_api:
|
|||||||
return mw.returnJson(True, '文件创建失败!')
|
return mw.returnJson(True, '文件创建失败!')
|
||||||
|
|
||||||
def createDirApi(self):
|
def createDirApi(self):
|
||||||
path = request.form.get('path', '').encode('utf-8')
|
path = request.form.get('path', '')
|
||||||
try:
|
try:
|
||||||
if not self.checkFileName(path):
|
if not self.checkFileName(path):
|
||||||
return mw.returnJson(False, '目录名中不能包含特殊字符!')
|
return mw.returnJson(False, '目录名中不能包含特殊字符!')
|
||||||
@@ -173,9 +174,9 @@ class files_api:
|
|||||||
def downloadFileApi(self):
|
def downloadFileApi(self):
|
||||||
import db
|
import db
|
||||||
import time
|
import time
|
||||||
url = request.form.get('url', '').encode('utf-8')
|
url = request.form.get('url', '')
|
||||||
path = request.form.get('path', '').encode('utf-8')
|
path = request.form.get('path', '')
|
||||||
filename = request.form.get('filename', '').encode('utf-8')
|
filename = request.form.get('filename', '')
|
||||||
|
|
||||||
isTask = mw.getRootDir() + '/tmp/panelTask.pl'
|
isTask = mw.getRootDir() + '/tmp/panelTask.pl'
|
||||||
execstr = url + '|mw|' + path + '/' + filename
|
execstr = url + '|mw|' + path + '/' + filename
|
||||||
@@ -186,7 +187,7 @@ class files_api:
|
|||||||
return mw.returnJson(True, '已将下载任务添加到队列!')
|
return mw.returnJson(True, '已将下载任务添加到队列!')
|
||||||
|
|
||||||
def removeTaskApi(self):
|
def removeTaskApi(self):
|
||||||
mid = request.form.get('id', '').encode('utf-8')
|
mid = request.form.get('id', '')
|
||||||
try:
|
try:
|
||||||
name = mw.M('tasks').where('id=?', (mid,)).getField('name')
|
name = mw.M('tasks').where('id=?', (mid,)).getField('name')
|
||||||
status = mw.M('tasks').where('id=?', (mid,)).getField('status')
|
status = mw.M('tasks').where('id=?', (mid,)).getField('status')
|
||||||
@@ -220,14 +221,13 @@ done
|
|||||||
from werkzeug.utils import secure_filename
|
from werkzeug.utils import secure_filename
|
||||||
from flask import request
|
from flask import request
|
||||||
|
|
||||||
path = request.args.get('path', '').encode('utf-8')
|
path = request.args.get('path', '')
|
||||||
|
|
||||||
if not os.path.exists(path):
|
if not os.path.exists(path):
|
||||||
os.makedirs(path)
|
os.makedirs(path)
|
||||||
f = request.files['zunfile']
|
f = request.files['zunfile']
|
||||||
filename = os.path.join(path, f.filename)
|
filename = os.path.join(path, f.filename)
|
||||||
if sys.version_info[0] == 2:
|
|
||||||
filename = filename.encode('utf-8')
|
|
||||||
s_path = path
|
s_path = path
|
||||||
if os.path.exists(filename):
|
if os.path.exists(filename):
|
||||||
s_path = filename
|
s_path = filename
|
||||||
@@ -272,14 +272,15 @@ done
|
|||||||
data['dirs'].append(tmp)
|
data['dirs'].append(tmp)
|
||||||
else:
|
else:
|
||||||
data['files'].append(tmp)
|
data['files'].append(tmp)
|
||||||
except:
|
except Exception as e:
|
||||||
|
print(e)
|
||||||
continue
|
continue
|
||||||
return mw.returnJson(True, 'OK', data)
|
return mw.returnJson(True, 'OK', data)
|
||||||
|
|
||||||
# 回收站开关
|
# 回收站开关
|
||||||
def recycleBinApi(self):
|
def recycleBinApi(self):
|
||||||
c = 'data/recycle_bin.pl'
|
c = 'data/recycle_bin.pl'
|
||||||
db = request.form.get('db', '').encode('utf-8')
|
db = request.form.get('db', '')
|
||||||
if db != '':
|
if db != '':
|
||||||
c = 'data/recycle_bin_db.pl'
|
c = 'data/recycle_bin_db.pl'
|
||||||
if os.path.exists(c):
|
if os.path.exists(c):
|
||||||
@@ -293,7 +294,7 @@ done
|
|||||||
|
|
||||||
def reRecycleBinApi(self):
|
def reRecycleBinApi(self):
|
||||||
rPath = self.rPath
|
rPath = self.rPath
|
||||||
path = request.form.get('path', '').encode('utf-8')
|
path = request.form.get('path', '')
|
||||||
dFile = path.replace('_mw_', '/').split('_t_')[0]
|
dFile = path.replace('_mw_', '/').split('_t_')[0]
|
||||||
try:
|
try:
|
||||||
import shutil
|
import shutil
|
||||||
@@ -308,8 +309,8 @@ done
|
|||||||
|
|
||||||
def delRecycleBinApi(self):
|
def delRecycleBinApi(self):
|
||||||
rPath = self.rPath
|
rPath = self.rPath
|
||||||
path = request.form.get('path', '').encode('utf-8')
|
path = request.form.get('path', '')
|
||||||
empty = request.form.get('empty', '').encode('utf-8')
|
empty = request.form.get('empty', '')
|
||||||
dFile = path.split('_t_')[0]
|
dFile = path.split('_t_')[0]
|
||||||
|
|
||||||
if not self.checkDir(path):
|
if not self.checkDir(path):
|
||||||
@@ -351,7 +352,7 @@ done
|
|||||||
return mw.returnJson(True, '已清空回收站!')
|
return mw.returnJson(True, '已清空回收站!')
|
||||||
|
|
||||||
def deleteDirApi(self):
|
def deleteDirApi(self):
|
||||||
path = request.form.get('path', '').encode('utf-8')
|
path = request.form.get('path', '')
|
||||||
if not os.path.exists(path):
|
if not os.path.exists(path):
|
||||||
return mw.returnJson(False, '指定文件不存在!')
|
return mw.returnJson(False, '指定文件不存在!')
|
||||||
|
|
||||||
@@ -378,10 +379,10 @@ done
|
|||||||
return mw.returnJson(True, tmp[0].split()[0])
|
return mw.returnJson(True, tmp[0].split()[0])
|
||||||
|
|
||||||
def setBatchDataApi(self):
|
def setBatchDataApi(self):
|
||||||
path = request.form.get('path', '').encode('utf-8')
|
path = request.form.get('path', '')
|
||||||
stype = request.form.get('type', '').encode('utf-8')
|
stype = request.form.get('type', '')
|
||||||
access = request.form.get('access', '').encode('utf-8')
|
access = request.form.get('access', '')
|
||||||
user = request.form.get('user', '').encode('utf-8')
|
user = request.form.get('user', '')
|
||||||
data = request.form.get('data')
|
data = request.form.get('data')
|
||||||
if stype == '1' or stype == '2':
|
if stype == '1' or stype == '2':
|
||||||
session['selected'] = {
|
session['selected'] = {
|
||||||
@@ -395,7 +396,6 @@ done
|
|||||||
elif stype == '3':
|
elif stype == '3':
|
||||||
for key in json.loads(data):
|
for key in json.loads(data):
|
||||||
try:
|
try:
|
||||||
key = key.encode('utf-8')
|
|
||||||
filename = path + '/' + key
|
filename = path + '/' + key
|
||||||
if not self.checkDir(filename):
|
if not self.checkDir(filename):
|
||||||
return mw.returnJson(False, 'FILE_DANGER')
|
return mw.returnJson(False, 'FILE_DANGER')
|
||||||
@@ -414,7 +414,7 @@ done
|
|||||||
i = 0
|
i = 0
|
||||||
for key in data:
|
for key in data:
|
||||||
try:
|
try:
|
||||||
filename = path + '/' + key.encode('utf-8')
|
filename = path + '/' + key
|
||||||
topath = filename
|
topath = filename
|
||||||
if not os.path.exists(filename):
|
if not os.path.exists(filename):
|
||||||
continue
|
continue
|
||||||
@@ -442,8 +442,8 @@ done
|
|||||||
return mw.returnJson(True, '批量删除成功!')
|
return mw.returnJson(True, '批量删除成功!')
|
||||||
|
|
||||||
def checkExistsFilesApi(self):
|
def checkExistsFilesApi(self):
|
||||||
dfile = request.form.get('dfile', '').encode('utf-8')
|
dfile = request.form.get('dfile', '')
|
||||||
filename = request.form.get('filename', '').encode('utf-8')
|
filename = request.form.get('filename', '')
|
||||||
data = []
|
data = []
|
||||||
filesx = []
|
filesx = []
|
||||||
if filename == '':
|
if filename == '':
|
||||||
@@ -451,7 +451,7 @@ done
|
|||||||
else:
|
else:
|
||||||
filesx.append(filename)
|
filesx.append(filename)
|
||||||
|
|
||||||
print filesx
|
# print(filesx)
|
||||||
|
|
||||||
for fn in filesx:
|
for fn in filesx:
|
||||||
if fn == '.':
|
if fn == '.':
|
||||||
@@ -467,9 +467,9 @@ done
|
|||||||
return mw.returnJson(True, 'ok', data)
|
return mw.returnJson(True, 'ok', data)
|
||||||
|
|
||||||
def batchPasteApi(self):
|
def batchPasteApi(self):
|
||||||
path = request.form.get('path', '').encode('utf-8')
|
path = request.form.get('path', '')
|
||||||
stype = request.form.get('type', '').encode('utf-8')
|
stype = request.form.get('type', '')
|
||||||
# filename = request.form.get('filename', '').encode('utf-8')
|
# filename = request.form.get('filename', '')
|
||||||
import shutil
|
import shutil
|
||||||
if not self.checkDir(path):
|
if not self.checkDir(path):
|
||||||
return mw.returnJson(False, '请不要花样作死!')
|
return mw.returnJson(False, '请不要花样作死!')
|
||||||
@@ -483,8 +483,8 @@ done
|
|||||||
try:
|
try:
|
||||||
|
|
||||||
sfile = session['selected'][
|
sfile = session['selected'][
|
||||||
'path'] + '/' + key.encode('utf-8')
|
'path'] + '/' + key
|
||||||
dfile = path + '/' + key.encode('utf-8')
|
dfile = path + '/' + key
|
||||||
|
|
||||||
if os.path.isdir(sfile):
|
if os.path.isdir(sfile):
|
||||||
shutil.copytree(sfile, dfile)
|
shutil.copytree(sfile, dfile)
|
||||||
@@ -504,8 +504,8 @@ done
|
|||||||
mw.writeSpeed(key, i, l)
|
mw.writeSpeed(key, i, l)
|
||||||
|
|
||||||
sfile = session['selected'][
|
sfile = session['selected'][
|
||||||
'path'] + '/' + key.encode('utf-8')
|
'path'] + '/' + key
|
||||||
dfile = path + '/' + key.encode('utf-8')
|
dfile = path + '/' + key
|
||||||
|
|
||||||
shutil.move(sfile, dfile)
|
shutil.move(sfile, dfile)
|
||||||
except:
|
except:
|
||||||
@@ -520,8 +520,8 @@ done
|
|||||||
return mw.returnJson(True, msg)
|
return mw.returnJson(True, msg)
|
||||||
|
|
||||||
def copyFileApi(self):
|
def copyFileApi(self):
|
||||||
sfile = request.form.get('sfile', '').encode('utf-8')
|
sfile = request.form.get('sfile', '')
|
||||||
dfile = request.form.get('dfile', '').encode('utf-8')
|
dfile = request.form.get('dfile', '')
|
||||||
|
|
||||||
if not os.path.exists(sfile):
|
if not os.path.exists(sfile):
|
||||||
return mw.returnJson(False, '指定文件不存在!')
|
return mw.returnJson(False, '指定文件不存在!')
|
||||||
@@ -562,6 +562,7 @@ done
|
|||||||
|
|
||||||
# 检查敏感目录
|
# 检查敏感目录
|
||||||
def checkDir(self, path):
|
def checkDir(self, path):
|
||||||
|
path = str(path, encoding='utf-8')
|
||||||
path = path.replace('//', '/')
|
path = path.replace('//', '/')
|
||||||
if path[-1:] == '/':
|
if path[-1:] == '/':
|
||||||
path = path[:-1]
|
path = path[:-1]
|
||||||
@@ -806,9 +807,8 @@ done
|
|||||||
break
|
break
|
||||||
if i < pageObj[1].SHIFT:
|
if i < pageObj[1].SHIFT:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
try:
|
try:
|
||||||
filePath = (path + '/' + filename).encode('utf8')
|
filePath = path + '/' + filename
|
||||||
link = ''
|
link = ''
|
||||||
if os.path.islink(filePath):
|
if os.path.islink(filePath):
|
||||||
filePath = os.readlink(filePath)
|
filePath = os.readlink(filePath)
|
||||||
@@ -824,8 +824,9 @@ done
|
|||||||
user = ''
|
user = ''
|
||||||
try:
|
try:
|
||||||
user = pwd.getpwuid(stat.st_uid).pw_name
|
user = pwd.getpwuid(stat.st_uid).pw_name
|
||||||
except:
|
except Exception as ee:
|
||||||
user = str(stat.st_uid)
|
user = str(stat.st_uid)
|
||||||
|
|
||||||
size = str(stat.st_size)
|
size = str(stat.st_size)
|
||||||
if os.path.isdir(filePath):
|
if os.path.isdir(filePath):
|
||||||
dirnames.append(filename + ';' + size + ';' +
|
dirnames.append(filename + ';' + size + ';' +
|
||||||
@@ -834,10 +835,11 @@ done
|
|||||||
filenames.append(filename + ';' + size + ';' +
|
filenames.append(filename + ';' + size + ';' +
|
||||||
mtime + ';' + accept + ';' + user + ';' + link)
|
mtime + ';' + accept + ';' + user + ';' + link)
|
||||||
n += 1
|
n += 1
|
||||||
except:
|
except Exception as e:
|
||||||
|
print('getdir:dd.', e)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
data['DIR'] = sorted(dirnames)
|
data['DIR'] = sorted(dirnames)
|
||||||
data['FILES'] = sorted(filenames)
|
data['FILES'] = sorted(filenames)
|
||||||
data['PATH'] = path.replace('//', '/')
|
data['PATH'] = path.replace('//', '/')
|
||||||
|
|
||||||
return mw.getJson(data)
|
return mw.getJson(data)
|
||||||
|
|||||||
+22
-11
@@ -10,7 +10,6 @@ import shlex
|
|||||||
import datetime
|
import datetime
|
||||||
import subprocess
|
import subprocess
|
||||||
import re
|
import re
|
||||||
import hashlib
|
|
||||||
|
|
||||||
import db
|
import db
|
||||||
|
|
||||||
@@ -35,8 +34,18 @@ def execShell(cmdstring, cwd=None, timeout=None, shell=True):
|
|||||||
if end_time <= datetime.datetime.now():
|
if end_time <= datetime.datetime.now():
|
||||||
raise Exception("Timeout:%s" % cmdstring)
|
raise Exception("Timeout:%s" % cmdstring)
|
||||||
|
|
||||||
|
if sys.version_info[0] == 2:
|
||||||
return sub.communicate()
|
return sub.communicate()
|
||||||
|
|
||||||
|
data = sub.communicate()
|
||||||
|
# python3 fix 返回byte数据
|
||||||
|
if isinstance(data[0], bytes):
|
||||||
|
t1 = str(data[0], encoding='utf-8')
|
||||||
|
|
||||||
|
if isinstance(data[1], bytes):
|
||||||
|
t2 = str(data[1], encoding='utf-8')
|
||||||
|
return (t1, t2)
|
||||||
|
|
||||||
|
|
||||||
def getRunDir():
|
def getRunDir():
|
||||||
return os.getcwd()
|
return os.getcwd()
|
||||||
@@ -143,19 +152,19 @@ def getPageObject(args, result='1,2,3,4,5,8'):
|
|||||||
info = {}
|
info = {}
|
||||||
|
|
||||||
info['count'] = 0
|
info['count'] = 0
|
||||||
if args.has_key('count'):
|
if 'count' in args:
|
||||||
info['count'] = int(args['count'])
|
info['count'] = int(args['count'])
|
||||||
|
|
||||||
info['row'] = 10
|
info['row'] = 10
|
||||||
if args.has_key('row'):
|
if 'row' in args:
|
||||||
info['row'] = int(args['row'])
|
info['row'] = int(args['row'])
|
||||||
|
|
||||||
info['p'] = 1
|
info['p'] = 1
|
||||||
if args.has_key('p'):
|
if 'p' in args:
|
||||||
info['p'] = int(args['p'])
|
info['p'] = int(args['p'])
|
||||||
info['uri'] = {}
|
info['uri'] = {}
|
||||||
info['return_js'] = ''
|
info['return_js'] = ''
|
||||||
if args.has_key('tojs'):
|
if 'tojs' in args:
|
||||||
info['return_js'] = args['tojs']
|
info['return_js'] = args['tojs']
|
||||||
|
|
||||||
return (page.GetPage(info, result), page)
|
return (page.GetPage(info, result), page)
|
||||||
@@ -165,9 +174,10 @@ def md5(str):
|
|||||||
# 生成MD5
|
# 生成MD5
|
||||||
try:
|
try:
|
||||||
m = hashlib.md5()
|
m = hashlib.md5()
|
||||||
m.update(str)
|
m.update(str.encode("utf-8"))
|
||||||
return m.hexdigest()
|
return m.hexdigest()
|
||||||
except:
|
except Exception as ex:
|
||||||
|
print(ex)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
@@ -273,7 +283,8 @@ def readFile(filename):
|
|||||||
fBody = fp.read()
|
fBody = fp.read()
|
||||||
fp.close()
|
fp.close()
|
||||||
return fBody
|
return fBody
|
||||||
except:
|
except Exception as e:
|
||||||
|
# print('readFile:', e)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
@@ -301,7 +312,7 @@ def writeLog(type, logMsg, args=()):
|
|||||||
data = (type, logMsg, mDate)
|
data = (type, logMsg, mDate)
|
||||||
result = sql.table('logs').add('type,log,addtime', data)
|
result = sql.table('logs').add('type,log,addtime', data)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print e
|
print(e)
|
||||||
|
|
||||||
|
|
||||||
def writeFile(filename, str):
|
def writeFile(filename, str):
|
||||||
@@ -529,8 +540,8 @@ def downloadFile(url, filename):
|
|||||||
|
|
||||||
def downloadHook(count, blockSize, totalSize):
|
def downloadHook(count, blockSize, totalSize):
|
||||||
speed = {'total': totalSize, 'block': blockSize, 'count': count}
|
speed = {'total': totalSize, 'block': blockSize, 'count': count}
|
||||||
print speed
|
print(speed)
|
||||||
print '%02d%%' % (100.0 * count * blockSize / totalSize)
|
print('%02d%%' % (100.0 * count * blockSize / totalSize))
|
||||||
|
|
||||||
|
|
||||||
def getLocalIp():
|
def getLocalIp():
|
||||||
|
|||||||
+27
-23
@@ -55,7 +55,6 @@ class Page():
|
|||||||
self.SHIFT = self.__START_NUM - 1
|
self.SHIFT = self.__START_NUM - 1
|
||||||
|
|
||||||
keys = limit.split(',')
|
keys = limit.split(',')
|
||||||
|
|
||||||
pages = {}
|
pages = {}
|
||||||
# 起始页
|
# 起始页
|
||||||
pages['1'] = self.__GetStart()
|
pages['1'] = self.__GetStart()
|
||||||
@@ -70,14 +69,16 @@ class Page():
|
|||||||
|
|
||||||
# 当前显示页与总页数
|
# 当前显示页与总页数
|
||||||
pages['6'] = "<span class='Pnumber'>" + \
|
pages['6'] = "<span class='Pnumber'>" + \
|
||||||
bytes(self.__C_PAGE) + "/" + bytes(self.__COUNT_PAGE) + "</span>"
|
str(self.__C_PAGE) + "/" + \
|
||||||
|
str(self.__COUNT_PAGE) + "</span>"
|
||||||
|
|
||||||
# 本页显示开始与结束行
|
# 本页显示开始与结束行
|
||||||
pages['7'] = "<span class='Pline'>" + self.__FO + \
|
pages['7'] = "<span class='Pline'>" + str(self.__FO) + \
|
||||||
bytes(self.__START_NUM) + "-" + \
|
str(self.__START_NUM) + "-" + \
|
||||||
bytes(self.__END_NUM) + self.__LINE + "</span>"
|
str(self.__END_NUM) + str(self.__LINE) + "</span>"
|
||||||
# 行数
|
# 行数
|
||||||
pages['8'] = "<span class='Pcount'>" + self.__COUNT_START + \
|
pages['8'] = "<span class='Pcount'>" + str(self.__COUNT_START) + \
|
||||||
bytes(self.__COUNT_ROW) + self.__COUNT_END + "</span>"
|
str(self.__COUNT_ROW) + str(self.__COUNT_END) + "</span>"
|
||||||
|
|
||||||
# 构造返回数据
|
# 构造返回数据
|
||||||
retuls = '<div>'
|
retuls = '<div>'
|
||||||
@@ -96,10 +97,11 @@ class Page():
|
|||||||
else:
|
else:
|
||||||
if self.__RTURN_JS == "":
|
if self.__RTURN_JS == "":
|
||||||
endStr = "<a class='Pend' href='" + self.__URI + "p=" + \
|
endStr = "<a class='Pend' href='" + self.__URI + "p=" + \
|
||||||
bytes(self.__COUNT_PAGE) + "'>" + self.__END + "</a>"
|
str(self.__COUNT_PAGE) + "'>" + str(self.__END) + "</a>"
|
||||||
else:
|
else:
|
||||||
endStr = "<a class='Pend' onclick='" + self.__RTURN_JS + \
|
endStr = "<a class='Pend' onclick='" + self.__RTURN_JS + \
|
||||||
"(" + bytes(self.__COUNT_PAGE) + ")'>" + self.__END + "</a>"
|
"(" + str(self.__COUNT_PAGE) + ")'>" + \
|
||||||
|
str(self.__END) + "</a>"
|
||||||
return endStr
|
return endStr
|
||||||
|
|
||||||
def __GetNext(self):
|
def __GetNext(self):
|
||||||
@@ -110,10 +112,11 @@ class Page():
|
|||||||
else:
|
else:
|
||||||
if self.__RTURN_JS == "":
|
if self.__RTURN_JS == "":
|
||||||
nextStr = "<a class='Pnext' href='" + self.__URI + "p=" + \
|
nextStr = "<a class='Pnext' href='" + self.__URI + "p=" + \
|
||||||
bytes(self.__C_PAGE + 1) + "'>" + self.__NEXT + "</a>"
|
str(self.__C_PAGE + 1) + "'>" + str(self.__NEXT) + "</a>"
|
||||||
else:
|
else:
|
||||||
nextStr = "<a class='Pnext' onclick='" + self.__RTURN_JS + \
|
nextStr = "<a class='Pnext' onclick='" + self.__RTURN_JS + \
|
||||||
"(" + bytes(self.__C_PAGE + 1) + ")'>" + self.__NEXT + "</a>"
|
"(" + str(self.__C_PAGE + 1) + ")'>" + \
|
||||||
|
str(self.__NEXT) + "</a>"
|
||||||
|
|
||||||
return nextStr
|
return nextStr
|
||||||
|
|
||||||
@@ -134,15 +137,15 @@ class Page():
|
|||||||
if page > 0:
|
if page > 0:
|
||||||
if self.__RTURN_JS == "":
|
if self.__RTURN_JS == "":
|
||||||
pages += "<a class='Pnum' href='" + self.__URI + \
|
pages += "<a class='Pnum' href='" + self.__URI + \
|
||||||
"p=" + bytes(page) + "'>" + bytes(page) + "</a>"
|
"p=" + str(page) + "'>" + str(page) + "</a>"
|
||||||
else:
|
else:
|
||||||
pages += "<a class='Pnum' onclick='" + self.__RTURN_JS + \
|
pages += "<a class='Pnum' onclick='" + self.__RTURN_JS + \
|
||||||
"(" + bytes(page) + ")'>" + bytes(page) + "</a>"
|
"(" + str(page) + ")'>" + str(page) + "</a>"
|
||||||
|
|
||||||
# 当前页
|
# 当前页
|
||||||
if self.__C_PAGE > 0:
|
if self.__C_PAGE > 0:
|
||||||
pages += "<span class='Pcurrent'>" + \
|
pages += "<span class='Pcurrent'>" + \
|
||||||
bytes(self.__C_PAGE) + "</span>"
|
str(self.__C_PAGE) + "</span>"
|
||||||
|
|
||||||
# 当前页之后
|
# 当前页之后
|
||||||
if self.__C_PAGE <= self.__LIST_NUM:
|
if self.__C_PAGE <= self.__LIST_NUM:
|
||||||
@@ -157,10 +160,10 @@ class Page():
|
|||||||
break
|
break
|
||||||
if self.__RTURN_JS == "":
|
if self.__RTURN_JS == "":
|
||||||
pages += "<a class='Pnum' href='" + self.__URI + \
|
pages += "<a class='Pnum' href='" + self.__URI + \
|
||||||
"p=" + bytes(page) + "'>" + bytes(page) + "</a>"
|
"p=" + str(page) + "'>" + str(page) + "</a>"
|
||||||
else:
|
else:
|
||||||
pages += "<a class='Pnum' onclick='" + self.__RTURN_JS + \
|
pages += "<a class='Pnum' onclick='" + self.__RTURN_JS + \
|
||||||
"(" + bytes(page) + ")'>" + bytes(page) + "</a>"
|
"(" + str(page) + ")'>" + str(page) + "</a>"
|
||||||
|
|
||||||
return pages
|
return pages
|
||||||
|
|
||||||
@@ -172,10 +175,11 @@ class Page():
|
|||||||
else:
|
else:
|
||||||
if self.__RTURN_JS == "":
|
if self.__RTURN_JS == "":
|
||||||
startStr = "<a class='Ppren' href='" + self.__URI + "p=" + \
|
startStr = "<a class='Ppren' href='" + self.__URI + "p=" + \
|
||||||
bytes(self.__C_PAGE - 1) + "'>" + self.__PREV + "</a>"
|
str(self.__C_PAGE - 1) + "'>" + str(self.__PREV) + "</a>"
|
||||||
else:
|
else:
|
||||||
startStr = "<a class='Ppren' onclick='" + self.__RTURN_JS + \
|
startStr = "<a class='Ppren' onclick='" + self.__RTURN_JS + \
|
||||||
"(" + bytes(self.__C_PAGE - 1) + ")'>" + self.__PREV + "</a>"
|
"(" + str(self.__C_PAGE - 1) + ")'>" + \
|
||||||
|
str(self.__PREV) + "</a>"
|
||||||
return startStr
|
return startStr
|
||||||
|
|
||||||
def __GetStart(self):
|
def __GetStart(self):
|
||||||
@@ -186,10 +190,10 @@ class Page():
|
|||||||
else:
|
else:
|
||||||
if self.__RTURN_JS == "":
|
if self.__RTURN_JS == "":
|
||||||
startStr = "<a class='Pstart' href='" + \
|
startStr = "<a class='Pstart' href='" + \
|
||||||
self.__URI + "p=1'>" + self.__START + "</a>"
|
self.__URI + "p=1'>" + str(self.__START) + "</a>"
|
||||||
else:
|
else:
|
||||||
startStr = "<a class='Pstart' onclick='" + \
|
startStr = "<a class='Pstart' onclick='" + \
|
||||||
self.__RTURN_JS + "(1)'>" + self.__START + "</a>"
|
self.__RTURN_JS + "(1)'>" + str(self.__START) + "</a>"
|
||||||
return startStr
|
return startStr
|
||||||
|
|
||||||
def __GetCpage(self, p):
|
def __GetCpage(self, p):
|
||||||
@@ -212,11 +216,11 @@ class Page():
|
|||||||
# 取总页数
|
# 取总页数
|
||||||
return int(math.ceil(self.__COUNT_ROW / float(self.ROW)))
|
return int(math.ceil(self.__COUNT_ROW / float(self.ROW)))
|
||||||
|
|
||||||
def __SetUri(self, input):
|
def __SetUri(self, sinput):
|
||||||
# 构造URI
|
# 构造URI
|
||||||
uri = '?'
|
uri = '?'
|
||||||
for key in input:
|
for key in sinput:
|
||||||
if key == 'p':
|
if key == 'p':
|
||||||
continue
|
continue
|
||||||
uri += key + '=' + input[key] + '&'
|
uri += key + '=' + sinput[key] + '&'
|
||||||
return str(uri)
|
return str(uri)
|
||||||
|
|||||||
+27
-23
@@ -8,8 +8,9 @@ import re
|
|||||||
import json
|
import json
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
reload(sys)
|
|
||||||
sys.setdefaultencoding('utf8')
|
# reload(sys)
|
||||||
|
# sys.setdefaultencoding('utf8')
|
||||||
|
|
||||||
import threading
|
import threading
|
||||||
import multiprocessing
|
import multiprocessing
|
||||||
@@ -61,11 +62,11 @@ class plugins_api:
|
|||||||
if f.strip() == '':
|
if f.strip() == '':
|
||||||
return ''
|
return ''
|
||||||
|
|
||||||
file = self.__plugin_dir + '/' + name + '/' + f
|
file = mw.getPluginDir() + '/' + name + '/' + f
|
||||||
if not os.path.exists(file):
|
if not os.path.exists(file):
|
||||||
return ''
|
return ''
|
||||||
|
|
||||||
c = mw.readFile(file)
|
c = open(file, 'rb').read()
|
||||||
return c
|
return c
|
||||||
|
|
||||||
def indexListApi(self):
|
def indexListApi(self):
|
||||||
@@ -166,8 +167,8 @@ class plugins_api:
|
|||||||
|
|
||||||
data = mw.execShell(execstr)
|
data = mw.execShell(execstr)
|
||||||
if mw.isAppleSystem():
|
if mw.isAppleSystem():
|
||||||
print execstr
|
print(execstr)
|
||||||
print data[0], data[1]
|
print(data[0], data[1])
|
||||||
return mw.returnJson(True, '卸载执行成功!')
|
return mw.returnJson(True, '卸载执行成功!')
|
||||||
# if data[1] == '':
|
# if data[1] == '':
|
||||||
# return mw.returnJson(True, '已将卸载成功!')
|
# return mw.returnJson(True, '已将卸载成功!')
|
||||||
@@ -206,8 +207,10 @@ class plugins_api:
|
|||||||
|
|
||||||
data = self.run(name, func, version, args, script)
|
data = self.run(name, func, version, args, script)
|
||||||
if data[1] == '':
|
if data[1] == '':
|
||||||
return mw.returnJson(True, "OK", data[0].strip())
|
r = mw.returnJson(True, "OK", data[0].strip())
|
||||||
return mw.returnJson(False, data[1].strip())
|
else:
|
||||||
|
r = mw.returnJson(False, data[1].strip())
|
||||||
|
return r
|
||||||
|
|
||||||
def callbackApi(self):
|
def callbackApi(self):
|
||||||
name = request.form.get('name', '')
|
name = request.form.get('name', '')
|
||||||
@@ -284,7 +287,7 @@ class plugins_api:
|
|||||||
return mw.returnJson(False, '临时文件不存在,请重新上传!')
|
return mw.returnJson(False, '临时文件不存在,请重新上传!')
|
||||||
plugin_path = mw.getPluginDir() + '/' + plugin_name
|
plugin_path = mw.getPluginDir() + '/' + plugin_name
|
||||||
if not os.path.exists(plugin_path):
|
if not os.path.exists(plugin_path):
|
||||||
print mw.execShell('mkdir -p ' + plugin_path)
|
print(mw.execShell('mkdir -p ' + plugin_path))
|
||||||
mw.execShell("\cp -rf " + tmp_path + '/* ' + plugin_path + '/')
|
mw.execShell("\cp -rf " + tmp_path + '/* ' + plugin_path + '/')
|
||||||
mw.execShell('chmod -R 755 ' + plugin_path)
|
mw.execShell('chmod -R 755 ' + plugin_path)
|
||||||
p_info = mw.readFile(plugin_path + '/info.json')
|
p_info = mw.readFile(plugin_path + '/info.json')
|
||||||
@@ -382,7 +385,7 @@ class plugins_api:
|
|||||||
t = threads[i].getResult()
|
t = threads[i].getResult()
|
||||||
plugins_info[i]['status'] = t
|
plugins_info[i]['status'] = t
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print 'checkStatusMThreads:', str(e)
|
print('checkStatusMThreads:', str(e))
|
||||||
|
|
||||||
return plugins_info
|
return plugins_info
|
||||||
|
|
||||||
@@ -438,13 +441,13 @@ class plugins_api:
|
|||||||
else:
|
else:
|
||||||
checks = mw.getRootDir() + '/' + info['checks']
|
checks = mw.getRootDir() + '/' + info['checks']
|
||||||
|
|
||||||
if info.has_key('path'):
|
if 'path' in info:
|
||||||
path = info['path']
|
path = info['path']
|
||||||
|
|
||||||
if path[0:1] != '/':
|
if path[0:1] != '/':
|
||||||
path = mw.getRootDir() + '/' + path
|
path = mw.getRootDir() + '/' + path
|
||||||
|
|
||||||
if info.has_key('coexist') and info['coexist']:
|
if 'coexist' in info and info['coexist']:
|
||||||
coexist = True
|
coexist = True
|
||||||
|
|
||||||
pInfo = {
|
pInfo = {
|
||||||
@@ -507,7 +510,7 @@ class plugins_api:
|
|||||||
plugins_info = []
|
plugins_info = []
|
||||||
|
|
||||||
if (data['pid'] == sType):
|
if (data['pid'] == sType):
|
||||||
if type(data['versions']) == list and data.has_key('coexist') and data['coexist']:
|
if type(data['versions']) == list and 'coexist' in data and data['coexist']:
|
||||||
tmp_data = self.makeCoexist(data)
|
tmp_data = self.makeCoexist(data)
|
||||||
for index in range(len(tmp_data)):
|
for index in range(len(tmp_data)):
|
||||||
plugins_info.append(tmp_data[index])
|
plugins_info.append(tmp_data[index])
|
||||||
@@ -517,7 +520,7 @@ class plugins_api:
|
|||||||
return plugins_info
|
return plugins_info
|
||||||
|
|
||||||
if sType == '0':
|
if sType == '0':
|
||||||
if type(data['versions']) == list and data.has_key('coexist') and data['coexist']:
|
if type(data['versions']) == list and 'coexist' in data and data['coexist']:
|
||||||
tmp_data = self.makeCoexist(data)
|
tmp_data = self.makeCoexist(data)
|
||||||
for index in range(len(tmp_data)):
|
for index in range(len(tmp_data)):
|
||||||
plugins_info.append(tmp_data[index])
|
plugins_info.append(tmp_data[index])
|
||||||
@@ -542,8 +545,8 @@ class plugins_api:
|
|||||||
tmp_data = self.makeList(data, sType)
|
tmp_data = self.makeList(data, sType)
|
||||||
for index in range(len(tmp_data)):
|
for index in range(len(tmp_data)):
|
||||||
plugins_info.append(tmp_data[index])
|
plugins_info.append(tmp_data[index])
|
||||||
except Exception, e:
|
except Exception as e:
|
||||||
print e
|
print(e)
|
||||||
return plugins_info
|
return plugins_info
|
||||||
|
|
||||||
def getAllListPage(self, sType='0', page=1, pageSize=10):
|
def getAllListPage(self, sType='0', page=1, pageSize=10):
|
||||||
@@ -560,8 +563,8 @@ class plugins_api:
|
|||||||
tmp_data = self.makeList(data, sType)
|
tmp_data = self.makeList(data, sType)
|
||||||
for index in range(len(tmp_data)):
|
for index in range(len(tmp_data)):
|
||||||
plugins_info.append(tmp_data[index])
|
plugins_info.append(tmp_data[index])
|
||||||
except Exception, e:
|
except Exception as e:
|
||||||
print e
|
print(e)
|
||||||
|
|
||||||
start = (page - 1) * pageSize
|
start = (page - 1) * pageSize
|
||||||
end = start + pageSize
|
end = start + pageSize
|
||||||
@@ -733,8 +736,8 @@ class plugins_api:
|
|||||||
tmp_data[index]['display'] = True
|
tmp_data[index]['display'] = True
|
||||||
plist.append(tmp_data[index])
|
plist.append(tmp_data[index])
|
||||||
continue
|
continue
|
||||||
except Exception, e:
|
except Exception as e:
|
||||||
print 'getIndexList:', e
|
print('getIndexList:', e)
|
||||||
|
|
||||||
# 使用gevent模式时,无法使用多进程
|
# 使用gevent模式时,无法使用多进程
|
||||||
# plist = self.checkStatusMProcess(plist)
|
# plist = self.checkStatusMProcess(plist)
|
||||||
@@ -788,11 +791,12 @@ class plugins_api:
|
|||||||
if not os.path.exists(path):
|
if not os.path.exists(path):
|
||||||
return ('', '')
|
return ('', '')
|
||||||
data = mw.execShell(py_cmd)
|
data = mw.execShell(py_cmd)
|
||||||
# data = os.popen(py_cmd).read()
|
|
||||||
|
|
||||||
if mw.isAppleSystem():
|
if mw.isAppleSystem():
|
||||||
print 'run', py_cmd
|
print('run', py_cmd)
|
||||||
|
print(data)
|
||||||
# print os.path.exists(py_cmd)
|
# print os.path.exists(py_cmd)
|
||||||
|
|
||||||
return (data[0].strip(), data[1].strip())
|
return (data[0].strip(), data[1].strip())
|
||||||
|
|
||||||
# 映射包调用
|
# 映射包调用
|
||||||
@@ -805,6 +809,6 @@ class plugins_api:
|
|||||||
eval_str = "__import__('" + script + "')." + func + '(' + args + ')'
|
eval_str = "__import__('" + script + "')." + func + '(' + args + ')'
|
||||||
newRet = eval(eval_str)
|
newRet = eval(eval_str)
|
||||||
if mw.isAppleSystem():
|
if mw.isAppleSystem():
|
||||||
print 'callback', eval_str
|
print('callback', eval_str)
|
||||||
|
|
||||||
return (True, newRet)
|
return (True, newRet)
|
||||||
|
|||||||
+102
-101
@@ -15,6 +15,8 @@ import psutil
|
|||||||
|
|
||||||
from flask import request
|
from flask import request
|
||||||
|
|
||||||
|
# request.packages.urllib3.disable_warnings()
|
||||||
|
|
||||||
|
|
||||||
class site_api:
|
class site_api:
|
||||||
siteName = None # 网站名称
|
siteName = None # 网站名称
|
||||||
@@ -51,9 +53,9 @@ class site_api:
|
|||||||
|
|
||||||
##### ----- start ----- ###
|
##### ----- start ----- ###
|
||||||
def listApi(self):
|
def listApi(self):
|
||||||
limit = request.form.get('limit', '').encode('utf-8')
|
limit = request.form.get('limit', '10')
|
||||||
p = request.form.get('p', '').encode('utf-8')
|
p = request.form.get('p', '1')
|
||||||
type_id = request.form.get('type_id', '').encode('utf-8')
|
type_id = request.form.get('type_id', '')
|
||||||
|
|
||||||
start = (int(p) - 1) * (int(limit))
|
start = (int(p) - 1) * (int(limit))
|
||||||
|
|
||||||
@@ -82,7 +84,7 @@ class site_api:
|
|||||||
return mw.getJson(_ret)
|
return mw.getJson(_ret)
|
||||||
|
|
||||||
def setDefaultSiteApi(self):
|
def setDefaultSiteApi(self):
|
||||||
name = request.form.get('name', '').encode('utf-8')
|
name = request.form.get('name', '')
|
||||||
import time
|
import time
|
||||||
# 清理旧的
|
# 清理旧的
|
||||||
defaultSite = mw.readFile('data/defaultSite.pl')
|
defaultSite = mw.readFile('data/defaultSite.pl')
|
||||||
@@ -117,15 +119,15 @@ class site_api:
|
|||||||
return mw.getJson(data)
|
return mw.getJson(data)
|
||||||
|
|
||||||
def setPsApi(self):
|
def setPsApi(self):
|
||||||
mid = request.form.get('id', '').encode('utf-8')
|
mid = request.form.get('id', '')
|
||||||
ps = request.form.get('ps', '').encode('utf-8')
|
ps = request.form.get('ps', '')
|
||||||
if mw.M('sites').where("id=?", (mid,)).setField('ps', ps):
|
if mw.M('sites').where("id=?", (mid,)).setField('ps', ps):
|
||||||
return mw.returnJson(True, '修改成功!')
|
return mw.returnJson(True, '修改成功!')
|
||||||
return mw.returnJson(False, '修改失败!')
|
return mw.returnJson(False, '修改失败!')
|
||||||
|
|
||||||
def stopApi(self):
|
def stopApi(self):
|
||||||
mid = request.form.get('id', '').encode('utf-8')
|
mid = request.form.get('id', '')
|
||||||
name = request.form.get('name', '').encode('utf-8')
|
name = request.form.get('name', '')
|
||||||
path = self.setupPath + '/stop'
|
path = self.setupPath + '/stop'
|
||||||
|
|
||||||
if not os.path.exists(path):
|
if not os.path.exists(path):
|
||||||
@@ -158,8 +160,8 @@ class site_api:
|
|||||||
return mw.returnJson(True, '站点已停用!')
|
return mw.returnJson(True, '站点已停用!')
|
||||||
|
|
||||||
def startApi(self):
|
def startApi(self):
|
||||||
mid = request.form.get('id', '').encode('utf-8')
|
mid = request.form.get('id', '')
|
||||||
name = request.form.get('name', '').encode('utf-8')
|
name = request.form.get('name', '')
|
||||||
path = self.setupPath + '/stop'
|
path = self.setupPath + '/stop'
|
||||||
sitePath = mw.M('sites').where("id=?", (mid,)).getField('path')
|
sitePath = mw.M('sites').where("id=?", (mid,)).getField('path')
|
||||||
|
|
||||||
@@ -177,9 +179,9 @@ class site_api:
|
|||||||
return mw.returnJson(True, '站点已启用!')
|
return mw.returnJson(True, '站点已启用!')
|
||||||
|
|
||||||
def getBackupApi(self):
|
def getBackupApi(self):
|
||||||
limit = request.form.get('limit', '').encode('utf-8')
|
limit = request.form.get('limit', '')
|
||||||
p = request.form.get('p', '').encode('utf-8')
|
p = request.form.get('p', '')
|
||||||
mid = request.form.get('search', '').encode('utf-8')
|
mid = request.form.get('search', '')
|
||||||
|
|
||||||
find = mw.M('sites').where("id=?", (mid,)).field(
|
find = mw.M('sites').where("id=?", (mid,)).field(
|
||||||
"id,name,path,status,ps,addtime,edate").find()
|
"id,name,path,status,ps,addtime,edate").find()
|
||||||
@@ -201,7 +203,7 @@ class site_api:
|
|||||||
return mw.getJson(_ret)
|
return mw.getJson(_ret)
|
||||||
|
|
||||||
def toBackupApi(self):
|
def toBackupApi(self):
|
||||||
mid = request.form.get('id', '').encode('utf-8')
|
mid = request.form.get('id', '')
|
||||||
find = mw.M('sites').where(
|
find = mw.M('sites').where(
|
||||||
"id=?", (mid,)).field('name,path,id').find()
|
"id=?", (mid,)).field('name,path,id').find()
|
||||||
fileName = find['name'] + '_' + \
|
fileName = find['name'] + '_' + \
|
||||||
@@ -228,7 +230,7 @@ class site_api:
|
|||||||
return mw.returnJson(True, '备份成功!')
|
return mw.returnJson(True, '备份成功!')
|
||||||
|
|
||||||
def delBackupApi(self):
|
def delBackupApi(self):
|
||||||
mid = request.form.get('id', '').encode('utf-8')
|
mid = request.form.get('id', '')
|
||||||
filename = mw.M('backup').where(
|
filename = mw.M('backup').where(
|
||||||
"id=?", (mid,)).getField('filename')
|
"id=?", (mid,)).getField('filename')
|
||||||
if os.path.exists(filename):
|
if os.path.exists(filename):
|
||||||
@@ -243,8 +245,8 @@ class site_api:
|
|||||||
return self.getPhpVersion()
|
return self.getPhpVersion()
|
||||||
|
|
||||||
def setPhpVersionApi(self):
|
def setPhpVersionApi(self):
|
||||||
siteName = request.form.get('siteName', '').encode('utf-8')
|
siteName = request.form.get('siteName', '')
|
||||||
version = request.form.get('version', '').encode('utf-8')
|
version = request.form.get('version', '')
|
||||||
|
|
||||||
# nginx
|
# nginx
|
||||||
file = self.getHostConf(siteName)
|
file = self.getHostConf(siteName)
|
||||||
@@ -261,12 +263,12 @@ class site_api:
|
|||||||
return mw.returnJson(True, msg)
|
return mw.returnJson(True, msg)
|
||||||
|
|
||||||
def getDomainApi(self):
|
def getDomainApi(self):
|
||||||
pid = request.form.get('pid', '').encode('utf-8')
|
pid = request.form.get('pid', '')
|
||||||
return self.getDomain(pid)
|
return self.getDomain(pid)
|
||||||
|
|
||||||
# 获取站点所有域名
|
# 获取站点所有域名
|
||||||
def getSiteDomainsApi(self):
|
def getSiteDomainsApi(self):
|
||||||
pid = request.form.get('id', '').encode('utf-8')
|
pid = request.form.get('id', '')
|
||||||
|
|
||||||
data = {}
|
data = {}
|
||||||
domains = mw.M('domain').where(
|
domains = mw.M('domain').where(
|
||||||
@@ -287,7 +289,7 @@ class site_api:
|
|||||||
return mw.returnJson(True, 'OK', data)
|
return mw.returnJson(True, 'OK', data)
|
||||||
|
|
||||||
def getDirBindingApi(self):
|
def getDirBindingApi(self):
|
||||||
mid = request.form.get('id', '').encode('utf-8')
|
mid = request.form.get('id', '')
|
||||||
|
|
||||||
path = mw.M('sites').where('id=?', (mid,)).getField('path')
|
path = mw.M('sites').where('id=?', (mid,)).getField('path')
|
||||||
if not os.path.exists(path):
|
if not os.path.exists(path):
|
||||||
@@ -323,7 +325,7 @@ class site_api:
|
|||||||
return mw.returnJson(True, 'OK', data)
|
return mw.returnJson(True, 'OK', data)
|
||||||
|
|
||||||
def getDirUserIniApi(self):
|
def getDirUserIniApi(self):
|
||||||
mid = request.form.get('id', '').encode('utf-8')
|
mid = request.form.get('id', '')
|
||||||
|
|
||||||
path = mw.M('sites').where('id=?', (mid,)).getField('path')
|
path = mw.M('sites').where('id=?', (mid,)).getField('path')
|
||||||
name = mw.M('sites').where("id=?", (mid,)).getField('name')
|
name = mw.M('sites').where("id=?", (mid,)).getField('name')
|
||||||
@@ -338,7 +340,7 @@ class site_api:
|
|||||||
return mw.returnJson(True, 'OK', data)
|
return mw.returnJson(True, 'OK', data)
|
||||||
|
|
||||||
def setDirUserIniApi(self):
|
def setDirUserIniApi(self):
|
||||||
path = request.form.get('path', '').encode('utf-8')
|
path = request.form.get('path', '')
|
||||||
filename = path + '/.user.ini'
|
filename = path + '/.user.ini'
|
||||||
self.delUserInI(path)
|
self.delUserInI(path)
|
||||||
if os.path.exists(filename):
|
if os.path.exists(filename):
|
||||||
@@ -350,7 +352,7 @@ class site_api:
|
|||||||
return mw.returnJson(True, '已打开防跨站设置!')
|
return mw.returnJson(True, '已打开防跨站设置!')
|
||||||
|
|
||||||
def logsOpenApi(self):
|
def logsOpenApi(self):
|
||||||
mid = request.form.get('id', '').encode('utf-8')
|
mid = request.form.get('id', '')
|
||||||
name = mw.M('sites').where("id=?", (mid,)).getField('name')
|
name = mw.M('sites').where("id=?", (mid,)).getField('name')
|
||||||
|
|
||||||
# NGINX
|
# NGINX
|
||||||
@@ -387,7 +389,7 @@ class site_api:
|
|||||||
return mw.returnJson(True, 'OK', [])
|
return mw.returnJson(True, 'OK', [])
|
||||||
|
|
||||||
def getSslApi(self):
|
def getSslApi(self):
|
||||||
siteName = request.form.get('siteName', '').encode('utf-8')
|
siteName = request.form.get('siteName', '')
|
||||||
|
|
||||||
path = self.sslDir + siteName
|
path = self.sslDir + siteName
|
||||||
csrpath = path + "/fullchain.pem" # 生成证书路径
|
csrpath = path + "/fullchain.pem" # 生成证书路径
|
||||||
@@ -414,9 +416,9 @@ class site_api:
|
|||||||
return mw.returnJson(True, 'OK', data)
|
return mw.returnJson(True, 'OK', data)
|
||||||
|
|
||||||
def setSslApi(self):
|
def setSslApi(self):
|
||||||
siteName = request.form.get('siteName', '').encode('utf-8')
|
siteName = request.form.get('siteName', '')
|
||||||
key = request.form.get('key', '').encode('utf-8')
|
key = request.form.get('key', '')
|
||||||
csr = request.form.get('csr', '').encode('utf-8')
|
csr = request.form.get('csr', '')
|
||||||
|
|
||||||
path = self.sslDir + siteName
|
path = self.sslDir + siteName
|
||||||
if not os.path.exists(path):
|
if not os.path.exists(path):
|
||||||
@@ -471,8 +473,8 @@ class site_api:
|
|||||||
return mw.returnJson(True, '证书已保存!')
|
return mw.returnJson(True, '证书已保存!')
|
||||||
|
|
||||||
def setCertToSiteApi(self):
|
def setCertToSiteApi(self):
|
||||||
certName = request.form.get('certName', '').encode('utf-8')
|
certName = request.form.get('certName', '')
|
||||||
siteName = request.form.get('siteName', '').encode('utf-8')
|
siteName = request.form.get('siteName', '')
|
||||||
try:
|
try:
|
||||||
path = self.sslDir + siteName
|
path = self.sslDir + siteName
|
||||||
if not os.path.exists(path):
|
if not os.path.exists(path):
|
||||||
@@ -489,7 +491,7 @@ class site_api:
|
|||||||
return mw.returnJson(False, '设置错误,' + str(ex))
|
return mw.returnJson(False, '设置错误,' + str(ex))
|
||||||
|
|
||||||
def removeCertApi(self):
|
def removeCertApi(self):
|
||||||
certName = request.form.get('certName', '').encode('utf-8')
|
certName = request.form.get('certName', '')
|
||||||
try:
|
try:
|
||||||
path = self.sslDir + certName
|
path = self.sslDir + certName
|
||||||
if not os.path.exists(path):
|
if not os.path.exists(path):
|
||||||
@@ -500,7 +502,7 @@ class site_api:
|
|||||||
return mw.returnJson(False, '删除失败!')
|
return mw.returnJson(False, '删除失败!')
|
||||||
|
|
||||||
def closeSslConfApi(self):
|
def closeSslConfApi(self):
|
||||||
siteName = request.form.get('siteName', '').encode('utf-8')
|
siteName = request.form.get('siteName', '')
|
||||||
|
|
||||||
file = self.getHostConf(siteName)
|
file = self.getHostConf(siteName)
|
||||||
conf = mw.readFile(file)
|
conf = mw.readFile(file)
|
||||||
@@ -548,12 +550,12 @@ class site_api:
|
|||||||
return mw.returnJson(True, 'SSL已关闭!')
|
return mw.returnJson(True, 'SSL已关闭!')
|
||||||
|
|
||||||
def createLetApi(self):
|
def createLetApi(self):
|
||||||
siteName = request.form.get('siteName', '').encode('utf-8')
|
siteName = request.form.get('siteName', '')
|
||||||
updateOf = request.form.get('updateOf', '')
|
updateOf = request.form.get('updateOf', '')
|
||||||
domains = request.form.get('domains', '').encode('utf-8')
|
domains = request.form.get('domains', '')
|
||||||
force = request.form.get('force', '').encode('utf-8')
|
force = request.form.get('force', '')
|
||||||
renew = request.form.get('renew', '').encode('utf-8')
|
renew = request.form.get('renew', '')
|
||||||
email_args = request.form.get('email', '').encode('utf-8')
|
email_args = request.form.get('email', '')
|
||||||
|
|
||||||
domains = json.loads(domains)
|
domains = json.loads(domains)
|
||||||
email = mw.M('users').getField('email')
|
email = mw.M('users').getField('email')
|
||||||
@@ -648,8 +650,8 @@ class site_api:
|
|||||||
|
|
||||||
# print home_cert
|
# print home_cert
|
||||||
cmd = 'export ACCOUNT_EMAIL=' + email + ' && ' + execStr
|
cmd = 'export ACCOUNT_EMAIL=' + email + ' && ' + execStr
|
||||||
print domains
|
print(domains)
|
||||||
print cmd
|
print(cmd)
|
||||||
result = mw.execShell(cmd)
|
result = mw.execShell(cmd)
|
||||||
|
|
||||||
if not os.path.exists(home_cert.replace("\*", "*")):
|
if not os.path.exists(home_cert.replace("\*", "*")):
|
||||||
@@ -693,7 +695,7 @@ class site_api:
|
|||||||
return mw.returnJson(True, 'OK', result)
|
return mw.returnJson(True, 'OK', result)
|
||||||
|
|
||||||
def httpToHttpsApi(self):
|
def httpToHttpsApi(self):
|
||||||
siteName = request.form.get('siteName', '').encode('utf-8')
|
siteName = request.form.get('siteName', '')
|
||||||
file = self.getHostConf(siteName)
|
file = self.getHostConf(siteName)
|
||||||
conf = mw.readFile(file)
|
conf = mw.readFile(file)
|
||||||
if conf:
|
if conf:
|
||||||
@@ -712,7 +714,7 @@ class site_api:
|
|||||||
return mw.returnJson(True, '设置成功!证书也要设置好哟!')
|
return mw.returnJson(True, '设置成功!证书也要设置好哟!')
|
||||||
|
|
||||||
def closeToHttpsApi(self):
|
def closeToHttpsApi(self):
|
||||||
siteName = request.form.get('siteName', '').encode('utf-8')
|
siteName = request.form.get('siteName', '')
|
||||||
file = self.getHostConf(siteName)
|
file = self.getHostConf(siteName)
|
||||||
conf = mw.readFile(file)
|
conf = mw.readFile(file)
|
||||||
if conf:
|
if conf:
|
||||||
@@ -726,65 +728,65 @@ class site_api:
|
|||||||
return mw.returnJson(True, '关闭HTTPS跳转成功!')
|
return mw.returnJson(True, '关闭HTTPS跳转成功!')
|
||||||
|
|
||||||
def getIndexApi(self):
|
def getIndexApi(self):
|
||||||
sid = request.form.get('id', '').encode('utf-8')
|
sid = request.form.get('id', '')
|
||||||
data = {}
|
data = {}
|
||||||
index = self.getIndex(sid)
|
index = self.getIndex(sid)
|
||||||
data['index'] = index
|
data['index'] = index
|
||||||
return mw.getJson(data)
|
return mw.getJson(data)
|
||||||
|
|
||||||
def setIndexApi(self):
|
def setIndexApi(self):
|
||||||
sid = request.form.get('id', '').encode('utf-8')
|
sid = request.form.get('id', '')
|
||||||
index = request.form.get('index', '').encode('utf-8')
|
index = request.form.get('index', '')
|
||||||
return self.setIndex(sid, index)
|
return self.setIndex(sid, index)
|
||||||
|
|
||||||
def getLimitNetApi(self):
|
def getLimitNetApi(self):
|
||||||
sid = request.form.get('id', '').encode('utf-8')
|
sid = request.form.get('id', '')
|
||||||
return self.getLimitNet(sid)
|
return self.getLimitNet(sid)
|
||||||
|
|
||||||
def saveLimitNetApi(self):
|
def saveLimitNetApi(self):
|
||||||
sid = request.form.get('id', '').encode('utf-8')
|
sid = request.form.get('id', '')
|
||||||
perserver = request.form.get('perserver', '').encode('utf-8')
|
perserver = request.form.get('perserver', '')
|
||||||
perip = request.form.get('perip', '').encode('utf-8')
|
perip = request.form.get('perip', '')
|
||||||
limit_rate = request.form.get('limit_rate', '').encode('utf-8')
|
limit_rate = request.form.get('limit_rate', '')
|
||||||
return self.saveLimitNet(sid, perserver, perip, limit_rate)
|
return self.saveLimitNet(sid, perserver, perip, limit_rate)
|
||||||
|
|
||||||
def closeLimitNetApi(self):
|
def closeLimitNetApi(self):
|
||||||
sid = request.form.get('id', '').encode('utf-8')
|
sid = request.form.get('id', '')
|
||||||
return self.closeLimitNet(sid)
|
return self.closeLimitNet(sid)
|
||||||
|
|
||||||
def getSecurityApi(self):
|
def getSecurityApi(self):
|
||||||
sid = request.form.get('id', '').encode('utf-8')
|
sid = request.form.get('id', '')
|
||||||
name = request.form.get('name', '').encode('utf-8')
|
name = request.form.get('name', '')
|
||||||
return self.getSecurity(sid, name)
|
return self.getSecurity(sid, name)
|
||||||
|
|
||||||
def setSecurityApi(self):
|
def setSecurityApi(self):
|
||||||
fix = request.form.get('fix', '').encode('utf-8')
|
fix = request.form.get('fix', '')
|
||||||
domains = request.form.get('domains', '').encode('utf-8')
|
domains = request.form.get('domains', '')
|
||||||
status = request.form.get('status', '').encode('utf-8')
|
status = request.form.get('status', '')
|
||||||
name = request.form.get('name', '').encode('utf-8')
|
name = request.form.get('name', '')
|
||||||
sid = request.form.get('id', '').encode('utf-8')
|
sid = request.form.get('id', '')
|
||||||
return self.setSecurity(sid, name, fix, domains, status)
|
return self.setSecurity(sid, name, fix, domains, status)
|
||||||
|
|
||||||
def getLogsApi(self):
|
def getLogsApi(self):
|
||||||
siteName = request.form.get('siteName', '').encode('utf-8')
|
siteName = request.form.get('siteName', '')
|
||||||
return self.getLogs(siteName)
|
return self.getLogs(siteName)
|
||||||
|
|
||||||
def getSitePhpVersionApi(self):
|
def getSitePhpVersionApi(self):
|
||||||
siteName = request.form.get('siteName', '').encode('utf-8')
|
siteName = request.form.get('siteName', '')
|
||||||
return self.getSitePhpVersion(siteName)
|
return self.getSitePhpVersion(siteName)
|
||||||
|
|
||||||
def getHostConfApi(self):
|
def getHostConfApi(self):
|
||||||
siteName = request.form.get('siteName', '').encode('utf-8')
|
siteName = request.form.get('siteName', '')
|
||||||
host = self.getHostConf(siteName)
|
host = self.getHostConf(siteName)
|
||||||
return mw.getJson({'host': host})
|
return mw.getJson({'host': host})
|
||||||
|
|
||||||
def getRewriteConfApi(self):
|
def getRewriteConfApi(self):
|
||||||
siteName = request.form.get('siteName', '').encode('utf-8')
|
siteName = request.form.get('siteName', '')
|
||||||
rewrite = self.getRewriteConf(siteName)
|
rewrite = self.getRewriteConf(siteName)
|
||||||
return mw.getJson({'rewrite': rewrite})
|
return mw.getJson({'rewrite': rewrite})
|
||||||
|
|
||||||
def getRewriteTplApi(self):
|
def getRewriteTplApi(self):
|
||||||
tplname = request.form.get('tplname', '').encode('utf-8')
|
tplname = request.form.get('tplname', '')
|
||||||
file = mw.getRunDir() + '/rewrite/nginx/' + tplname + '.conf'
|
file = mw.getRunDir() + '/rewrite/nginx/' + tplname + '.conf'
|
||||||
if not os.path.exists(file):
|
if not os.path.exists(file):
|
||||||
return mw.returnJson(False, '模版不存在!')
|
return mw.returnJson(False, '模版不存在!')
|
||||||
@@ -800,16 +802,16 @@ class site_api:
|
|||||||
return mw.getJson(data)
|
return mw.getJson(data)
|
||||||
|
|
||||||
def setEndDateApi(self):
|
def setEndDateApi(self):
|
||||||
sid = request.form.get('id', '').encode('utf-8')
|
sid = request.form.get('id', '')
|
||||||
edate = request.form.get('edate', '').encode('utf-8')
|
edate = request.form.get('edate', '')
|
||||||
return self.setEndDate(sid, edate)
|
return self.setEndDate(sid, edate)
|
||||||
|
|
||||||
def addApi(self):
|
def addApi(self):
|
||||||
webname = request.form.get('webinfo', '').encode('utf-8')
|
webname = request.form.get('webinfo', '')
|
||||||
ps = request.form.get('ps', '').encode('utf-8')
|
ps = request.form.get('ps', '')
|
||||||
path = request.form.get('path', '').encode('utf-8')
|
path = request.form.get('path', '')
|
||||||
version = request.form.get('version', '').encode('utf-8')
|
version = request.form.get('version', '')
|
||||||
port = request.form.get('port', '').encode('utf-8')
|
port = request.form.get('port', '').decode('utf-8')
|
||||||
return self.add(webname, port, ps, path, version)
|
return self.add(webname, port, ps, path, version)
|
||||||
|
|
||||||
def addDomainApi(self):
|
def addDomainApi(self):
|
||||||
@@ -817,8 +819,8 @@ class site_api:
|
|||||||
if isError != True:
|
if isError != True:
|
||||||
return mw.returnJson(False, 'ERROR: 检测到配置文件有错误,请先排除后再操作<br><br><a style="color:red;">' + isError.replace("\n", '<br>') + '</a>')
|
return mw.returnJson(False, 'ERROR: 检测到配置文件有错误,请先排除后再操作<br><br><a style="color:red;">' + isError.replace("\n", '<br>') + '</a>')
|
||||||
|
|
||||||
domain = request.form.get('domain', '').encode('utf-8')
|
domain = request.form.get('domain', '')
|
||||||
webname = request.form.get('webname', '').encode('utf-8')
|
webname = request.form.get('webname', '')
|
||||||
pid = request.form.get('id', '').encode('utf-8')
|
pid = request.form.get('id', '').encode('utf-8')
|
||||||
if len(domain) < 3:
|
if len(domain) < 3:
|
||||||
return mw.returnJson(False, '域名不能为空!')
|
return mw.returnJson(False, '域名不能为空!')
|
||||||
@@ -864,9 +866,9 @@ class site_api:
|
|||||||
return mw.returnJson(True, '域名添加成功!')
|
return mw.returnJson(True, '域名添加成功!')
|
||||||
|
|
||||||
def addDirBindApi(self):
|
def addDirBindApi(self):
|
||||||
pid = request.form.get('id', '').encode('utf-8')
|
pid = request.form.get('id', '')
|
||||||
domain = request.form.get('domain', '').encode('utf-8')
|
domain = request.form.get('domain', '')
|
||||||
dirName = request.form.get('dirName', '').encode('utf-8')
|
dirName = request.form.get('dirName', '')
|
||||||
tmp = domain.split(':')
|
tmp = domain.split(':')
|
||||||
domain = tmp[0]
|
domain = tmp[0]
|
||||||
port = '80'
|
port = '80'
|
||||||
@@ -926,7 +928,7 @@ class site_api:
|
|||||||
return mw.returnJson(True, '添加成功!')
|
return mw.returnJson(True, '添加成功!')
|
||||||
|
|
||||||
def delDirBindApi(self):
|
def delDirBindApi(self):
|
||||||
mid = request.form.get('id', '').encode('utf-8')
|
mid = request.form.get('id', '')
|
||||||
binding = mw.M('binding').where(
|
binding = mw.M('binding').where(
|
||||||
"id=?", (mid,)).field('id,pid,domain,path').find()
|
"id=?", (mid,)).field('id,pid,domain,path').find()
|
||||||
siteName = mw.M('sites').where(
|
siteName = mw.M('sites').where(
|
||||||
@@ -954,8 +956,8 @@ class site_api:
|
|||||||
|
|
||||||
# 取子目录Rewrite
|
# 取子目录Rewrite
|
||||||
def getDirBindRewriteApi(self):
|
def getDirBindRewriteApi(self):
|
||||||
mid = request.form.get('id', '').encode('utf-8')
|
mid = request.form.get('id', '')
|
||||||
add = request.form.get('add', '0').encode('utf-8')
|
add = request.form.get('add', '0')
|
||||||
find = mw.M('binding').where(
|
find = mw.M('binding').where(
|
||||||
"id=?", (mid,)).field('id,pid,domain,path').find()
|
"id=?", (mid,)).field('id,pid,domain,path').find()
|
||||||
site = mw.M('sites').where(
|
site = mw.M('sites').where(
|
||||||
@@ -990,8 +992,8 @@ class site_api:
|
|||||||
|
|
||||||
# 修改物理路径
|
# 修改物理路径
|
||||||
def setPathApi(self):
|
def setPathApi(self):
|
||||||
mid = request.form.get('id', '').encode('utf-8')
|
mid = request.form.get('id', '')
|
||||||
path = request.form.get('path', '').encode('utf-8')
|
path = request.form.get('path', '')
|
||||||
|
|
||||||
path = self.getPath(path)
|
path = self.getPath(path)
|
||||||
if path == "" or mid == '0':
|
if path == "" or mid == '0':
|
||||||
@@ -1028,8 +1030,8 @@ class site_api:
|
|||||||
|
|
||||||
# 设置当前站点运行目录
|
# 设置当前站点运行目录
|
||||||
def setSiteRunPathApi(self):
|
def setSiteRunPathApi(self):
|
||||||
mid = request.form.get('id', '').encode('utf-8')
|
mid = request.form.get('id', '')
|
||||||
runPath = request.form.get('runPath', '').encode('utf-8')
|
runPath = request.form.get('runPath', '')
|
||||||
siteName = mw.M('sites').where('id=?', (mid,)).getField('name')
|
siteName = mw.M('sites').where('id=?', (mid,)).getField('name')
|
||||||
sitePath = mw.M('sites').where('id=?', (mid,)).getField('path')
|
sitePath = mw.M('sites').where('id=?', (mid,)).getField('path')
|
||||||
|
|
||||||
@@ -1051,9 +1053,9 @@ class site_api:
|
|||||||
|
|
||||||
# 设置目录加密
|
# 设置目录加密
|
||||||
def setHasPwdApi(self):
|
def setHasPwdApi(self):
|
||||||
username = request.form.get('username', '').encode('utf-8')
|
username = request.form.get('username', '')
|
||||||
password = request.form.get('password', '').encode('utf-8')
|
password = request.form.get('password', '')
|
||||||
siteName = request.form.get('siteName', '').encode('utf-8')
|
siteName = request.form.get('siteName', '')
|
||||||
mid = request.form.get('id', '')
|
mid = request.form.get('id', '')
|
||||||
|
|
||||||
if len(username.strip()) == 0 or len(password.strip()) == 0:
|
if len(username.strip()) == 0 or len(password.strip()) == 0:
|
||||||
@@ -1064,7 +1066,7 @@ class site_api:
|
|||||||
|
|
||||||
# self.closeHasPwd(get)
|
# self.closeHasPwd(get)
|
||||||
filename = self.passPath + '/' + siteName + '.pass'
|
filename = self.passPath + '/' + siteName + '.pass'
|
||||||
print filename
|
print(filename)
|
||||||
passconf = username + ':' + mw.hasPwd(password)
|
passconf = username + ':' + mw.hasPwd(password)
|
||||||
|
|
||||||
if siteName == 'phpmyadmin':
|
if siteName == 'phpmyadmin':
|
||||||
@@ -1098,7 +1100,7 @@ class site_api:
|
|||||||
|
|
||||||
# 取消目录加密
|
# 取消目录加密
|
||||||
def closeHasPwdApi(self):
|
def closeHasPwdApi(self):
|
||||||
siteName = request.form.get('siteName', '').encode('utf-8')
|
siteName = request.form.get('siteName', '')
|
||||||
mid = request.form.get('id', '')
|
mid = request.form.get('id', '')
|
||||||
if siteName == '':
|
if siteName == '':
|
||||||
siteName = mw.M('sites').where('id=?', (mid,)).getField('name')
|
siteName = mw.M('sites').where('id=?', (mid,)).getField('name')
|
||||||
@@ -1120,9 +1122,9 @@ class site_api:
|
|||||||
return mw.returnJson(True, '设置成功!')
|
return mw.returnJson(True, '设置成功!')
|
||||||
|
|
||||||
def delDomainApi(self):
|
def delDomainApi(self):
|
||||||
domain = request.form.get('domain', '').encode('utf-8')
|
domain = request.form.get('domain', '')
|
||||||
webname = request.form.get('webname', '').encode('utf-8')
|
webname = request.form.get('webname', '')
|
||||||
port = request.form.get('port', '').encode('utf-8')
|
port = request.form.get('port', '')
|
||||||
pid = request.form.get('id', '')
|
pid = request.form.get('id', '')
|
||||||
|
|
||||||
find = mw.M('domain').where("pid=? AND name=?",
|
find = mw.M('domain').where("pid=? AND name=?",
|
||||||
@@ -1160,13 +1162,13 @@ class site_api:
|
|||||||
return mw.returnJson(True, '站点删除成功!')
|
return mw.returnJson(True, '站点删除成功!')
|
||||||
|
|
||||||
def deleteApi(self):
|
def deleteApi(self):
|
||||||
sid = request.form.get('id', '').encode('utf-8')
|
sid = request.form.get('id', '')
|
||||||
webname = request.form.get('webname', '').encode('utf-8')
|
webname = request.form.get('webname', '')
|
||||||
path = request.form.get('path', '0').encode('utf-8')
|
path = request.form.get('path', '0')
|
||||||
return self.delete(sid, webname, path)
|
return self.delete(sid, webname, path)
|
||||||
|
|
||||||
def getProxyListApi(self):
|
def getProxyListApi(self):
|
||||||
siteName = request.form.get('siteName', '').encode('utf-8')
|
siteName = request.form.get('siteName', '')
|
||||||
conf_path = self.getHostConf(siteName)
|
conf_path = self.getHostConf(siteName)
|
||||||
old_conf = mw.readFile(conf_path)
|
old_conf = mw.readFile(conf_path)
|
||||||
rep = "(#PROXY-START(\n|.)+#PROXY-END)"
|
rep = "(#PROXY-START(\n|.)+#PROXY-END)"
|
||||||
@@ -1213,7 +1215,7 @@ class site_api:
|
|||||||
return mw.getJson(data)
|
return mw.getJson(data)
|
||||||
|
|
||||||
def getSiteDocApi(self):
|
def getSiteDocApi(self):
|
||||||
stype = request.form.get('type', '0').strip().encode('utf-8')
|
stype = request.form.get('type', '0').strip()
|
||||||
vlist = []
|
vlist = []
|
||||||
vlist.append('')
|
vlist.append('')
|
||||||
vlist.append(mw.getServerDir() +
|
vlist.append(mw.getServerDir() +
|
||||||
@@ -1227,7 +1229,7 @@ class site_api:
|
|||||||
return mw.returnJson(True, 'ok', data)
|
return mw.returnJson(True, 'ok', data)
|
||||||
|
|
||||||
def addSiteTypeApi(self):
|
def addSiteTypeApi(self):
|
||||||
name = request.form.get('name', '').strip().encode('utf-8')
|
name = request.form.get('name', '').strip()
|
||||||
if not name:
|
if not name:
|
||||||
return mw.returnJson(False, "分类名称不能为空")
|
return mw.returnJson(False, "分类名称不能为空")
|
||||||
if len(name) > 18:
|
if len(name) > 18:
|
||||||
@@ -1240,7 +1242,7 @@ class site_api:
|
|||||||
return mw.returnJson(True, '添加成功!')
|
return mw.returnJson(True, '添加成功!')
|
||||||
|
|
||||||
def removeSiteTypeApi(self):
|
def removeSiteTypeApi(self):
|
||||||
mid = request.form.get('id', '').encode('utf-8')
|
mid = request.form.get('id', '')
|
||||||
if mw.M('site_types').where('id=?', (mid,)).count() == 0:
|
if mw.M('site_types').where('id=?', (mid,)).count() == 0:
|
||||||
return mw.returnJson(False, "指定分类不存在!")
|
return mw.returnJson(False, "指定分类不存在!")
|
||||||
mw.M('site_types').where('id=?', (mid,)).delete()
|
mw.M('site_types').where('id=?', (mid,)).delete()
|
||||||
@@ -1249,8 +1251,8 @@ class site_api:
|
|||||||
|
|
||||||
def modifySiteTypeNameApi(self):
|
def modifySiteTypeNameApi(self):
|
||||||
# 修改网站分类名称
|
# 修改网站分类名称
|
||||||
name = request.form.get('name', '').strip().encode('utf-8')
|
name = request.form.get('name', '').strip()
|
||||||
mid = request.form.get('id', '').encode('utf-8')
|
mid = request.form.get('id', '')
|
||||||
if not name:
|
if not name:
|
||||||
return mw.returnJson(False, "分类名称不能为空")
|
return mw.returnJson(False, "分类名称不能为空")
|
||||||
if len(name) > 18:
|
if len(name) > 18:
|
||||||
@@ -1262,11 +1264,11 @@ class site_api:
|
|||||||
|
|
||||||
def setSiteTypeApi(self):
|
def setSiteTypeApi(self):
|
||||||
# 设置指定站点的分类
|
# 设置指定站点的分类
|
||||||
site_ids = request.form.get('site_ids', '').encode('utf-8')
|
site_ids = request.form.get('site_ids', '')
|
||||||
mid = request.form.get('id', '').encode('utf-8')
|
mid = request.form.get('id', '')
|
||||||
site_ids = json.loads(site_ids)
|
site_ids = json.loads(site_ids)
|
||||||
for sid in site_ids:
|
for sid in site_ids:
|
||||||
print mw.M('sites').where('id=?', (sid,)).setField('type_id', mid)
|
print(mw.M('sites').where('id=?', (sid,)).setField('type_id', mid))
|
||||||
return mw.returnJson(True, "设置成功!")
|
return mw.returnJson(True, "设置成功!")
|
||||||
|
|
||||||
##### ----- end ----- ###
|
##### ----- end ----- ###
|
||||||
@@ -1667,7 +1669,6 @@ location /{
|
|||||||
mw.writeFile(rewrite_file, rewrite_content)
|
mw.writeFile(rewrite_file, rewrite_content)
|
||||||
|
|
||||||
def add(self, webname, port, ps, path, version):
|
def add(self, webname, port, ps, path, version):
|
||||||
|
|
||||||
siteMenu = json.loads(webname)
|
siteMenu = json.loads(webname)
|
||||||
self.siteName = self.toPunycode(
|
self.siteName = self.toPunycode(
|
||||||
siteMenu['domain'].strip().split(':')[0]).strip()
|
siteMenu['domain'].strip().split(':')[0]).strip()
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ from threading import Thread
|
|||||||
from time import sleep
|
from time import sleep
|
||||||
|
|
||||||
|
|
||||||
def async(f):
|
def mw_async(f):
|
||||||
def wrapper(*args, **kwargs):
|
def wrapper(*args, **kwargs):
|
||||||
thr = Thread(target=f, args=args, kwargs=kwargs)
|
thr = Thread(target=f, args=args, kwargs=kwargs)
|
||||||
thr.start()
|
thr.start()
|
||||||
@@ -101,14 +101,14 @@ class system_api:
|
|||||||
return mw.returnJson(True, '正在重启服务器!')
|
return mw.returnJson(True, '正在重启服务器!')
|
||||||
##### ----- end ----- ###
|
##### ----- end ----- ###
|
||||||
|
|
||||||
@async
|
@mw_async
|
||||||
def restartMw(self):
|
def restartMw(self):
|
||||||
sleep(0.3)
|
sleep(0.3)
|
||||||
# cmd = mw.getRunDir() + '/scripts/init.d/mw restart'
|
# cmd = mw.getRunDir() + '/scripts/init.d/mw restart'
|
||||||
# print cmd
|
# print cmd
|
||||||
mw.execShell('service mw restart')
|
mw.execShell('service mw restart')
|
||||||
|
|
||||||
@async
|
@mw_async
|
||||||
def restartServer(self):
|
def restartServer(self):
|
||||||
if not mw.isRestart():
|
if not mw.isRestart():
|
||||||
return mw.returnJson(False, '请等待所有安装任务完成再执行!')
|
return mw.returnJson(False, '请等待所有安装任务完成再执行!')
|
||||||
@@ -302,7 +302,7 @@ class system_api:
|
|||||||
memInfo['memBuffers'] - memInfo['memCached']
|
memInfo['memBuffers'] - memInfo['memCached']
|
||||||
tmp1 = memInfo['memTotal'] / 100
|
tmp1 = memInfo['memTotal'] / 100
|
||||||
return (tmp / tmp1)
|
return (tmp / tmp1)
|
||||||
except Exception, ex:
|
except Exception as ex:
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
def getDiskInfo(self, get=None):
|
def getDiskInfo(self, get=None):
|
||||||
@@ -396,7 +396,7 @@ class system_api:
|
|||||||
shutil.rmtree(filename)
|
shutil.rmtree(filename)
|
||||||
else:
|
else:
|
||||||
os.remove(filename)
|
os.remove(filename)
|
||||||
print '\t\033[1;32m[OK]\033[0m'
|
print('\t\033[1;32m[OK]\033[0m')
|
||||||
num += 1
|
num += 1
|
||||||
total += size
|
total += size
|
||||||
count += num
|
count += num
|
||||||
@@ -460,8 +460,8 @@ class system_api:
|
|||||||
networkInfo['mem'] = self.getMemInfo()
|
networkInfo['mem'] = self.getMemInfo()
|
||||||
|
|
||||||
return networkInfo
|
return networkInfo
|
||||||
except Exception, e:
|
except Exception as e:
|
||||||
print e
|
print(e)
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def getNetWorkApi(self):
|
def getNetWorkApi(self):
|
||||||
@@ -621,7 +621,7 @@ class system_api:
|
|||||||
version = json.loads(r.content)
|
version = json.loads(r.content)
|
||||||
return version[0]
|
return version[0]
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print 'getServerInfo', e
|
print('getServerInfo', e)
|
||||||
return {}
|
return {}
|
||||||
|
|
||||||
def updateServer(self, stype, version=''):
|
def updateServer(self, stype, version=''):
|
||||||
@@ -680,7 +680,7 @@ class system_api:
|
|||||||
|
|
||||||
return mw.returnJson(False, '已经是最新,无需更新!')
|
return mw.returnJson(False, '已经是最新,无需更新!')
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
print 'updateServer', ex
|
print('updateServer', ex)
|
||||||
return mw.returnJson(False, "连接服务器失败!")
|
return mw.returnJson(False, "连接服务器失败!")
|
||||||
|
|
||||||
# 修复面板
|
# 修复面板
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ class task_api:
|
|||||||
|
|
||||||
def listApi(self):
|
def listApi(self):
|
||||||
|
|
||||||
p = request.form.get('p', '1').encode('utf-8')
|
p = request.form.get('p', '1')
|
||||||
limit = request.form.get('limit', '10').strip()
|
limit = request.form.get('limit', '10').strip()
|
||||||
search = request.form.get('search', '').strip()
|
search = request.form.get('search', '').strip()
|
||||||
|
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ class vieCode:
|
|||||||
if not self.__inNoise:
|
if not self.__inNoise:
|
||||||
return
|
return
|
||||||
font = ImageFont.truetype(self.__fontPatn, int(self.__fontSize / 1.5))
|
font = ImageFont.truetype(self.__fontPatn, int(self.__fontSize / 1.5))
|
||||||
for i in xrange(5):
|
for i in range(5):
|
||||||
# 杂点颜色
|
# 杂点颜色
|
||||||
noiseColor = (random.randint(150, 200), random.randint(
|
noiseColor = (random.randint(150, 200), random.randint(
|
||||||
150, 200), random.randint(150, 200))
|
150, 200), random.randint(150, 200))
|
||||||
@@ -104,9 +104,9 @@ class vieCode:
|
|||||||
# 画曲线
|
# 画曲线
|
||||||
color = (random.randint(30, 150), random.randint(
|
color = (random.randint(30, 150), random.randint(
|
||||||
30, 150), random.randint(30, 150))
|
30, 150), random.randint(30, 150))
|
||||||
for x in xrange(xend):
|
for x in range(xend):
|
||||||
if w != 0:
|
if w != 0:
|
||||||
for k in xrange(int(self.__heigth / 10)):
|
for k in range(int(self.__heigth / 10)):
|
||||||
y = a * math.sin(w * x + f) + b + self.__heigth / 2
|
y = a * math.sin(w * x + f) + b + self.__heigth / 2
|
||||||
i = int(self.__fontSize / 5)
|
i = int(self.__fontSize / 5)
|
||||||
while i > 0:
|
while i > 0:
|
||||||
@@ -120,7 +120,7 @@ class vieCode:
|
|||||||
font = ImageFont.truetype(self.__fontPatn, self.__fontSize)
|
font = ImageFont.truetype(self.__fontPatn, self.__fontSize)
|
||||||
x = 0
|
x = 0
|
||||||
# 打印字符到画板
|
# 打印字符到画板
|
||||||
for i in xrange(self.__length):
|
for i in range(self.__length):
|
||||||
# 设置字体随机颜色
|
# 设置字体随机颜色
|
||||||
color = (random.randint(30, 150), random.randint(
|
color = (random.randint(30, 150), random.randint(
|
||||||
30, 150), random.randint(30, 150))
|
30, 150), random.randint(30, 150))
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
jnuxgfkj
|
||||||
Executable
+102
@@ -0,0 +1,102 @@
|
|||||||
|
## 文件保存相关 ##
|
||||||
|
|
||||||
|
# 文件的保存路径(可使用绝对路径或相对路径), 默认: 当前启动位置
|
||||||
|
dir=/tmp/aria2
|
||||||
|
# 设置日志等级
|
||||||
|
log-level=error
|
||||||
|
# 日志保存路径
|
||||||
|
log={$SERVER_PATH}/aria2.log
|
||||||
|
# 启用磁盘缓存, 0为禁用缓存, 需1.16以上版本, 默认:16M
|
||||||
|
disk-cache=32M
|
||||||
|
# 文件预分配方式, 能有效降低磁盘碎片, 默认:prealloc
|
||||||
|
# 预分配所需时间: none < falloc ? trunc < prealloc
|
||||||
|
# falloc和trunc则需要文件系统和内核支持
|
||||||
|
# NTFS建议使用falloc, EXT3/4建议trunc, MAC 下需要注释此项
|
||||||
|
#file-allocation=none
|
||||||
|
# 断点续传
|
||||||
|
continue=true
|
||||||
|
|
||||||
|
## 下载连接相关 ##
|
||||||
|
|
||||||
|
# 最大同时下载任务数, 运行时可修改, 默认:5
|
||||||
|
max-concurrent-downloads=5
|
||||||
|
# 同一服务器连接数, 添加时可指定, 默认:1
|
||||||
|
max-connection-per-server=10
|
||||||
|
# 最小文件分片大小, 添加时可指定, 取值范围1M -1024M, 默认:20M
|
||||||
|
# 假定size=10M, 文件为20MiB 则使用两个来源下载; 文件为15MiB 则使用一个来源下载
|
||||||
|
min-split-size=10M
|
||||||
|
# 单个任务最大线程数, 添加时可指定, 默认:5
|
||||||
|
split=128
|
||||||
|
# 整体下载速度限制, 运行时可修改, 默认:0
|
||||||
|
#max-overall-download-limit=0
|
||||||
|
# 单个任务下载速度限制, 默认:0
|
||||||
|
#max-download-limit=0
|
||||||
|
# 整体上传速度限制, 运行时可修改, 默认:0
|
||||||
|
#max-overall-upload-limit=0
|
||||||
|
# 单个任务上传速度限制, 默认:0
|
||||||
|
#max-upload-limit=0
|
||||||
|
# 禁用IPv6, 默认:false
|
||||||
|
disable-ipv6=true
|
||||||
|
|
||||||
|
## 进度保存相关 ##
|
||||||
|
|
||||||
|
# 从会话文件中读取下载任务
|
||||||
|
input-file={$SERVER_PATH}/aria2.session
|
||||||
|
# 在Aria2退出时保存`错误/未完成`的下载任务到会话文件
|
||||||
|
save-session={$SERVER_PATH}/aria2.session
|
||||||
|
# 定时保存会话, 0为退出时才保存, 需1.16.1以上版本, 默认:0
|
||||||
|
#save-session-interval=60
|
||||||
|
|
||||||
|
## RPC相关设置 ##
|
||||||
|
|
||||||
|
# 启用RPC, 默认:false
|
||||||
|
enable-rpc=true
|
||||||
|
# 允许所有来源, 默认:false
|
||||||
|
rpc-allow-origin-all=true
|
||||||
|
# 允许非外部访问, 默认:false
|
||||||
|
rpc-listen-all=true
|
||||||
|
# 事件轮询方式, 取值:[epoll, kqueue, port, poll, select], 不同系统默认值不同
|
||||||
|
#event-poll=select
|
||||||
|
# RPC监听端口, 端口被占用时可以修改, 默认:6800
|
||||||
|
rpc-listen-port=6800
|
||||||
|
# 设置的RPC授权令牌, v1.18.4新增功能, 取代 --rpc-user 和 --rpc-passwd 选项
|
||||||
|
#rpc-secret=sark
|
||||||
|
# 设置的RPC访问用户名, 此选项新版已废弃, 建议改用 --rpc-secret 选项
|
||||||
|
#rpc-user=<USER>
|
||||||
|
# 设置的RPC访问密码, 此选项新版已废弃, 建议改用 --rpc-secret 选项
|
||||||
|
#rpc-passwd=<PASSWD>
|
||||||
|
|
||||||
|
## BT/PT下载相关 ##
|
||||||
|
|
||||||
|
# 当下载的是一个种子(以.torrent结尾)时, 自动开始BT任务, 默认:true
|
||||||
|
#follow-torrent=true
|
||||||
|
# BT监听端口, 当端口被屏蔽时使用, 默认:6881-6999
|
||||||
|
listen-port=51413
|
||||||
|
# 单个种子最大连接数, 默认:55
|
||||||
|
#bt-max-peers=55
|
||||||
|
# 打开DHT功能, PT需要禁用, 默认:true
|
||||||
|
enable-dht=false
|
||||||
|
# 打开IPv6 DHT功能, PT需要禁用
|
||||||
|
#enable-dht6=false
|
||||||
|
# DHT网络监听端口, 默认:6881-6999
|
||||||
|
#dht-listen-port=6881-6999
|
||||||
|
# 本地节点查找, PT需要禁用, 默认:false
|
||||||
|
#bt-enable-lpd=false
|
||||||
|
# 种子交换, PT需要禁用, 默认:true
|
||||||
|
enable-peer-exchange=false
|
||||||
|
# 每个种子限速, 对少种的PT很有用, 默认:50K
|
||||||
|
#bt-request-peer-speed-limit=50K
|
||||||
|
# 客户端伪装, PT需要
|
||||||
|
peer-id-prefix=-TR2770-
|
||||||
|
user-agent=Transmission/2.77
|
||||||
|
# 当种子的分享率达到这个数时, 自动停止做种, 0为一直做种, 默认:1.0
|
||||||
|
seed-ratio=0
|
||||||
|
# 强制保存会话, 即使任务已经完成, 默认:false
|
||||||
|
# 较新的版本开启后会在任务完成后依然保留.aria2文件
|
||||||
|
#force-save=false
|
||||||
|
# BT校验相关, 默认:true
|
||||||
|
#bt-hash-check-seed=true
|
||||||
|
# 继续之前的BT任务时, 无需再次校验, 默认:false
|
||||||
|
bt-seed-unverified=true
|
||||||
|
# 保存磁力链接元数据为种子文件(.torrent文件), 默认:false
|
||||||
|
bt-save-metadata=true
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 1.7 KiB |
Executable
+19
@@ -0,0 +1,19 @@
|
|||||||
|
<div class="bt-form">
|
||||||
|
<div class="bt-w-main">
|
||||||
|
<div class="bt-w-menu">
|
||||||
|
<p class="bgw" onclick="pluginService('aria2');">服务</p>
|
||||||
|
<p onclick="pluginInitD('aria2');">自启动</p>
|
||||||
|
<p onclick="pluginConfig('aria2');">配置修改</p>
|
||||||
|
<p onclick="pluginLogs('aria2','','run_log');">运行日志</p>
|
||||||
|
<p onclick="readme();">说明</p>
|
||||||
|
</div>
|
||||||
|
<div class="bt-w-con pd15">
|
||||||
|
<div class="soft-man-con"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<script type="text/javascript">
|
||||||
|
$.getScript( "/plugins/file?name=aria2&f=js/aria2.js", function(){
|
||||||
|
pluginService('aria2');
|
||||||
|
});
|
||||||
|
</script>
|
||||||
Executable
+211
@@ -0,0 +1,211 @@
|
|||||||
|
# coding:utf-8
|
||||||
|
|
||||||
|
import sys
|
||||||
|
import io
|
||||||
|
import os
|
||||||
|
import time
|
||||||
|
import shutil
|
||||||
|
|
||||||
|
sys.path.append(os.getcwd() + "/class/core")
|
||||||
|
import mw
|
||||||
|
|
||||||
|
app_debug = False
|
||||||
|
if mw.isAppleSystem():
|
||||||
|
app_debug = True
|
||||||
|
|
||||||
|
|
||||||
|
def getPluginName():
|
||||||
|
return 'aria2'
|
||||||
|
|
||||||
|
|
||||||
|
def getPluginDir():
|
||||||
|
return mw.getPluginDir() + '/' + getPluginName()
|
||||||
|
|
||||||
|
|
||||||
|
def getServerDir():
|
||||||
|
return mw.getServerDir() + '/' + getPluginName()
|
||||||
|
|
||||||
|
|
||||||
|
def getInitDTpl():
|
||||||
|
path = getPluginDir() + "/init.d/aria2.tpl"
|
||||||
|
return path
|
||||||
|
|
||||||
|
|
||||||
|
def getArgs():
|
||||||
|
args = sys.argv[2:]
|
||||||
|
tmp = {}
|
||||||
|
args_len = len(args)
|
||||||
|
|
||||||
|
if args_len == 1:
|
||||||
|
t = args[0].strip('{').strip('}')
|
||||||
|
t = t.split(':')
|
||||||
|
tmp[t[0]] = t[1]
|
||||||
|
elif args_len > 1:
|
||||||
|
for i in range(len(args)):
|
||||||
|
t = args[i].split(':')
|
||||||
|
tmp[t[0]] = t[1]
|
||||||
|
|
||||||
|
return tmp
|
||||||
|
|
||||||
|
|
||||||
|
def initDreplace():
|
||||||
|
|
||||||
|
file_tpl = getInitDTpl()
|
||||||
|
service_path = os.path.dirname(os.getcwd())
|
||||||
|
|
||||||
|
initD_path = getServerDir() + '/init.d'
|
||||||
|
|
||||||
|
file_bin = initD_path + '/' + getPluginName()
|
||||||
|
if not os.path.exists(initD_path):
|
||||||
|
os.mkdir(initD_path)
|
||||||
|
|
||||||
|
# initd replace
|
||||||
|
content = mw.readFile(file_tpl)
|
||||||
|
content = content.replace('{$SERVER_PATH}', service_path)
|
||||||
|
mw.writeFile(file_bin, content)
|
||||||
|
mw.execShell('chmod +x ' + file_bin)
|
||||||
|
|
||||||
|
aria2_path = getServerDir() + '/aria2'
|
||||||
|
mw.execShell('mkdir -p /tmp/download')
|
||||||
|
if not os.path.exists(aria2_path):
|
||||||
|
|
||||||
|
mw.execShell('mkdir -p ' + aria2_path)
|
||||||
|
mw.execShell('touch ' + aria2_path + '/aria2.session')
|
||||||
|
|
||||||
|
path = getPluginDir() + "/conf/aria2.conf"
|
||||||
|
content = mw.readFile(path)
|
||||||
|
content = content.replace('{$SERVER_PATH}', aria2_path)
|
||||||
|
|
||||||
|
mw.writeFile(aria2_path + '/aria2.conf', content)
|
||||||
|
|
||||||
|
return file_bin
|
||||||
|
|
||||||
|
|
||||||
|
def checkArgs(data, ck=[]):
|
||||||
|
for i in range(len(ck)):
|
||||||
|
if not ck[i] in data:
|
||||||
|
return (False, mw.returnJson(False, '参数:(' + ck[i] + ')没有!'))
|
||||||
|
return (True, mw.returnJson(True, 'ok'))
|
||||||
|
|
||||||
|
|
||||||
|
def status():
|
||||||
|
cmd = "ps -ef|grep aria2 |grep -v grep | grep -v 'mdserver-web'| awk '{print $2}'"
|
||||||
|
data = mw.execShell(cmd)
|
||||||
|
if data[0] == '':
|
||||||
|
return 'stop'
|
||||||
|
return 'start'
|
||||||
|
|
||||||
|
|
||||||
|
def start():
|
||||||
|
|
||||||
|
file = initDreplace()
|
||||||
|
data = mw.execShell(file + ' start')
|
||||||
|
|
||||||
|
if data[1] == '':
|
||||||
|
return 'ok'
|
||||||
|
return data[1]
|
||||||
|
|
||||||
|
|
||||||
|
def stop():
|
||||||
|
file = initDreplace()
|
||||||
|
data = mw.execShell(file + ' stop')
|
||||||
|
# print data
|
||||||
|
if data[1] == '':
|
||||||
|
return 'ok'
|
||||||
|
return data[1]
|
||||||
|
|
||||||
|
|
||||||
|
def restart():
|
||||||
|
file = initDreplace()
|
||||||
|
data = mw.execShell(file + ' reload')
|
||||||
|
if data[1] == '':
|
||||||
|
return 'ok'
|
||||||
|
return data[1]
|
||||||
|
|
||||||
|
|
||||||
|
def reload():
|
||||||
|
file = initDreplace()
|
||||||
|
data = mw.execShell(file + ' reload')
|
||||||
|
if data[1] == '':
|
||||||
|
return 'ok'
|
||||||
|
return data[1]
|
||||||
|
|
||||||
|
|
||||||
|
def getPathFile():
|
||||||
|
if mw.isAppleSystem():
|
||||||
|
user = mw.execShell(
|
||||||
|
"who | sed -n '2, 1p' |awk '{print $1}'")[0].strip()
|
||||||
|
return '/Users/' + user + '/.aria2/aria2.conf'
|
||||||
|
return getServerDir() + '/aria2/aria2.conf'
|
||||||
|
|
||||||
|
|
||||||
|
def getInitDFile():
|
||||||
|
if app_debug:
|
||||||
|
return '/tmp/' + getPluginName()
|
||||||
|
return '/etc/init.d/' + getPluginName()
|
||||||
|
|
||||||
|
|
||||||
|
def initdStatus():
|
||||||
|
if not app_debug:
|
||||||
|
if mw.isAppleSystem():
|
||||||
|
return "Apple Computer does not support"
|
||||||
|
initd_bin = getInitDFile()
|
||||||
|
if os.path.exists(initd_bin):
|
||||||
|
return 'ok'
|
||||||
|
return 'fail'
|
||||||
|
|
||||||
|
|
||||||
|
def initdInstall():
|
||||||
|
source_bin = initDreplace()
|
||||||
|
initd_bin = getInitDFile()
|
||||||
|
shutil.copyfile(source_bin, initd_bin)
|
||||||
|
mw.execShell('chmod +x ' + initd_bin)
|
||||||
|
|
||||||
|
if not app_debug:
|
||||||
|
mw.execShell('chkconfig --add ' + getPluginName())
|
||||||
|
return 'ok'
|
||||||
|
|
||||||
|
|
||||||
|
def initdUinstall():
|
||||||
|
if not app_debug:
|
||||||
|
mw.execShell('chkconfig --del ' + getPluginName())
|
||||||
|
|
||||||
|
initd_bin = getInitDFile()
|
||||||
|
|
||||||
|
if os.path.exists(initd_bin):
|
||||||
|
os.remove(initd_bin)
|
||||||
|
return 'ok'
|
||||||
|
|
||||||
|
|
||||||
|
def getLog():
|
||||||
|
if mw.isAppleSystem():
|
||||||
|
user = mw.execShell(
|
||||||
|
"who | sed -n '2, 1p' |awk '{print $1}'")[0].strip()
|
||||||
|
return '/Users/' + user + '/.aria2/aria2.log'
|
||||||
|
return getServerDir() + '/aria2/aria2.log'
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
func = sys.argv[1]
|
||||||
|
if func == 'status':
|
||||||
|
print(status())
|
||||||
|
elif func == 'start':
|
||||||
|
print(start())
|
||||||
|
elif func == 'stop':
|
||||||
|
print(stop())
|
||||||
|
elif func == 'restart':
|
||||||
|
print(restart())
|
||||||
|
elif func == 'reload':
|
||||||
|
print(reload())
|
||||||
|
elif func == 'conf':
|
||||||
|
print(getPathFile())
|
||||||
|
elif func == 'initd_status':
|
||||||
|
print(initdStatus())
|
||||||
|
elif func == 'initd_install':
|
||||||
|
print(initdInstall())
|
||||||
|
elif func == 'initd_uninstall':
|
||||||
|
print(initdUinstall())
|
||||||
|
elif func == 'run_log':
|
||||||
|
print(getLog())
|
||||||
|
else:
|
||||||
|
print('error')
|
||||||
Executable
+15
@@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
"title":"aria2",
|
||||||
|
"tip":"soft",
|
||||||
|
"name":"aria2",
|
||||||
|
"type":"其他插件",
|
||||||
|
"ps":"一款下载神器",
|
||||||
|
"versions":"1.0",
|
||||||
|
"shell":"install.sh",
|
||||||
|
"checks":"server/aria2",
|
||||||
|
"path": "server/aria2",
|
||||||
|
"author":"midoks",
|
||||||
|
"home":"https://github.com/aria2/aria2",
|
||||||
|
"date":"2020-06-08",
|
||||||
|
"pid": "5"
|
||||||
|
}
|
||||||
Executable
+49
@@ -0,0 +1,49 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# chkconfig: 2345 55 25
|
||||||
|
# description: aria2 Service
|
||||||
|
|
||||||
|
### BEGIN INIT INFO
|
||||||
|
# Provides: aria2
|
||||||
|
# Required-Start: $all
|
||||||
|
# Required-Stop: $all
|
||||||
|
# Default-Start: 2 3 4 5
|
||||||
|
# Default-Stop: 0 1 6
|
||||||
|
# Short-Description: starts aria2
|
||||||
|
# Description: starts the MDW-Web
|
||||||
|
### END INIT INFO
|
||||||
|
|
||||||
|
|
||||||
|
app_start(){
|
||||||
|
# aria2c -D
|
||||||
|
aria2c --daemon --enable-rpc --rpc-listen-all -c -D --conf-path={$SERVER_PATH}/aria2/aria2/aria2.conf
|
||||||
|
echo "aria2 started"
|
||||||
|
}
|
||||||
|
app_stop(){
|
||||||
|
echo "Stopping ..."
|
||||||
|
arr=`ps -ef | grep "aria2" | grep -v 'grep' | grep -v '/bin/sh'|grep -v 'index.py' | awk '{print $2}'`
|
||||||
|
echo $arr
|
||||||
|
for p in ${arr[@]}
|
||||||
|
do
|
||||||
|
kill -9 $p &>/dev/null
|
||||||
|
done
|
||||||
|
echo "aria2 stopped"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
case "$1" in
|
||||||
|
start)
|
||||||
|
app_start
|
||||||
|
;;
|
||||||
|
stop)
|
||||||
|
app_stop
|
||||||
|
;;
|
||||||
|
restart|reload)
|
||||||
|
app_stop
|
||||||
|
sleep 0.3
|
||||||
|
app_start
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "Please use start or stop as first argument"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
Executable
+49
@@ -0,0 +1,49 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
|
||||||
|
export PATH
|
||||||
|
|
||||||
|
curPath=`pwd`
|
||||||
|
rootPath=$(dirname "$curPath")
|
||||||
|
rootPath=$(dirname "$rootPath")
|
||||||
|
serverPath=$(dirname "$rootPath")
|
||||||
|
|
||||||
|
|
||||||
|
install_tmp=${rootPath}/tmp/mw_install.pl
|
||||||
|
|
||||||
|
SYSOS=`uname`
|
||||||
|
|
||||||
|
Install_aria2()
|
||||||
|
{
|
||||||
|
isStart=""
|
||||||
|
echo '正在安装脚本文件...' > $install_tmp
|
||||||
|
mkdir -p $serverPath/aria2
|
||||||
|
echo '1.0' > $serverPath/aria2/version.pl
|
||||||
|
|
||||||
|
if [ "Darwin" == "$SYSOS" ];then
|
||||||
|
echo 'macosx unavailable' > $install_tmp
|
||||||
|
find_sh=`which aria2c`
|
||||||
|
if [ "$?" != "0" ];then
|
||||||
|
brew install aria2
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
find_sh=`which aria2c`
|
||||||
|
if [ "$?" != "0" ];then
|
||||||
|
yum install aria2 -y
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo 'Install complete' > $install_tmp
|
||||||
|
}
|
||||||
|
|
||||||
|
Uninstall_aria2()
|
||||||
|
{
|
||||||
|
rm -rf $serverPath/aria2
|
||||||
|
echo "Uninstall completed" > $install_tmp
|
||||||
|
}
|
||||||
|
|
||||||
|
action=$1
|
||||||
|
if [ "${1}" == 'install' ];then
|
||||||
|
Install_aria2
|
||||||
|
else
|
||||||
|
Uninstall_aria2
|
||||||
|
fi
|
||||||
Executable
+92
@@ -0,0 +1,92 @@
|
|||||||
|
function str2Obj(str){
|
||||||
|
var data = {};
|
||||||
|
kv = str.split('&');
|
||||||
|
for(i in kv){
|
||||||
|
v = kv[i].split('=');
|
||||||
|
data[v[0]] = v[1];
|
||||||
|
}
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
function lpPost(method,args,callback, title){
|
||||||
|
|
||||||
|
var _args = null;
|
||||||
|
if (typeof(args) == 'string'){
|
||||||
|
_args = JSON.stringify(str2Obj(args));
|
||||||
|
} else {
|
||||||
|
_args = JSON.stringify(args);
|
||||||
|
}
|
||||||
|
|
||||||
|
var _title = '正在获取...';
|
||||||
|
if (typeof(title) != 'undefined'){
|
||||||
|
_title = title;
|
||||||
|
}
|
||||||
|
|
||||||
|
var loadT = layer.msg(_title, { icon: 16, time: 0, shade: 0.3 });
|
||||||
|
$.post('/plugins/run', {name:'aria2', func:method, args:_args}, function(data) {
|
||||||
|
layer.close(loadT);
|
||||||
|
if (!data.status){
|
||||||
|
layer.msg(data.msg,{icon:0,time:2000,shade: [0.3, '#000']});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(typeof(callback) == 'function'){
|
||||||
|
callback(data);
|
||||||
|
}
|
||||||
|
},'json');
|
||||||
|
}
|
||||||
|
|
||||||
|
function lpAsyncPost(method,args){
|
||||||
|
var _args = null;
|
||||||
|
if (typeof(args) == 'string'){
|
||||||
|
_args = JSON.stringify(str2Obj(args));
|
||||||
|
} else {
|
||||||
|
_args = JSON.stringify(args);
|
||||||
|
}
|
||||||
|
|
||||||
|
var loadT = layer.msg('正在获取...', { icon: 16, time: 0, shade: 0.3 });
|
||||||
|
return syncPost('/plugins/run', {name:'l2tp', func:method, args:_args});
|
||||||
|
}
|
||||||
|
|
||||||
|
function userList(){
|
||||||
|
lpPost('user_list', '' ,function(data){
|
||||||
|
var rdata = $.parseJSON(data['data']);
|
||||||
|
|
||||||
|
if (!rdata['status']){
|
||||||
|
layer.msg(rdata.msg,{icon:0,time:2000,shade: [0.3, '#000']});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var list = rdata['data'];
|
||||||
|
|
||||||
|
var con = '';
|
||||||
|
con += '<div class="divtable" style="margin-top:5px;"><table class="table table-hover" width="100%" cellspacing="0" cellpadding="0" border="0">';
|
||||||
|
con += '<thead><tr>';
|
||||||
|
con += '<th>用户</th>';
|
||||||
|
con += '<th>密码</th>';
|
||||||
|
con += '<th>操作(<a class="btlink" onclick="addUser()">添加</a>)</th>';
|
||||||
|
con += '</tr></thead>';
|
||||||
|
|
||||||
|
con += '<tbody>';
|
||||||
|
|
||||||
|
for (var i = 0; i < list.length; i++) {
|
||||||
|
con += '<tr>'+
|
||||||
|
'<td>' + list[i]['user']+'</td>' +
|
||||||
|
'<td>' + list[i]['pwd']+'</td>' +
|
||||||
|
'<td><a class="btlink" onclick="modUser(\''+list[i]['user']+'\')">改密</a>|<a class="btlink" onclick="delUser(\''+list[i]['user']+'\')">删除</a></td></tr>';
|
||||||
|
}
|
||||||
|
|
||||||
|
con += '</tbody>';
|
||||||
|
con += '</table></div>';
|
||||||
|
|
||||||
|
$(".soft-man-con").html(con);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function readme(){
|
||||||
|
var readme = '<ul class="help-info-text c7">';
|
||||||
|
readme += '<li>使用时,查看对应的端口</li>';
|
||||||
|
readme += '</ul>';
|
||||||
|
$('.soft-man-con').html(readme);
|
||||||
|
}
|
||||||
@@ -98,12 +98,12 @@ def reload():
|
|||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
func = sys.argv[1]
|
func = sys.argv[1]
|
||||||
if func == 'status':
|
if func == 'status':
|
||||||
print status()
|
print(status())
|
||||||
elif func == 'start':
|
elif func == 'start':
|
||||||
print start()
|
print(start())
|
||||||
elif func == 'stop':
|
elif func == 'stop':
|
||||||
print stop()
|
print(stop())
|
||||||
elif func == 'restart':
|
elif func == 'restart':
|
||||||
print restart()
|
print(restart())
|
||||||
elif func == 'reload':
|
elif func == 'reload':
|
||||||
print reload()
|
print(reload())
|
||||||
|
|||||||
@@ -12,5 +12,5 @@
|
|||||||
"author":"Google",
|
"author":"Google",
|
||||||
"home":"https://github.com/google/bbr",
|
"home":"https://github.com/google/bbr",
|
||||||
"date":"2019-03-29",
|
"date":"2019-03-29",
|
||||||
"pid":"4"
|
"pid":"5"
|
||||||
}
|
}
|
||||||
+25
-25
@@ -658,52 +658,52 @@ def getTotalStatistics():
|
|||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
func = sys.argv[1]
|
func = sys.argv[1]
|
||||||
if func == 'status':
|
if func == 'status':
|
||||||
print status()
|
print(status())
|
||||||
elif func == 'start':
|
elif func == 'start':
|
||||||
print start()
|
print(start())
|
||||||
elif func == 'stop':
|
elif func == 'stop':
|
||||||
print stop()
|
print(stop())
|
||||||
elif func == 'restart':
|
elif func == 'restart':
|
||||||
print restart()
|
print(restart())
|
||||||
elif func == 'reload':
|
elif func == 'reload':
|
||||||
print reload()
|
print(reload())
|
||||||
elif func == 'initd_status':
|
elif func == 'initd_status':
|
||||||
print initdStatus()
|
print(initdStatus())
|
||||||
elif func == 'initd_install':
|
elif func == 'initd_install':
|
||||||
print initdInstall()
|
print(initdInstall())
|
||||||
elif func == 'initd_uninstall':
|
elif func == 'initd_uninstall':
|
||||||
print initdUinstall()
|
print(initdUinstall())
|
||||||
elif func == 'csvn_edit':
|
elif func == 'csvn_edit':
|
||||||
print csvnEdit()
|
print(csvnEdit())
|
||||||
elif func == 'user_list':
|
elif func == 'user_list':
|
||||||
print userList()
|
print(userList())
|
||||||
elif func == 'user_add':
|
elif func == 'user_add':
|
||||||
print userAdd()
|
print(userAdd())
|
||||||
elif func == 'user_del':
|
elif func == 'user_del':
|
||||||
print userDel()
|
print(userDel())
|
||||||
elif func == 'project_list':
|
elif func == 'project_list':
|
||||||
print projectList()
|
print(projectList())
|
||||||
elif func == 'project_del':
|
elif func == 'project_del':
|
||||||
print projectDel()
|
print(projectDel())
|
||||||
elif func == 'project_add':
|
elif func == 'project_add':
|
||||||
print projectAdd()
|
print(projectAdd())
|
||||||
elif func == 'project_acl_list':
|
elif func == 'project_acl_list':
|
||||||
print projectAclList()
|
print(projectAclList())
|
||||||
elif func == 'project_acl_add':
|
elif func == 'project_acl_add':
|
||||||
print projectAclAdd()
|
print(projectAclAdd())
|
||||||
elif func == 'project_acl_del':
|
elif func == 'project_acl_del':
|
||||||
print projectAclDel()
|
print(projectAclDel())
|
||||||
elif func == 'project_acl_set':
|
elif func == 'project_acl_set':
|
||||||
print projectAclSet()
|
print(projectAclSet())
|
||||||
elif func == 'project_script_load':
|
elif func == 'project_script_load':
|
||||||
print projectScriptLoad()
|
print(projectScriptLoad())
|
||||||
elif func == 'project_script_unload':
|
elif func == 'project_script_unload':
|
||||||
print projectScriptUnload()
|
print(projectScriptUnload())
|
||||||
elif func == 'project_script_edit':
|
elif func == 'project_script_edit':
|
||||||
print projectScriptEdit()
|
print(projectScriptEdit())
|
||||||
elif func == 'project_script_debug':
|
elif func == 'project_script_debug':
|
||||||
print projectScriptDebug()
|
print(projectScriptDebug())
|
||||||
elif func == 'get_total_statistics':
|
elif func == 'get_total_statistics':
|
||||||
print getTotalStatistics()
|
print(getTotalStatistics())
|
||||||
else:
|
else:
|
||||||
print 'fail'
|
print('fail')
|
||||||
|
|||||||
+24
-24
@@ -637,50 +637,50 @@ def getTotalStatistics():
|
|||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
func = sys.argv[1]
|
func = sys.argv[1]
|
||||||
if func == 'status':
|
if func == 'status':
|
||||||
print status()
|
print(status())
|
||||||
elif func == 'start':
|
elif func == 'start':
|
||||||
print start()
|
print(start())
|
||||||
elif func == 'stop':
|
elif func == 'stop':
|
||||||
print stop()
|
print(stop())
|
||||||
elif func == 'restart':
|
elif func == 'restart':
|
||||||
print restart()
|
print(restart())
|
||||||
elif func == 'reload':
|
elif func == 'reload':
|
||||||
print reload()
|
print(reload())
|
||||||
elif func == 'initd_status':
|
elif func == 'initd_status':
|
||||||
print initdStatus()
|
print(initdStatus())
|
||||||
elif func == 'initd_install':
|
elif func == 'initd_install':
|
||||||
print initdInstall()
|
print(initdInstall())
|
||||||
elif func == 'initd_uninstall':
|
elif func == 'initd_uninstall':
|
||||||
print initdUinstall()
|
print(initdUinstall())
|
||||||
elif func == 'run_log':
|
elif func == 'run_log':
|
||||||
print runLog()
|
print(runLog())
|
||||||
elif func == 'post_receive_log':
|
elif func == 'post_receive_log':
|
||||||
print postReceiveLog()
|
print(postReceiveLog())
|
||||||
elif func == 'conf':
|
elif func == 'conf':
|
||||||
print getConf()
|
print(getConf())
|
||||||
elif func == 'init_conf':
|
elif func == 'init_conf':
|
||||||
print getInitdConf()
|
print(getInitdConf())
|
||||||
elif func == 'get_gogs_conf':
|
elif func == 'get_gogs_conf':
|
||||||
print getGogsConf()
|
print(getGogsConf())
|
||||||
elif func == 'submit_gogs_conf':
|
elif func == 'submit_gogs_conf':
|
||||||
print submitGogsConf()
|
print(submitGogsConf())
|
||||||
elif func == 'user_list':
|
elif func == 'user_list':
|
||||||
print userList()
|
print(userList())
|
||||||
elif func == 'user_project_list':
|
elif func == 'user_project_list':
|
||||||
print userProjectList()
|
print(userProjectList())
|
||||||
elif func == 'project_script_edit':
|
elif func == 'project_script_edit':
|
||||||
print projectScriptEdit()
|
print(projectScriptEdit())
|
||||||
elif func == 'project_script_load':
|
elif func == 'project_script_load':
|
||||||
print projectScriptLoad()
|
print(projectScriptLoad())
|
||||||
elif func == 'project_script_unload':
|
elif func == 'project_script_unload':
|
||||||
print projectScriptUnload()
|
print(projectScriptUnload())
|
||||||
elif func == 'project_script_debug':
|
elif func == 'project_script_debug':
|
||||||
print projectScriptDebug()
|
print(projectScriptDebug())
|
||||||
elif func == 'gogs_edit':
|
elif func == 'gogs_edit':
|
||||||
print gogsEdit()
|
print(gogsEdit())
|
||||||
elif func == 'get_rsa_public':
|
elif func == 'get_rsa_public':
|
||||||
print getRsaPublic()
|
print(getRsaPublic())
|
||||||
elif func == 'get_total_statistics':
|
elif func == 'get_total_statistics':
|
||||||
print getTotalStatistics()
|
print(getTotalStatistics())
|
||||||
else:
|
else:
|
||||||
print 'fail'
|
print('fail')
|
||||||
|
|||||||
@@ -4,8 +4,8 @@
|
|||||||
"name": "memcached",
|
"name": "memcached",
|
||||||
"title": "Memcached",
|
"title": "Memcached",
|
||||||
"shell": "install.sh",
|
"shell": "install.sh",
|
||||||
"versions":["1.5"],
|
"versions":["1.6"],
|
||||||
"updates":["1.5.12"],
|
"updates":["1.6.9"],
|
||||||
"tip": "soft",
|
"tip": "soft",
|
||||||
"checks": "server/memcached",
|
"checks": "server/memcached",
|
||||||
"path":"server/memcached",
|
"path":"server/memcached",
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ Install_mem(){
|
|||||||
echo '正在安装脚本文件...' > $install_tmp
|
echo '正在安装脚本文件...' > $install_tmp
|
||||||
|
|
||||||
if [ ! -f $serverPath/source/memcached.tar.gz ];then
|
if [ ! -f $serverPath/source/memcached.tar.gz ];then
|
||||||
wget -O $serverPath/source/memcached.tar.gz http://www.memcached.org/files/memcached-1.5.12.tar.gz
|
wget -O $serverPath/source/memcached.tar.gz http://www.memcached.org/files/memcached-1.6.9.tar.gz
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cd $serverPath/source && tar -zxvf memcached.tar.gz
|
cd $serverPath/source && tar -zxvf memcached.tar.gz
|
||||||
@@ -25,7 +25,7 @@ Install_mem(){
|
|||||||
cd $serverPath/source/memcached*
|
cd $serverPath/source/memcached*
|
||||||
./configure --prefix=$serverPath/memcached && make && make install
|
./configure --prefix=$serverPath/memcached && make && make install
|
||||||
|
|
||||||
echo '1.5' > $serverPath/memcached/version.pl
|
echo '1.6' > $serverPath/memcached/version.pl
|
||||||
echo 'install ok' > $install_tmp
|
echo 'install ok' > $install_tmp
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
[client]
|
[client]
|
||||||
|
user = root
|
||||||
#password = your_password
|
#password = your_password
|
||||||
port = 3306
|
port = 3306
|
||||||
socket = {$SERVER_APP_PATH}/mysql.sock
|
socket = {$SERVER_APP_PATH}/mysql.sock
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
[client]
|
[client]
|
||||||
|
user = root
|
||||||
#password = your_password
|
#password = your_password
|
||||||
port = 3306
|
port = 3306
|
||||||
socket = {$SERVER_APP_PATH}/mysql.sock
|
socket = {$SERVER_APP_PATH}/mysql.sock
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
lua_shared_dict limit 30m;
|
lua_shared_dict limit 30m;
|
||||||
lua_shared_dict drop_ip 30m;
|
lua_shared_dict drop_ip 30m;
|
||||||
lua_shared_dict drop_sum 30m;
|
lua_shared_dict drop_sum 30m;
|
||||||
lua_package_path "{$WAF_PATH}/lua/?.lua";
|
lua_package_path "{$WAF_PATH}/lua/?.lua;{$ROOT_PATH}/openresty/lualib/?.lua;;";
|
||||||
access_by_lua_file {$WAF_PATH}/lua/init.lua;
|
access_by_lua_file {$WAF_PATH}/lua/init.lua;
|
||||||
|
|
||||||
#init_by_lua_file {$WAF_PATH}/lua/init.lua;
|
#init_by_lua_file {$WAF_PATH}/lua/init.lua;
|
||||||
|
|||||||
+13
-13
@@ -172,10 +172,6 @@ def initTotalInfo():
|
|||||||
|
|
||||||
|
|
||||||
def status():
|
def status():
|
||||||
initDomainInfo()
|
|
||||||
initSiteInfo()
|
|
||||||
initTotalInfo()
|
|
||||||
|
|
||||||
path = getConf()
|
path = getConf()
|
||||||
if not os.path.exists(path):
|
if not os.path.exists(path):
|
||||||
return 'stop'
|
return 'stop'
|
||||||
@@ -199,19 +195,19 @@ def contentReplace(content):
|
|||||||
|
|
||||||
def initDreplace():
|
def initDreplace():
|
||||||
|
|
||||||
config = getPluginDir() + '/waf/config.json'
|
|
||||||
content = mw.readFile(config)
|
|
||||||
content = json.loads(content)
|
|
||||||
content['reqfile_path'] = mw.getServerDir(
|
|
||||||
) + "/openresty/nginx/conf/waf/html"
|
|
||||||
mw.writeFile(config, mw.getJson(content))
|
|
||||||
|
|
||||||
path = mw.getServerDir() + "/openresty/nginx/conf"
|
path = mw.getServerDir() + "/openresty/nginx/conf"
|
||||||
if not os.path.exists(path + '/waf'):
|
if not os.path.exists(path + '/waf'):
|
||||||
sdir = getPluginDir() + '/waf'
|
sdir = getPluginDir() + '/waf'
|
||||||
cmd = 'cp -rf ' + sdir + ' ' + path
|
cmd = 'cp -rf ' + sdir + ' ' + path
|
||||||
mw.execShell(cmd)
|
mw.execShell(cmd)
|
||||||
|
|
||||||
|
config = mw.getServerDir() + '/openresty/nginx/conf/waf/config.json'
|
||||||
|
content = mw.readFile(config)
|
||||||
|
content = json.loads(content)
|
||||||
|
content['reqfile_path'] = mw.getServerDir(
|
||||||
|
) + "/openresty/nginx/conf/waf/html"
|
||||||
|
mw.writeFile(config, mw.getJson(content))
|
||||||
|
|
||||||
config = mw.getServerDir() + "/openresty/nginx/conf/waf/lua/init.lua"
|
config = mw.getServerDir() + "/openresty/nginx/conf/waf/lua/init.lua"
|
||||||
content = mw.readFile(config)
|
content = mw.readFile(config)
|
||||||
content = contentReplace(content)
|
content = contentReplace(content)
|
||||||
@@ -223,6 +219,10 @@ def initDreplace():
|
|||||||
content = contentReplace(content)
|
content = contentReplace(content)
|
||||||
mw.writeFile(waf_conf, content)
|
mw.writeFile(waf_conf, content)
|
||||||
|
|
||||||
|
initDomainInfo()
|
||||||
|
initSiteInfo()
|
||||||
|
initTotalInfo()
|
||||||
|
|
||||||
|
|
||||||
def start():
|
def start():
|
||||||
initDreplace()
|
initDreplace()
|
||||||
@@ -669,7 +669,7 @@ def setCcConf():
|
|||||||
|
|
||||||
|
|
||||||
def setSiteCcConf():
|
def setSiteCcConf():
|
||||||
return mw.returnJson(True, '设置成功-?!', [])
|
return mw.returnJson(False, '暂未开发!', [])
|
||||||
|
|
||||||
|
|
||||||
def saveScanRule():
|
def saveScanRule():
|
||||||
@@ -986,4 +986,4 @@ if __name__ == "__main__":
|
|||||||
elif func == 'waf_site':
|
elif func == 'waf_site':
|
||||||
print getWafSite()
|
print getWafSite()
|
||||||
else:
|
else:
|
||||||
print 'error'
|
print('error')
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"title":"OP防火墙[DEV]",
|
"title":"OP防火墙",
|
||||||
"tip":"soft",
|
"tip":"soft",
|
||||||
"name":"op_waf",
|
"name":"op_waf",
|
||||||
"type":"其他插件",
|
"type":"其他插件",
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
{"reqfile_path":"/Users/midoks/Desktop/fwww/server/openresty/nginx/conf/waf/html","retry":{"retry_time":180,"is_open_global":0,"retry":6,"retry_cycle":60},"log":true,"scan":{"status":444,"ps":"过滤常见扫描测试工具的渗透测试","open":true,"reqfile":""},"cc":{"status":444,"ps":"过虑CC攻击","limit":120,"endtime":300,"open":true,"reqfile":"","cycle":60},"get":{"status":403,"ps":"过滤uri、uri参数中常见sql注入、xss等攻击","open":true,"reqfile":"get.html"},"log_save":30,"user-agent":{"status":403,"ps":"通常用于过滤浏览器、蜘蛛及一些自动扫描器","open":true,"reqfile":"user_agent.html"},"other":{"status":403,"ps":"其它非通用过滤","reqfile":"other.html"},"cookie":{"status":403,"ps":"过滤利用Cookie发起的渗透攻击","open":true,"reqfile":"cookie.html"},"logs_path":"/www/wwwlogs/btwaf","post":{"status":403,"ps":"过滤POST参数中常见sql注入、xss等攻击","open":true,"reqfile":"post.html"},"open":true}
|
{"reqfile_path": "{$WAF_PATH}/html", "retry": {"retry_time": 180, "is_open_global": 0, "retry": 6, "retry_cycle": 60}, "log": true, "scan": {"status": 444, "ps": "\u8fc7\u6ee4\u5e38\u89c1\u626b\u63cf\u6d4b\u8bd5\u5de5\u5177\u7684\u6e17\u900f\u6d4b\u8bd5", "open": true, "reqfile": ""}, "cc": {"status": 444, "ps": "\u8fc7\u8651CC\u653b\u51fb", "limit": 120, "endtime": 300, "open": true, "reqfile": "", "cycle": 60}, "get": {"status": 403, "ps": "\u8fc7\u6ee4uri\u3001uri\u53c2\u6570\u4e2d\u5e38\u89c1sql\u6ce8\u5165\u3001xss\u7b49\u653b\u51fb", "open": true, "reqfile": "get.html"}, "log_save": 30, "user-agent": {"status": 403, "ps": "\u901a\u5e38\u7528\u4e8e\u8fc7\u6ee4\u6d4f\u89c8\u5668\u3001\u8718\u86db\u53ca\u4e00\u4e9b\u81ea\u52a8\u626b\u63cf\u5668", "open": true, "reqfile": "user_agent.html"}, "other": {"status": 403, "ps": "\u5176\u5b83\u975e\u901a\u7528\u8fc7\u6ee4", "reqfile": "other.html"}, "cookie": {"status": 403, "ps": "\u8fc7\u6ee4\u5229\u7528Cookie\u53d1\u8d77\u7684\u6e17\u900f\u653b\u51fb", "open": true, "reqfile": "cookie.html"}, "logs_path": "/www/wwwlogs/btwaf", "post": {"status": 403, "ps": "\u8fc7\u6ee4POST\u53c2\u6570\u4e2d\u5e38\u89c1sql\u6ce8\u5165\u3001xss\u7b49\u653b\u51fb", "open": true, "reqfile": "post.html"}, "open": true}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
local cpath = "/Users/midoks/Desktop/fwww/server/openresty/nginx/conf/waf/"
|
local cpath = "{$WAF_PATH}/"
|
||||||
local rpath = "/Users/midoks/Desktop/fwww/server/openresty/nginx/conf/waf/rule/"
|
local rpath = "{$WAF_PATH}/rule/"
|
||||||
local logdir = "/Users/midoks/Desktop/fwww/wwwlogs/waf/"
|
local logdir = "{$ROOT_PATH}/wwwlogs/waf/"
|
||||||
local json = require "cjson"
|
local json = require "cjson"
|
||||||
local ngx_match = ngx.re.find
|
local ngx_match = ngx.re.find
|
||||||
|
|
||||||
|
|||||||
+13
-13
@@ -282,28 +282,28 @@ def errorLogPath():
|
|||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
func = sys.argv[1]
|
func = sys.argv[1]
|
||||||
if func == 'status':
|
if func == 'status':
|
||||||
print status()
|
print(status())
|
||||||
elif func == 'start':
|
elif func == 'start':
|
||||||
print start()
|
print(start())
|
||||||
elif func == 'stop':
|
elif func == 'stop':
|
||||||
print stop()
|
print(stop())
|
||||||
elif func == 'restart':
|
elif func == 'restart':
|
||||||
print restart()
|
print(restart())
|
||||||
elif func == 'reload':
|
elif func == 'reload':
|
||||||
print reload()
|
print(reload())
|
||||||
elif func == 'initd_status':
|
elif func == 'initd_status':
|
||||||
print initdStatus()
|
print(initdStatus())
|
||||||
elif func == 'initd_install':
|
elif func == 'initd_install':
|
||||||
print initdInstall()
|
print(initdInstall())
|
||||||
elif func == 'initd_uninstall':
|
elif func == 'initd_uninstall':
|
||||||
print initdUinstall()
|
print(initdUinstall())
|
||||||
elif func == 'conf':
|
elif func == 'conf':
|
||||||
print getConf()
|
print(getConf())
|
||||||
elif func == 'get_os':
|
elif func == 'get_os':
|
||||||
print getOs()
|
print(getOs())
|
||||||
elif func == 'run_info':
|
elif func == 'run_info':
|
||||||
print runInfo()
|
print(runInfo())
|
||||||
elif func == 'error_log':
|
elif func == 'error_log':
|
||||||
print errorLogPath()
|
print(errorLogPath())
|
||||||
else:
|
else:
|
||||||
print 'error'
|
print('error')
|
||||||
|
|||||||
Executable
+90
@@ -0,0 +1,90 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
|
||||||
|
export PATH
|
||||||
|
|
||||||
|
curPath=`pwd`
|
||||||
|
|
||||||
|
rootPath=$(dirname "$curPath")
|
||||||
|
rootPath=$(dirname "$rootPath")
|
||||||
|
rootPath=$(dirname "$rootPath")
|
||||||
|
rootPath=$(dirname "$rootPath")
|
||||||
|
serverPath=$(dirname "$rootPath")
|
||||||
|
sourcePath=${serverPath}/source/php
|
||||||
|
|
||||||
|
actionType=$1
|
||||||
|
version=$2
|
||||||
|
|
||||||
|
LIBNAME=openssl
|
||||||
|
LIBV=0
|
||||||
|
|
||||||
|
extFile=$serverPath/php/${version}/lib/php/extensions/no-debug-non-zts-20131226/${LIBNAME}.so
|
||||||
|
|
||||||
|
sysName=`uname`
|
||||||
|
if [ "$sysName" == "Darwin" ];then
|
||||||
|
BAK='_bak'
|
||||||
|
else
|
||||||
|
BAK=''
|
||||||
|
fi
|
||||||
|
|
||||||
|
Install_lib()
|
||||||
|
{
|
||||||
|
|
||||||
|
isInstall=`cat $serverPath/php/$version/etc/php.ini|grep "${LIBNAME}.so"`
|
||||||
|
if [ "${isInstall}" != "" ];then
|
||||||
|
echo "php-$version 已安装${LIBNAME},请选择其它版本!"
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -f "$extFile" ];then
|
||||||
|
|
||||||
|
cd $sourcePath/php${version}/ext/${LIBNAME}
|
||||||
|
|
||||||
|
if [ ! -f "config.m4" ];then
|
||||||
|
mv config0.m4 config.m4
|
||||||
|
fi
|
||||||
|
|
||||||
|
$serverPath/php/$version/bin/phpize
|
||||||
|
./configure --with-php-config=$serverPath/php/$version/bin/php-config
|
||||||
|
make clean && make && make install && make clean
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "" >> $serverPath/php/$version/etc/php.ini
|
||||||
|
echo "[${LIBNAME}]" >> $serverPath/php/$version/etc/php.ini
|
||||||
|
echo "extension=${LIBNAME}.so" >> $serverPath/php/$version/etc/php.ini
|
||||||
|
|
||||||
|
$serverPath/php/init.d/php$version reload
|
||||||
|
echo '==========================================================='
|
||||||
|
echo 'successful!'
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Uninstall_lib()
|
||||||
|
{
|
||||||
|
if [ ! -f "$serverPath/php/$version/bin/php-config" ];then
|
||||||
|
echo "php-$version 未安装,请选择其它版本!"
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -f "$extFile" ];then
|
||||||
|
echo "php-$version 未安装${LIBNAME},请选择其它版本!"
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo $serverPath/php/$version/etc/php.ini
|
||||||
|
sed -i $BAK "/${LIBNAME}.so/d" $serverPath/php/$version/etc/php.ini
|
||||||
|
sed -i $BAK "/${LIBNAME}/d" $serverPath/php/$version/etc/php.ini
|
||||||
|
|
||||||
|
rm -f $extFile
|
||||||
|
$serverPath/php/init.d/php$version reload
|
||||||
|
echo '==============================================='
|
||||||
|
echo 'successful!'
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if [ "$actionType" == 'install' ];then
|
||||||
|
Install_lib
|
||||||
|
elif [ "$actionType" == 'uninstall' ];then
|
||||||
|
Uninstall_lib
|
||||||
|
fi
|
||||||
Executable
+87
@@ -0,0 +1,87 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
|
||||||
|
export PATH
|
||||||
|
|
||||||
|
curPath=`pwd`
|
||||||
|
|
||||||
|
rootPath=$(dirname "$curPath")
|
||||||
|
rootPath=$(dirname "$rootPath")
|
||||||
|
rootPath=$(dirname "$rootPath")
|
||||||
|
rootPath=$(dirname "$rootPath")
|
||||||
|
serverPath=$(dirname "$rootPath")
|
||||||
|
sourcePath=${serverPath}/source/php
|
||||||
|
|
||||||
|
actionType=$1
|
||||||
|
version=$2
|
||||||
|
|
||||||
|
LIBNAME=mcrypt
|
||||||
|
LIBV=0
|
||||||
|
|
||||||
|
extFile=$serverPath/php/${version}/lib/php/extensions/no-debug-non-zts-20160303/${LIBNAME}.so
|
||||||
|
|
||||||
|
sysName=`uname`
|
||||||
|
if [ "$sysName" == "Darwin" ];then
|
||||||
|
BAK='_bak'
|
||||||
|
else
|
||||||
|
BAK=''
|
||||||
|
fi
|
||||||
|
|
||||||
|
Install_lib()
|
||||||
|
{
|
||||||
|
|
||||||
|
isInstall=`cat $serverPath/php/$version/etc/php.ini|grep "${LIBNAME}.so"`
|
||||||
|
if [ "${isInstall}" != "" ];then
|
||||||
|
echo "php-$version 已安装${LIBNAME},请选择其它版本!"
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -f "$extFile" ];then
|
||||||
|
|
||||||
|
cd $sourcePath/php${version}/ext/${LIBNAME}
|
||||||
|
|
||||||
|
|
||||||
|
$serverPath/php/$version/bin/phpize
|
||||||
|
./configure --with-php-config=$serverPath/php/$version/bin/php-config
|
||||||
|
make clean && make && make install && make clean
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "" >> $serverPath/php/$version/etc/php.ini
|
||||||
|
echo "[${LIBNAME}]" >> $serverPath/php/$version/etc/php.ini
|
||||||
|
echo "extension=${LIBNAME}.so" >> $serverPath/php/$version/etc/php.ini
|
||||||
|
|
||||||
|
$serverPath/php/init.d/php$version reload
|
||||||
|
echo '==========================================================='
|
||||||
|
echo 'successful!'
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Uninstall_lib()
|
||||||
|
{
|
||||||
|
if [ ! -f "$serverPath/php/$version/bin/php-config" ];then
|
||||||
|
echo "php-$version 未安装,请选择其它版本!"
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -f "$extFile" ];then
|
||||||
|
echo "php-$version 未安装${LIBNAME},请选择其它版本!"
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo $serverPath/php/$version/etc/php.ini
|
||||||
|
sed -i $BAK "/${LIBNAME}.so/d" $serverPath/php/$version/etc/php.ini
|
||||||
|
sed -i $BAK "/${LIBNAME}/d" $serverPath/php/$version/etc/php.ini
|
||||||
|
|
||||||
|
rm -f $extFile
|
||||||
|
$serverPath/php/init.d/php$version reload
|
||||||
|
echo '==============================================='
|
||||||
|
echo 'successful!'
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if [ "$actionType" == 'install' ];then
|
||||||
|
Install_lib
|
||||||
|
elif [ "$actionType" == 'uninstall' ];then
|
||||||
|
Uninstall_lib
|
||||||
|
fi
|
||||||
Executable
+90
@@ -0,0 +1,90 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
|
||||||
|
export PATH
|
||||||
|
|
||||||
|
curPath=`pwd`
|
||||||
|
|
||||||
|
rootPath=$(dirname "$curPath")
|
||||||
|
rootPath=$(dirname "$rootPath")
|
||||||
|
rootPath=$(dirname "$rootPath")
|
||||||
|
rootPath=$(dirname "$rootPath")
|
||||||
|
serverPath=$(dirname "$rootPath")
|
||||||
|
sourcePath=${serverPath}/source/php
|
||||||
|
|
||||||
|
actionType=$1
|
||||||
|
version=$2
|
||||||
|
|
||||||
|
LIBNAME=openssl
|
||||||
|
LIBV=0
|
||||||
|
|
||||||
|
extFile=$serverPath/php/${version}/lib/php/extensions/no-debug-non-zts-20160303/${LIBNAME}.so
|
||||||
|
|
||||||
|
sysName=`uname`
|
||||||
|
if [ "$sysName" == "Darwin" ];then
|
||||||
|
BAK='_bak'
|
||||||
|
else
|
||||||
|
BAK=''
|
||||||
|
fi
|
||||||
|
|
||||||
|
Install_lib()
|
||||||
|
{
|
||||||
|
|
||||||
|
isInstall=`cat $serverPath/php/$version/etc/php.ini|grep "${LIBNAME}.so"`
|
||||||
|
if [ "${isInstall}" != "" ];then
|
||||||
|
echo "php-$version 已安装${LIBNAME},请选择其它版本!"
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -f "$extFile" ];then
|
||||||
|
|
||||||
|
cd $sourcePath/php${version}/ext/${LIBNAME}
|
||||||
|
|
||||||
|
if [ ! -f "config.m4" ];then
|
||||||
|
mv config0.m4 config.m4
|
||||||
|
fi
|
||||||
|
|
||||||
|
$serverPath/php/$version/bin/phpize
|
||||||
|
./configure --with-php-config=$serverPath/php/$version/bin/php-config
|
||||||
|
make clean && make && make install && make clean
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "" >> $serverPath/php/$version/etc/php.ini
|
||||||
|
echo "[${LIBNAME}]" >> $serverPath/php/$version/etc/php.ini
|
||||||
|
echo "extension=${LIBNAME}.so" >> $serverPath/php/$version/etc/php.ini
|
||||||
|
|
||||||
|
$serverPath/php/init.d/php$version reload
|
||||||
|
echo '==========================================================='
|
||||||
|
echo 'successful!'
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Uninstall_lib()
|
||||||
|
{
|
||||||
|
if [ ! -f "$serverPath/php/$version/bin/php-config" ];then
|
||||||
|
echo "php-$version 未安装,请选择其它版本!"
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -f "$extFile" ];then
|
||||||
|
echo "php-$version 未安装${LIBNAME},请选择其它版本!"
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo $serverPath/php/$version/etc/php.ini
|
||||||
|
sed -i $BAK "/${LIBNAME}.so/d" $serverPath/php/$version/etc/php.ini
|
||||||
|
sed -i $BAK "/${LIBNAME}/d" $serverPath/php/$version/etc/php.ini
|
||||||
|
|
||||||
|
rm -f $extFile
|
||||||
|
$serverPath/php/init.d/php$version reload
|
||||||
|
echo '==============================================='
|
||||||
|
echo 'successful!'
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if [ "$actionType" == 'install' ];then
|
||||||
|
Install_lib
|
||||||
|
elif [ "$actionType" == 'uninstall' ];then
|
||||||
|
Uninstall_lib
|
||||||
|
fi
|
||||||
@@ -11,7 +11,7 @@ sysName=`uname`
|
|||||||
install_tmp=${rootPath}/tmp/mw_install.pl
|
install_tmp=${rootPath}/tmp/mw_install.pl
|
||||||
|
|
||||||
|
|
||||||
version=7.2.32
|
version=7.2.34
|
||||||
PHP_VER=72
|
PHP_VER=72
|
||||||
Install_php()
|
Install_php()
|
||||||
{
|
{
|
||||||
|
|||||||
Executable
+87
@@ -0,0 +1,87 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
|
||||||
|
export PATH
|
||||||
|
|
||||||
|
curPath=`pwd`
|
||||||
|
|
||||||
|
rootPath=$(dirname "$curPath")
|
||||||
|
rootPath=$(dirname "$rootPath")
|
||||||
|
rootPath=$(dirname "$rootPath")
|
||||||
|
rootPath=$(dirname "$rootPath")
|
||||||
|
serverPath=$(dirname "$rootPath")
|
||||||
|
sourcePath=${serverPath}/source/php
|
||||||
|
|
||||||
|
actionType=$1
|
||||||
|
version=$2
|
||||||
|
|
||||||
|
LIBNAME=mcrypt
|
||||||
|
LIBV=0
|
||||||
|
|
||||||
|
extFile=$serverPath/php/${version}/lib/php/extensions/no-debug-non-zts-20170718/${LIBNAME}.so
|
||||||
|
|
||||||
|
sysName=`uname`
|
||||||
|
if [ "$sysName" == "Darwin" ];then
|
||||||
|
BAK='_bak'
|
||||||
|
else
|
||||||
|
BAK=''
|
||||||
|
fi
|
||||||
|
|
||||||
|
Install_lib()
|
||||||
|
{
|
||||||
|
|
||||||
|
isInstall=`cat $serverPath/php/$version/etc/php.ini|grep "${LIBNAME}.so"`
|
||||||
|
if [ "${isInstall}" != "" ];then
|
||||||
|
echo "php-$version 已安装${LIBNAME},请选择其它版本!"
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -f "$extFile" ];then
|
||||||
|
|
||||||
|
cd $sourcePath/php${version}/ext/${LIBNAME}
|
||||||
|
|
||||||
|
|
||||||
|
$serverPath/php/$version/bin/phpize
|
||||||
|
./configure --with-php-config=$serverPath/php/$version/bin/php-config
|
||||||
|
make clean && make && make install && make clean
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "" >> $serverPath/php/$version/etc/php.ini
|
||||||
|
echo "[${LIBNAME}]" >> $serverPath/php/$version/etc/php.ini
|
||||||
|
echo "extension=${LIBNAME}.so" >> $serverPath/php/$version/etc/php.ini
|
||||||
|
|
||||||
|
$serverPath/php/init.d/php$version reload
|
||||||
|
echo '==========================================================='
|
||||||
|
echo 'successful!'
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Uninstall_lib()
|
||||||
|
{
|
||||||
|
if [ ! -f "$serverPath/php/$version/bin/php-config" ];then
|
||||||
|
echo "php-$version 未安装,请选择其它版本!"
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -f "$extFile" ];then
|
||||||
|
echo "php-$version 未安装${LIBNAME},请选择其它版本!"
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo $serverPath/php/$version/etc/php.ini
|
||||||
|
sed -i $BAK "/${LIBNAME}.so/d" $serverPath/php/$version/etc/php.ini
|
||||||
|
sed -i $BAK "/${LIBNAME}/d" $serverPath/php/$version/etc/php.ini
|
||||||
|
|
||||||
|
rm -f $extFile
|
||||||
|
$serverPath/php/init.d/php$version reload
|
||||||
|
echo '==============================================='
|
||||||
|
echo 'successful!'
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if [ "$actionType" == 'install' ];then
|
||||||
|
Install_lib
|
||||||
|
elif [ "$actionType" == 'uninstall' ];then
|
||||||
|
Uninstall_lib
|
||||||
|
fi
|
||||||
Executable
+90
@@ -0,0 +1,90 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
|
||||||
|
export PATH
|
||||||
|
|
||||||
|
curPath=`pwd`
|
||||||
|
|
||||||
|
rootPath=$(dirname "$curPath")
|
||||||
|
rootPath=$(dirname "$rootPath")
|
||||||
|
rootPath=$(dirname "$rootPath")
|
||||||
|
rootPath=$(dirname "$rootPath")
|
||||||
|
serverPath=$(dirname "$rootPath")
|
||||||
|
sourcePath=${serverPath}/source/php
|
||||||
|
|
||||||
|
actionType=$1
|
||||||
|
version=$2
|
||||||
|
|
||||||
|
LIBNAME=openssl
|
||||||
|
LIBV=0
|
||||||
|
|
||||||
|
extFile=$serverPath/php/${version}/lib/php/extensions/no-debug-non-zts-20170718/${LIBNAME}.so
|
||||||
|
|
||||||
|
sysName=`uname`
|
||||||
|
if [ "$sysName" == "Darwin" ];then
|
||||||
|
BAK='_bak'
|
||||||
|
else
|
||||||
|
BAK=''
|
||||||
|
fi
|
||||||
|
|
||||||
|
Install_lib()
|
||||||
|
{
|
||||||
|
|
||||||
|
isInstall=`cat $serverPath/php/$version/etc/php.ini|grep "${LIBNAME}.so"`
|
||||||
|
if [ "${isInstall}" != "" ];then
|
||||||
|
echo "php-$version 已安装${LIBNAME},请选择其它版本!"
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -f "$extFile" ];then
|
||||||
|
|
||||||
|
cd $sourcePath/php${version}/ext/${LIBNAME}
|
||||||
|
|
||||||
|
if [ ! -f "config.m4" ];then
|
||||||
|
mv config0.m4 config.m4
|
||||||
|
fi
|
||||||
|
|
||||||
|
$serverPath/php/$version/bin/phpize
|
||||||
|
./configure --with-php-config=$serverPath/php/$version/bin/php-config
|
||||||
|
make clean && make && make install && make clean
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "" >> $serverPath/php/$version/etc/php.ini
|
||||||
|
echo "[${LIBNAME}]" >> $serverPath/php/$version/etc/php.ini
|
||||||
|
echo "extension=${LIBNAME}.so" >> $serverPath/php/$version/etc/php.ini
|
||||||
|
|
||||||
|
$serverPath/php/init.d/php$version reload
|
||||||
|
echo '==========================================================='
|
||||||
|
echo 'successful!'
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Uninstall_lib()
|
||||||
|
{
|
||||||
|
if [ ! -f "$serverPath/php/$version/bin/php-config" ];then
|
||||||
|
echo "php-$version 未安装,请选择其它版本!"
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -f "$extFile" ];then
|
||||||
|
echo "php-$version 未安装${LIBNAME},请选择其它版本!"
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo $serverPath/php/$version/etc/php.ini
|
||||||
|
sed -i $BAK "/${LIBNAME}.so/d" $serverPath/php/$version/etc/php.ini
|
||||||
|
sed -i $BAK "/${LIBNAME}/d" $serverPath/php/$version/etc/php.ini
|
||||||
|
|
||||||
|
rm -f $extFile
|
||||||
|
$serverPath/php/init.d/php$version reload
|
||||||
|
echo '==============================================='
|
||||||
|
echo 'successful!'
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if [ "$actionType" == 'install' ];then
|
||||||
|
Install_lib
|
||||||
|
elif [ "$actionType" == 'uninstall' ];then
|
||||||
|
Uninstall_lib
|
||||||
|
fi
|
||||||
@@ -11,7 +11,7 @@ sysName=`uname`
|
|||||||
install_tmp=${rootPath}/tmp/mw_install.pl
|
install_tmp=${rootPath}/tmp/mw_install.pl
|
||||||
|
|
||||||
|
|
||||||
version=7.4.15
|
version=7.4.16
|
||||||
PHP_VER=74
|
PHP_VER=74
|
||||||
Install_php()
|
Install_php()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ sysName=`uname`
|
|||||||
install_tmp=${rootPath}/tmp/mw_install.pl
|
install_tmp=${rootPath}/tmp/mw_install.pl
|
||||||
|
|
||||||
|
|
||||||
version=8.0.2
|
version=8.0.3
|
||||||
PHP_VER=80
|
PHP_VER=80
|
||||||
Install_php()
|
Install_php()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -48,6 +48,29 @@
|
|||||||
"shell": "opcache.sh",
|
"shell": "opcache.sh",
|
||||||
"check": "opcache.so"
|
"check": "opcache.so"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "openssl",
|
||||||
|
"versions": [
|
||||||
|
"56",
|
||||||
|
"71",
|
||||||
|
"72"
|
||||||
|
],
|
||||||
|
"type": "通用扩展",
|
||||||
|
"msg": "SSL!",
|
||||||
|
"shell": "openssl.sh",
|
||||||
|
"check": "openssl.so"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "mcrypt",
|
||||||
|
"versions": [
|
||||||
|
"71",
|
||||||
|
"72"
|
||||||
|
],
|
||||||
|
"type": "通用扩展",
|
||||||
|
"msg": "加密软件!",
|
||||||
|
"shell": "mcrypt.sh",
|
||||||
|
"check": "mcrypt.so"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "pcntl",
|
"name": "pcntl",
|
||||||
"versions": [
|
"versions": [
|
||||||
|
|||||||
@@ -172,24 +172,24 @@ def getLog():
|
|||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
func = sys.argv[1]
|
func = sys.argv[1]
|
||||||
if func == 'status':
|
if func == 'status':
|
||||||
print status()
|
print(status())
|
||||||
elif func == 'start':
|
elif func == 'start':
|
||||||
print start()
|
print(start())
|
||||||
elif func == 'stop':
|
elif func == 'stop':
|
||||||
print stop()
|
print(stop())
|
||||||
elif func == 'restart':
|
elif func == 'restart':
|
||||||
print restart()
|
print(restart())
|
||||||
elif func == 'reload':
|
elif func == 'reload':
|
||||||
print reload()
|
print(reload())
|
||||||
elif func == 'conf':
|
elif func == 'conf':
|
||||||
print getPathFile()
|
print(getPathFile())
|
||||||
elif func == 'initd_status':
|
elif func == 'initd_status':
|
||||||
print initdStatus()
|
print(initdStatus())
|
||||||
elif func == 'initd_install':
|
elif func == 'initd_install':
|
||||||
print initdInstall()
|
print(initdInstall())
|
||||||
elif func == 'initd_uninstall':
|
elif func == 'initd_uninstall':
|
||||||
print initdUinstall()
|
print(initdUinstall())
|
||||||
elif func == 'run_log':
|
elif func == 'run_log':
|
||||||
print getLog()
|
print(getLog())
|
||||||
else:
|
else:
|
||||||
print 'error'
|
print('error')
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import sys
|
|||||||
sys.path.append("/usr/local/lib/python2.7/site-packages")
|
sys.path.append("/usr/local/lib/python2.7/site-packages")
|
||||||
|
|
||||||
|
|
||||||
class mysql:
|
class simdht_mysql:
|
||||||
__DB_PASS = None
|
__DB_PASS = None
|
||||||
__DB_USER = 'root'
|
__DB_USER = 'root'
|
||||||
__DB_PORT = 3306
|
__DB_PORT = 3306
|
||||||
@@ -24,7 +24,7 @@ def getPluginDir():
|
|||||||
return mw.getPluginDir() + '/' + getPluginName()
|
return mw.getPluginDir() + '/' + getPluginName()
|
||||||
|
|
||||||
sys.path.append(getPluginDir() + "/class")
|
sys.path.append(getPluginDir() + "/class")
|
||||||
import mysql
|
import simdht_mysql
|
||||||
|
|
||||||
|
|
||||||
def getServerDir():
|
def getServerDir():
|
||||||
@@ -216,7 +216,7 @@ def getDbConfInfo():
|
|||||||
|
|
||||||
def pMysqlDb():
|
def pMysqlDb():
|
||||||
data = getDbConfInfo()
|
data = getDbConfInfo()
|
||||||
conn = mysql.mysql()
|
conn = simdht_mysql.simdht_mysql()
|
||||||
conn.setHost(data['DB_HOST'])
|
conn.setHost(data['DB_HOST'])
|
||||||
conn.setUser(data['DB_USER'])
|
conn.setUser(data['DB_USER'])
|
||||||
conn.setPwd(data['DB_PASS'])
|
conn.setPwd(data['DB_PASS'])
|
||||||
@@ -271,7 +271,7 @@ def getTrendData():
|
|||||||
three = getMinData(pdb, 10)
|
three = getMinData(pdb, 10)
|
||||||
return mw.getJson([one, two, three])
|
return mw.getJson([one, two, three])
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print str(e)
|
# print str(e)
|
||||||
return mw.getJson([0, 0, 0])
|
return mw.getJson([0, 0, 0])
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
indexer
|
indexer
|
||||||
{
|
{
|
||||||
mem_limit = 32M
|
mem_limit = 128M
|
||||||
}
|
}
|
||||||
|
|
||||||
searchd
|
searchd
|
||||||
@@ -39,9 +39,7 @@ source search_hash
|
|||||||
sql_range_step = 1000
|
sql_range_step = 1000
|
||||||
|
|
||||||
sql_query_pre = SET NAMES utf8
|
sql_query_pre = SET NAMES utf8
|
||||||
sql_query = \
|
sql_query = SELECT * from ( SELECT s1.id id, s1.name name, s1.category category, s1.length length, UNIX_TIMESTAMP(s1.create_time) as create_time, UNIX_TIMESTAMP(s1.last_seen) as last_seen, s2.file_list file_list, s1.info_hash info_hash FROM search_hash s1 left join search_filelist s2 on s1.info_hash=s2.info_hash where s1.is_has=1 and s1.id >= $start AND s1.id <= $end ) as s WHERE s.file_list is not null
|
||||||
SELECT id, name, CRC32(category) AS category, length, UNIX_TIMESTAMP(create_time) AS create_time, UNIX_TIMESTAMP(last_seen) AS last_seen\
|
|
||||||
FROM search_hash where id >= $start AND id <= $end AND is_has=1
|
|
||||||
|
|
||||||
sql_attr_bigint = length
|
sql_attr_bigint = length
|
||||||
sql_attr_timestamp = create_time
|
sql_attr_timestamp = create_time
|
||||||
@@ -53,7 +51,7 @@ source search_hash_delta : search_hash
|
|||||||
{
|
{
|
||||||
sql_query_range = SELECT (SELECT max_doc_id FROM `sph_counter` where counter_id=1) as min, (SELECT max(id) FROM search_hash) as max
|
sql_query_range = SELECT (SELECT max_doc_id FROM `sph_counter` where counter_id=1) as min, (SELECT max(id) FROM search_hash) as max
|
||||||
sql_query_pre = SET NAMES utf8
|
sql_query_pre = SET NAMES utf8
|
||||||
sql_query = SELECT id, name, CRC32(category) AS category, length, UNIX_TIMESTAMP(create_time) AS create_time, UNIX_TIMESTAMP(last_seen) AS last_seen FROM search_hash where id >= $start AND id <= $end AND is_has=1
|
sql_query = SELECT * from ( SELECT s1.id id, s1.name name, s1.category category, s1.length length, UNIX_TIMESTAMP(s1.create_time) as create_time, UNIX_TIMESTAMP(s1.last_seen) as last_seen, s2.file_list file_list, s1.info_hash info_hash FROM search_hash s1 left join search_filelist s2 on s1.info_hash=s2.info_hash where s1.is_has=1 and s1.id >= $start AND s1.id <= $end ) as s WHERE s.file_list is not null
|
||||||
sql_attr_bigint = length
|
sql_attr_bigint = length
|
||||||
sql_attr_timestamp = create_time
|
sql_attr_timestamp = create_time
|
||||||
sql_attr_timestamp = last_seen
|
sql_attr_timestamp = last_seen
|
||||||
|
|||||||
Executable
+21
@@ -0,0 +1,21 @@
|
|||||||
|
#! /bin/bash
|
||||||
|
#禁止弱口令登录改良版
|
||||||
|
|
||||||
|
cat /var/log/secure|awk '/Failed/{print $(NF-3)}'|sort|uniq -c|awk '{print $2"="$1;}' > black.txt #尝试登录的次数和ip
|
||||||
|
|
||||||
|
DEFINE="5" #单个ip尝试登录最大值
|
||||||
|
|
||||||
|
for i in `cat /root/black.txt`
|
||||||
|
do
|
||||||
|
|
||||||
|
IP=`echo $i |awk -F= '{print $1}'`
|
||||||
|
NUM=`echo $i|awk -F= '{print $2}'`
|
||||||
|
|
||||||
|
if [ $NUM -gt $DEFINE ]; then
|
||||||
|
grep $IP /etc/hosts.deny > /dev/null
|
||||||
|
|
||||||
|
if [ $? -gt 0 ]; then
|
||||||
|
echo "sshd:$IP" >> /etc/hosts.deny #扔到hosts文件中
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 1.1 KiB |
Executable
+19
@@ -0,0 +1,19 @@
|
|||||||
|
<div class="bt-form">
|
||||||
|
<div class="bt-w-main">
|
||||||
|
<div class="bt-w-menu">
|
||||||
|
<p class="bgw" onclick="pluginService('zimg');">服务</p>
|
||||||
|
<p onclick="pluginInitD('zimg');">自启动</p>
|
||||||
|
<p onclick="pluginConfig('zimg');">配置修改</p>
|
||||||
|
<p onclick="pluginLogs('zimg','','run_log');">运行日志</p>
|
||||||
|
<p onclick="readme();">说明</p>
|
||||||
|
</div>
|
||||||
|
<div class="bt-w-con pd15">
|
||||||
|
<div class="soft-man-con"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<script type="text/javascript">
|
||||||
|
$.getScript( "/plugins/file?name=zimg&f=js/zimg.js", function(){
|
||||||
|
pluginService('zimg');
|
||||||
|
});
|
||||||
|
</script>
|
||||||
Executable
+189
@@ -0,0 +1,189 @@
|
|||||||
|
# coding:utf-8
|
||||||
|
|
||||||
|
import sys
|
||||||
|
import io
|
||||||
|
import os
|
||||||
|
import time
|
||||||
|
import shutil
|
||||||
|
import subprocess
|
||||||
|
|
||||||
|
sys.path.append(os.getcwd() + "/class/core")
|
||||||
|
import mw
|
||||||
|
|
||||||
|
app_debug = False
|
||||||
|
if mw.isAppleSystem():
|
||||||
|
app_debug = True
|
||||||
|
|
||||||
|
|
||||||
|
def getPluginName():
|
||||||
|
return 'zimg'
|
||||||
|
|
||||||
|
|
||||||
|
def getPluginDir():
|
||||||
|
return mw.getPluginDir() + '/' + getPluginName()
|
||||||
|
|
||||||
|
|
||||||
|
def getServerDir():
|
||||||
|
return mw.getServerDir() + '/' + getPluginName()
|
||||||
|
|
||||||
|
|
||||||
|
def getInitDTpl():
|
||||||
|
path = getPluginDir() + "/init.d/zimg.tpl"
|
||||||
|
return path
|
||||||
|
|
||||||
|
|
||||||
|
def getArgs():
|
||||||
|
args = sys.argv[2:]
|
||||||
|
tmp = {}
|
||||||
|
args_len = len(args)
|
||||||
|
|
||||||
|
if args_len == 1:
|
||||||
|
t = args[0].strip('{').strip('}')
|
||||||
|
t = t.split(':')
|
||||||
|
tmp[t[0]] = t[1]
|
||||||
|
elif args_len > 1:
|
||||||
|
for i in range(len(args)):
|
||||||
|
t = args[i].split(':')
|
||||||
|
tmp[t[0]] = t[1]
|
||||||
|
|
||||||
|
return tmp
|
||||||
|
|
||||||
|
|
||||||
|
def initDreplace():
|
||||||
|
|
||||||
|
file_tpl = getInitDTpl()
|
||||||
|
service_path = os.path.dirname(os.getcwd())
|
||||||
|
|
||||||
|
initD_path = getServerDir() + '/init.d'
|
||||||
|
|
||||||
|
file_bin = initD_path + '/' + getPluginName()
|
||||||
|
if not os.path.exists(initD_path):
|
||||||
|
os.mkdir(initD_path)
|
||||||
|
|
||||||
|
# initd replace
|
||||||
|
content = mw.readFile(file_tpl)
|
||||||
|
content = content.replace('{$SERVER_PATH}', service_path)
|
||||||
|
mw.writeFile(file_bin, content)
|
||||||
|
mw.execShell('chmod +x ' + file_bin)
|
||||||
|
|
||||||
|
return file_bin
|
||||||
|
|
||||||
|
|
||||||
|
def checkArgs(data, ck=[]):
|
||||||
|
for i in range(len(ck)):
|
||||||
|
if not ck[i] in data:
|
||||||
|
return (False, mw.returnJson(False, '参数:(' + ck[i] + ')没有!'))
|
||||||
|
return (True, mw.returnJson(True, 'ok'))
|
||||||
|
|
||||||
|
|
||||||
|
def status():
|
||||||
|
cmd = "ps -ef|grep zimg |grep -v grep | grep -v 'mdserver-web'| awk '{print $2}'"
|
||||||
|
data = mw.execShell(cmd)
|
||||||
|
if data[0] == '':
|
||||||
|
return 'stop'
|
||||||
|
return 'start'
|
||||||
|
|
||||||
|
|
||||||
|
def start():
|
||||||
|
file = initDreplace()
|
||||||
|
data = mw.execShell(file + ' start')
|
||||||
|
if data[1] == '':
|
||||||
|
return 'ok'
|
||||||
|
return data[1]
|
||||||
|
|
||||||
|
|
||||||
|
def stop():
|
||||||
|
file = initDreplace()
|
||||||
|
data = mw.execShell(file + ' stop')
|
||||||
|
# print data
|
||||||
|
if data[1] == '':
|
||||||
|
return 'ok'
|
||||||
|
return data[1]
|
||||||
|
|
||||||
|
|
||||||
|
def restart():
|
||||||
|
file = initDreplace()
|
||||||
|
data = mw.execShell(file + ' reload')
|
||||||
|
if data[1] == '':
|
||||||
|
return 'ok'
|
||||||
|
return data[1]
|
||||||
|
|
||||||
|
|
||||||
|
def reload():
|
||||||
|
file = initDreplace()
|
||||||
|
data = mw.execShell(file + ' reload')
|
||||||
|
if data[1] == '':
|
||||||
|
return 'ok'
|
||||||
|
return data[1]
|
||||||
|
|
||||||
|
|
||||||
|
def getPathFile():
|
||||||
|
return getServerDir() + '/bin/conf/zimg.lua'
|
||||||
|
|
||||||
|
|
||||||
|
def getInitDFile():
|
||||||
|
if app_debug:
|
||||||
|
return '/tmp/' + getPluginName()
|
||||||
|
return '/etc/init.d/' + getPluginName()
|
||||||
|
|
||||||
|
|
||||||
|
def initdStatus():
|
||||||
|
if not app_debug:
|
||||||
|
if mw.isAppleSystem():
|
||||||
|
return "Apple Computer does not support"
|
||||||
|
initd_bin = getInitDFile()
|
||||||
|
if os.path.exists(initd_bin):
|
||||||
|
return 'ok'
|
||||||
|
return 'fail'
|
||||||
|
|
||||||
|
|
||||||
|
def initdInstall():
|
||||||
|
source_bin = initDreplace()
|
||||||
|
initd_bin = getInitDFile()
|
||||||
|
shutil.copyfile(source_bin, initd_bin)
|
||||||
|
mw.execShell('chmod +x ' + initd_bin)
|
||||||
|
|
||||||
|
if not app_debug:
|
||||||
|
mw.execShell('chkconfig --add ' + getPluginName())
|
||||||
|
return 'ok'
|
||||||
|
|
||||||
|
|
||||||
|
def initdUinstall():
|
||||||
|
if not app_debug:
|
||||||
|
mw.execShell('chkconfig --del ' + getPluginName())
|
||||||
|
|
||||||
|
initd_bin = getInitDFile()
|
||||||
|
|
||||||
|
if os.path.exists(initd_bin):
|
||||||
|
os.remove(initd_bin)
|
||||||
|
return 'ok'
|
||||||
|
|
||||||
|
|
||||||
|
def getLog():
|
||||||
|
return getServerDir() + '/bin/log/zimg.log'
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
func = sys.argv[1]
|
||||||
|
if func == 'status':
|
||||||
|
print status()
|
||||||
|
elif func == 'start':
|
||||||
|
print start()
|
||||||
|
elif func == 'stop':
|
||||||
|
print stop()
|
||||||
|
elif func == 'restart':
|
||||||
|
print restart()
|
||||||
|
elif func == 'reload':
|
||||||
|
print reload()
|
||||||
|
elif func == 'conf':
|
||||||
|
print getPathFile()
|
||||||
|
elif func == 'initd_status':
|
||||||
|
print initdStatus()
|
||||||
|
elif func == 'initd_install':
|
||||||
|
print initdInstall()
|
||||||
|
elif func == 'initd_uninstall':
|
||||||
|
print initdUinstall()
|
||||||
|
elif func == 'run_log':
|
||||||
|
print getLog()
|
||||||
|
else:
|
||||||
|
print 'error'
|
||||||
Executable
+15
@@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
"title":"zimg",
|
||||||
|
"tip":"soft",
|
||||||
|
"name":"zimg",
|
||||||
|
"type":"其他插件",
|
||||||
|
"ps":"轻量级图片服务器软件",
|
||||||
|
"versions":"1.0",
|
||||||
|
"shell":"install.sh",
|
||||||
|
"checks":"server/zimg",
|
||||||
|
"path": "server/zimg",
|
||||||
|
"author":"midoks",
|
||||||
|
"home":"https://github.com/buaazp/zimg",
|
||||||
|
"date":"2021-04-13",
|
||||||
|
"pid": "5"
|
||||||
|
}
|
||||||
Executable
+50
@@ -0,0 +1,50 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# chkconfig: 2345 55 25
|
||||||
|
# description: zimg Service
|
||||||
|
|
||||||
|
### BEGIN INIT INFO
|
||||||
|
# Provides: zimg
|
||||||
|
# Required-Start: $all
|
||||||
|
# Required-Stop: $all
|
||||||
|
# Default-Start: 2 3 4 5
|
||||||
|
# Default-Stop: 0 1 6
|
||||||
|
# Short-Description: starts zimg
|
||||||
|
# Description: starts the MDW-Web
|
||||||
|
### END INIT INFO
|
||||||
|
|
||||||
|
|
||||||
|
app_start(){
|
||||||
|
# aria2c -D
|
||||||
|
cd {$SERVER_PATH}/zimg/bin
|
||||||
|
./zimg -d {$SERVER_PATH}/zimg/bin/conf/zimg.lua </dev/null &>/dev/null
|
||||||
|
echo "zimg started"
|
||||||
|
}
|
||||||
|
app_stop(){
|
||||||
|
echo "Stopping ..."
|
||||||
|
arr=`ps -ef | grep "zimg" | grep -v 'grep' | grep -v '/bin/sh'|grep -v 'index.py' | awk '{print $2}'`
|
||||||
|
echo $arr
|
||||||
|
for p in ${arr[@]}
|
||||||
|
do
|
||||||
|
kill -9 $p &>/dev/null
|
||||||
|
done
|
||||||
|
echo "zimg stopped"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
case "$1" in
|
||||||
|
start)
|
||||||
|
app_start
|
||||||
|
;;
|
||||||
|
stop)
|
||||||
|
app_stop
|
||||||
|
;;
|
||||||
|
restart|reload)
|
||||||
|
app_stop
|
||||||
|
sleep 0.3
|
||||||
|
app_start
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "Please use start or stop as first argument"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
Executable
+73
@@ -0,0 +1,73 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
|
||||||
|
export PATH
|
||||||
|
|
||||||
|
curPath=`pwd`
|
||||||
|
rootPath=$(dirname "$curPath")
|
||||||
|
rootPath=$(dirname "$rootPath")
|
||||||
|
serverPath=$(dirname "$rootPath")
|
||||||
|
|
||||||
|
|
||||||
|
zimgSourceDir=${serverPath}/source/zimg
|
||||||
|
|
||||||
|
install_tmp=${rootPath}/tmp/mw_install.pl
|
||||||
|
|
||||||
|
SYSOS=`uname`
|
||||||
|
|
||||||
|
Install_libjpeg_turbo(){
|
||||||
|
mkdir -p $zimgSourceDir/libjpeg-turbo
|
||||||
|
cd $zimgSourceDir/libjpeg-turbo
|
||||||
|
if [ ! -d $zimgSourceDir/libjpeg-turbo ];then
|
||||||
|
wget https://downloads.sourceforge.net/project/libjpeg-turbo/1.3.1/libjpeg-turbo-1.3.1.tar.gz
|
||||||
|
tar zxvf libjpeg-turbo-1.3.1.tar.gz
|
||||||
|
cd libjpeg-turbo-1.3.1
|
||||||
|
./configure --prefix=/usr/local --with-jpeg8
|
||||||
|
make && make install
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
Install_zimg_source(){
|
||||||
|
mkdir -p $zimgSourceDir
|
||||||
|
cd $zimgSourceDir
|
||||||
|
if [ ! -d $zimgSourceDir/zimg ];then
|
||||||
|
git clone https://github.com/buaazp/zimg -b master --depth=1
|
||||||
|
cd zimg
|
||||||
|
make
|
||||||
|
fi
|
||||||
|
if [ -f $zimgSourceDir/zimg/bin/zimg ];then
|
||||||
|
cp -r $zimgSourceDir/zimg/bin $serverPath/zimg
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
Install_zimg()
|
||||||
|
{
|
||||||
|
isStart=""
|
||||||
|
echo '正在安装脚本文件...' > $install_tmp
|
||||||
|
mkdir -p $serverPath/zimg
|
||||||
|
echo '1.0' > $serverPath/zimg/version.pl
|
||||||
|
|
||||||
|
if [ "Darwin" == "$SYSOS" ];then
|
||||||
|
echo 'macosx unavailable' > $install_tmp
|
||||||
|
else
|
||||||
|
if [ ! -f $serverPath/zimg/bin ];then
|
||||||
|
yum install nasm -y
|
||||||
|
Install_libjpeg_turbo
|
||||||
|
Install_zimg_source
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo 'Install complete' > $install_tmp
|
||||||
|
}
|
||||||
|
|
||||||
|
Uninstall_zimg()
|
||||||
|
{
|
||||||
|
rm -rf $serverPath/zimg
|
||||||
|
echo "Uninstall completed" > $install_tmp
|
||||||
|
}
|
||||||
|
|
||||||
|
action=$1
|
||||||
|
if [ "${1}" == 'install' ];then
|
||||||
|
Install_zimg
|
||||||
|
else
|
||||||
|
Uninstall_zimg
|
||||||
|
fi
|
||||||
Executable
+92
@@ -0,0 +1,92 @@
|
|||||||
|
function str2Obj(str){
|
||||||
|
var data = {};
|
||||||
|
kv = str.split('&');
|
||||||
|
for(i in kv){
|
||||||
|
v = kv[i].split('=');
|
||||||
|
data[v[0]] = v[1];
|
||||||
|
}
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
function lpPost(method,args,callback, title){
|
||||||
|
|
||||||
|
var _args = null;
|
||||||
|
if (typeof(args) == 'string'){
|
||||||
|
_args = JSON.stringify(str2Obj(args));
|
||||||
|
} else {
|
||||||
|
_args = JSON.stringify(args);
|
||||||
|
}
|
||||||
|
|
||||||
|
var _title = '正在获取...';
|
||||||
|
if (typeof(title) != 'undefined'){
|
||||||
|
_title = title;
|
||||||
|
}
|
||||||
|
|
||||||
|
var loadT = layer.msg(_title, { icon: 16, time: 0, shade: 0.3 });
|
||||||
|
$.post('/plugins/run', {name:'aria2', func:method, args:_args}, function(data) {
|
||||||
|
layer.close(loadT);
|
||||||
|
if (!data.status){
|
||||||
|
layer.msg(data.msg,{icon:0,time:2000,shade: [0.3, '#000']});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(typeof(callback) == 'function'){
|
||||||
|
callback(data);
|
||||||
|
}
|
||||||
|
},'json');
|
||||||
|
}
|
||||||
|
|
||||||
|
function lpAsyncPost(method,args){
|
||||||
|
var _args = null;
|
||||||
|
if (typeof(args) == 'string'){
|
||||||
|
_args = JSON.stringify(str2Obj(args));
|
||||||
|
} else {
|
||||||
|
_args = JSON.stringify(args);
|
||||||
|
}
|
||||||
|
|
||||||
|
var loadT = layer.msg('正在获取...', { icon: 16, time: 0, shade: 0.3 });
|
||||||
|
return syncPost('/plugins/run', {name:'l2tp', func:method, args:_args});
|
||||||
|
}
|
||||||
|
|
||||||
|
function userList(){
|
||||||
|
lpPost('user_list', '' ,function(data){
|
||||||
|
var rdata = $.parseJSON(data['data']);
|
||||||
|
|
||||||
|
if (!rdata['status']){
|
||||||
|
layer.msg(rdata.msg,{icon:0,time:2000,shade: [0.3, '#000']});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var list = rdata['data'];
|
||||||
|
|
||||||
|
var con = '';
|
||||||
|
con += '<div class="divtable" style="margin-top:5px;"><table class="table table-hover" width="100%" cellspacing="0" cellpadding="0" border="0">';
|
||||||
|
con += '<thead><tr>';
|
||||||
|
con += '<th>用户</th>';
|
||||||
|
con += '<th>密码</th>';
|
||||||
|
con += '<th>操作(<a class="btlink" onclick="addUser()">添加</a>)</th>';
|
||||||
|
con += '</tr></thead>';
|
||||||
|
|
||||||
|
con += '<tbody>';
|
||||||
|
|
||||||
|
for (var i = 0; i < list.length; i++) {
|
||||||
|
con += '<tr>'+
|
||||||
|
'<td>' + list[i]['user']+'</td>' +
|
||||||
|
'<td>' + list[i]['pwd']+'</td>' +
|
||||||
|
'<td><a class="btlink" onclick="modUser(\''+list[i]['user']+'\')">改密</a>|<a class="btlink" onclick="delUser(\''+list[i]['user']+'\')">删除</a></td></tr>';
|
||||||
|
}
|
||||||
|
|
||||||
|
con += '</tbody>';
|
||||||
|
con += '</table></div>';
|
||||||
|
|
||||||
|
$(".soft-man-con").html(con);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function readme(){
|
||||||
|
var readme = '<ul class="help-info-text c7">';
|
||||||
|
readme += '<li>使用时,查看对应的端口</li>';
|
||||||
|
readme += '</ul>';
|
||||||
|
$('.soft-man-con').html(readme);
|
||||||
|
}
|
||||||
+14
-12
@@ -1,21 +1,23 @@
|
|||||||
werkzeug==0.16.1
|
werkzeug==1.0.1
|
||||||
setuptools==33.1.1
|
setuptools==33.1.1
|
||||||
wheel
|
wheel==0.33.6
|
||||||
flask==1.0.2
|
flask==1.0.2
|
||||||
flask-session==0.3.2
|
flask-session==0.3.2
|
||||||
flask-socketio
|
|
||||||
flask-helper==0.19
|
flask-helper==0.19
|
||||||
cache==1.0.3
|
cache==1.0.3
|
||||||
flask-caching==1.8.0
|
flask-caching==1.10.1
|
||||||
gunicorn==19.9
|
gunicorn==19.9
|
||||||
gevent==1.3.7
|
gevent==21.1.2
|
||||||
gevent-websocket
|
gevent-websocket
|
||||||
psutil
|
psutil==5.6.6
|
||||||
pillow
|
pillow==6.2.2
|
||||||
chardet
|
chardet==3.0.4
|
||||||
flask-sqlalchemy
|
flask-sqlalchemy==2.3.2
|
||||||
requests
|
cryptography==3.3.2
|
||||||
ConfigParser
|
requests==2.20.0
|
||||||
MySQL-python==1.2.5
|
ConfigParser==3.5.0
|
||||||
mysql-connector-python
|
mysql-connector-python
|
||||||
|
flask-socketio==3.0.1
|
||||||
|
python-engineio==3.9.0
|
||||||
|
zmq==0.0.0
|
||||||
# pytest-shutil
|
# pytest-shutil
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
werkzeug==0.16.1
|
||||||
|
setuptools==33.1.1
|
||||||
|
wheel==0.33.6
|
||||||
|
flask==1.0.2
|
||||||
|
flask-session==0.3.2
|
||||||
|
flask-helper==0.19
|
||||||
|
cache==1.0.3
|
||||||
|
flask-caching==1.8.0
|
||||||
|
gunicorn==19.9
|
||||||
|
gevent==1.3.7
|
||||||
|
gevent-websocket
|
||||||
|
psutil==5.6.6
|
||||||
|
pillow==6.2.2
|
||||||
|
chardet==3.0.4
|
||||||
|
flask-sqlalchemy==2.3.2
|
||||||
|
cryptography==3.3.2
|
||||||
|
requests==2.20.0
|
||||||
|
ConfigParser==3.5.0
|
||||||
|
MySQL-python==1.2.5
|
||||||
|
mysql-connector-python
|
||||||
|
flask-socketio==3.0.1
|
||||||
|
python-engineio==3.9.0
|
||||||
|
# pytest-shutil
|
||||||
+23
-15
@@ -7,8 +7,8 @@ import time
|
|||||||
import shutil
|
import shutil
|
||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
reload(sys)
|
# reload(sys)
|
||||||
sys.setdefaultencoding('utf-8')
|
# sys.setdefaultencoding('utf-8')
|
||||||
|
|
||||||
|
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
@@ -114,10 +114,10 @@ def publicObject(toObject, func, action=None, get=None):
|
|||||||
|
|
||||||
@app.route("/test")
|
@app.route("/test")
|
||||||
def test():
|
def test():
|
||||||
print sys.version_info
|
print(sys.version_info)
|
||||||
print session
|
print(session)
|
||||||
os = mw.getOs()
|
os = mw.getOs()
|
||||||
print os
|
print(os)
|
||||||
return mw.getLocalIp()
|
return mw.getLocalIp()
|
||||||
|
|
||||||
|
|
||||||
@@ -135,14 +135,16 @@ def code():
|
|||||||
import vilidate
|
import vilidate
|
||||||
vie = vilidate.vieCode()
|
vie = vilidate.vieCode()
|
||||||
codeImage = vie.GetCodeImage(80, 4)
|
codeImage = vie.GetCodeImage(80, 4)
|
||||||
try:
|
# try:
|
||||||
from cStringIO import StringIO
|
# from cStringIO import StringIO
|
||||||
except:
|
# except:
|
||||||
from StringIO import StringIO
|
# from StringIO import StringIO
|
||||||
|
|
||||||
out = StringIO()
|
out = io.BytesIO()
|
||||||
codeImage[0].save(out, "png")
|
codeImage[0].save(out, "png")
|
||||||
|
|
||||||
|
print(codeImage[1])
|
||||||
|
|
||||||
session['code'] = mw.md5(''.join(codeImage[1]).lower())
|
session['code'] = mw.md5(''.join(codeImage[1]).lower())
|
||||||
|
|
||||||
img = Response(out.getvalue(), headers={'Content-Type': 'image/png'})
|
img = Response(out.getvalue(), headers={'Content-Type': 'image/png'})
|
||||||
@@ -174,15 +176,21 @@ def doLogin():
|
|||||||
username = request.form.get('username', '').strip()
|
username = request.form.get('username', '').strip()
|
||||||
password = request.form.get('password', '').strip()
|
password = request.form.get('password', '').strip()
|
||||||
code = request.form.get('code', '').strip()
|
code = request.form.get('code', '').strip()
|
||||||
|
print(session)
|
||||||
if session.has_key('code'):
|
# if 'code' in session:
|
||||||
if session['code'] != mw.md5(code):
|
# if session['code'] != mw.md5(code):
|
||||||
return mw.returnJson(False, '验证码错误,请重新输入!')
|
# return mw.returnJson(False, '验证码错误,请重新输入!')
|
||||||
|
|
||||||
userInfo = mw.M('users').where(
|
userInfo = mw.M('users').where(
|
||||||
"id=?", (1,)).field('id,username,password').find()
|
"id=?", (1,)).field('id,username,password').find()
|
||||||
|
|
||||||
|
print(userInfo)
|
||||||
|
print(password)
|
||||||
|
|
||||||
password = mw.md5(password)
|
password = mw.md5(password)
|
||||||
|
|
||||||
|
print('md5-pass', password)
|
||||||
|
|
||||||
login_cache_count = 5
|
login_cache_count = 5
|
||||||
login_cache_limit = cache.get('login_cache_limit')
|
login_cache_limit = cache.get('login_cache_limit')
|
||||||
filename = 'data/close.pl'
|
filename = 'data/close.pl'
|
||||||
@@ -277,7 +285,7 @@ done
|
|||||||
'''
|
'''
|
||||||
if not mw.isAppleSystem():
|
if not mw.isAppleSystem():
|
||||||
info = mw.execShell(sh)
|
info = mw.execShell(sh)
|
||||||
print info[0], info[1]
|
print(info[0], info[1])
|
||||||
|
|
||||||
|
|
||||||
def connect_ssh():
|
def connect_ssh():
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ fi
|
|||||||
systemctl stop firewalld
|
systemctl stop firewalld
|
||||||
|
|
||||||
|
|
||||||
yum install -y libevent libevent-devel mysql-devel libjpeg* libpng* gd* zip unzip
|
yum install -y libevent libevent-devel mysql-devel libjpeg* libpng* gd* zip unzip libmcrypt libmcrypt-devel
|
||||||
|
|
||||||
if [ ! -d /www/server/mdserver-web ];then
|
if [ ! -d /www/server/mdserver-web ];then
|
||||||
wget -O /tmp/master.zip https://codeload.github.com/midoks/mdserver-web/zip/master
|
wget -O /tmp/master.zip https://codeload.github.com/midoks/mdserver-web/zip/master
|
||||||
@@ -87,15 +87,17 @@ yum -y install MySQL-python
|
|||||||
yum -y install epel-release
|
yum -y install epel-release
|
||||||
|
|
||||||
if [ ! -f '/usr/bin/pip' ];then
|
if [ ! -f '/usr/bin/pip' ];then
|
||||||
wget https://bootstrap.pypa.io/get-pip.py
|
wget https://bootstrap.pypa.io/pip/2.7/get-pip.py
|
||||||
python get-pip.py
|
python get-pip.py
|
||||||
pip install --upgrade pip
|
pip install --upgrade pip
|
||||||
|
pip install pillow==6.2.2
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
cd /www/server/mdserver-web/scripts && ./lib.sh
|
cd /www/server/mdserver-web/scripts && ./lib.sh
|
||||||
|
|
||||||
pip install -r /www/server/mdserver-web/requirements.txt
|
pip install -r /www/server/mdserver-web/requirements27.txt
|
||||||
|
pip3 install -r /www/server/mdserver-web/requirements.txt
|
||||||
|
|
||||||
|
|
||||||
cd /www/server/mdserver-web && ./cli.sh start
|
cd /www/server/mdserver-web && ./cli.sh start
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ rm -rf /tmp/master.zip
|
|||||||
rm -rf /tmp/mdserver-web-master
|
rm -rf /tmp/mdserver-web-master
|
||||||
|
|
||||||
|
|
||||||
yum install -y curl-devel
|
yum install -y curl-devel libmcrypt libmcrypt-devel
|
||||||
|
|
||||||
cd /www/server/mdserver-web/scripts && sh lib.sh
|
cd /www/server/mdserver-web/scripts && sh lib.sh
|
||||||
pip install -r /www/server/mdserver-web/requirements.txt
|
pip install -r /www/server/mdserver-web/requirements.txt
|
||||||
|
|||||||
@@ -80,8 +80,15 @@ def execShell(cmdstring, cwd=None, timeout=None, shell=True):
|
|||||||
while sub.poll() is None:
|
while sub.poll() is None:
|
||||||
time.sleep(0.1)
|
time.sleep(0.1)
|
||||||
|
|
||||||
return sub.returncode
|
data = sub.communicate()
|
||||||
except:
|
# python3 fix 返回byte数据
|
||||||
|
if isinstance(data[0], bytes):
|
||||||
|
t1 = str(data[0], encoding='utf-8')
|
||||||
|
|
||||||
|
if isinstance(data[1], bytes):
|
||||||
|
t2 = str(data[1], encoding='utf-8')
|
||||||
|
return (t1, t2)
|
||||||
|
except Exception as e:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user