diff --git a/app.py b/app.py
index b9003b39a..69104a8d2 100644
--- a/app.py
+++ b/app.py
@@ -1,9 +1,16 @@
from flask import Flask
import views
+import sys
+import web
+import io
+import os
+
+sys.path.append("class/")
app = Flask(__name__)
app.debug = True
+
DEFAULT_MODULES = (
(views.dashboard, "/"),
(views.site, "/site"),
diff --git a/data/type.json b/data/type.json
index c1337bb53..b3641edeb 100755
--- a/data/type.json
+++ b/data/type.json
@@ -13,10 +13,5 @@
"title":"系统工具",
"type":2,
"ps":""
- },
- {
- "title":"宝塔插件",
- "type":3,
- "ps":""
}
]
\ No newline at end of file
diff --git a/plugins/beta/beta_main.py b/plugins/beta/beta_main.py
new file mode 100755
index 000000000..6c1965ffe
--- /dev/null
+++ b/plugins/beta/beta_main.py
@@ -0,0 +1,34 @@
+#!/usr/bin/python
+#coding: utf-8
+#-----------------------------
+# 宝塔Linux面板内测插件
+#-----------------------------
+import sys,os
+reload(sys)
+sys.setdefaultencoding('utf-8')
+os.chdir('/www/server/panel');
+sys.path.append("class/")
+import public,db,time
+
+class beta_main:
+ __setupPath = '/www/server/panel/plugin/beta';
+ #设置内测
+ def SetConfig(self,get):
+ data = {}
+ data['username'] = get.bbs_name
+ data['qq'] = get.qq
+ data['email'] = get.email
+ result = public.httpPost('https://www.bt.cn/Api/LinuxBeta',data);
+ import json;
+ data = json.loads(result);
+ if data['status']:
+ public.writeFile(self.__setupPath + '/config.conf',get.bbs_name + '|' + get.qq + '|' + get.email);
+ return data;
+ #取内测资格状态
+ def GetConfig(self,get):
+ try:
+ cfile = self.__setupPath + '/config.conf'
+ if not os.path.exists(cfile): cfile = 'data/beta.pl'
+ return public.readFile(cfile).strip();
+ except:
+ return 'False';
diff --git a/plugins/beta/index.html b/plugins/beta/index.html
new file mode 100755
index 000000000..42cdc1c99
--- /dev/null
+++ b/plugins/beta/index.html
@@ -0,0 +1,86 @@
+
+
+
恭喜您,成为内测组的一员!
+
您的宝塔论坛认证用户为:
+
您可以用这个账号在内测专用版块反馈交流,宝塔论坛内测专用版块
+
如果您想返回正式版,则直接SSH里再执行安装代码即可
+
+
\ No newline at end of file
diff --git a/plugins/beta/info.json b/plugins/beta/info.json
new file mode 100755
index 000000000..83de6b84a
--- /dev/null
+++ b/plugins/beta/info.json
@@ -0,0 +1,15 @@
+{
+ "title":"申请内测",
+ "tip":"lib",
+ "name":"beta",
+ "type":"扩展",
+ "ps":"申请内测资格,审核完成后将会获得内测版本更新推送,并可在宝塔论坛内测专用版块参与讨论",
+ "versions":"1.2",
+ "shell":"beta.sh",
+ "checks":"/www/server/panel/plugin/beta",
+ "author":"宝塔",
+ "home":"http://www.bt.cn/bbs",
+ "date":"2017-10-16",
+ "default":false,
+ "display":0
+}
\ No newline at end of file
diff --git a/plugins/beta/install.sh b/plugins/beta/install.sh
new file mode 100755
index 000000000..e34049769
--- /dev/null
+++ b/plugins/beta/install.sh
@@ -0,0 +1,56 @@
+#!/bin/bash
+PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
+export PATH
+install_tmp='/tmp/bt_install.pl'
+CN='125.88.182.172'
+HK='download.bt.cn'
+HK2='103.224.251.67'
+US='128.1.164.196'
+sleep 0.5;
+CN_PING=`ping -c 1 -w 1 $CN|grep time=|awk '{print $7}'|sed "s/time=//"`
+HK_PING=`ping -c 1 -w 1 $HK|grep time=|awk '{print $7}'|sed "s/time=//"`
+HK2_PING=`ping -c 1 -w 1 $HK2|grep time=|awk '{print $7}'|sed "s/time=//"`
+US_PING=`ping -c 1 -w 1 $US|grep time=|awk '{print $7}'|sed "s/time=//"`
+
+echo "$HK_PING $HK" > ping.pl
+echo "$HK2_PING $HK2" >> ping.pl
+echo "$US_PING $US" >> ping.pl
+echo "$CN_PING $CN" >> ping.pl
+nodeAddr=`sort -V ping.pl|sed -n '1p'|awk '{print $2}'`
+if [ "$nodeAddr" == "" ];then
+ nodeAddr=$HK2
+fi
+
+download_Url=http://$nodeAddr:5880
+
+Install_Beta()
+{
+ mkdir -p /www/server/panel/plugin/beta
+ f1=/www/server/panel/data/beta.pl
+ if [ ! -f "$f1" ];then
+ echo 'False' > $f1
+ fi
+ f2=/www/server/panel/plugin/beta/config.conf
+ if [ ! -f "$f2" ];then
+ echo 'False' > $f2
+ fi
+ echo '正在安装脚本文件...' > $install_tmp
+ wget -O /www/server/panel/plugin/beta/beta_main.py $download_Url/install/lib/plugin/beta/beta_main.py -T 5
+ wget -O /www/server/panel/plugin/beta/index.html $download_Url/install/lib/plugin/beta/index.html -T 5
+ wget -O /www/server/panel/plugin/beta/info.json $download_Url/install/lib/plugin/beta/info.json -T 5
+ echo '安装完成' > $install_tmp
+}
+
+Uninstall_Beta()
+{
+ rm -rf /www/server/panel/plugin/beta
+ rm -f /www/server/panel/data/beta.pl
+}
+
+
+action=$1
+if [ "${1}" == 'install' ];then
+ Install_Beta
+else
+ Uninstall_Beta
+fi
diff --git a/plugins/btyw/btyw_main.py b/plugins/btyw/btyw_main.py
new file mode 100755
index 000000000..ba7dd023b
--- /dev/null
+++ b/plugins/btyw/btyw_main.py
@@ -0,0 +1,22 @@
+#!/usr/bin/python
+#coding: utf-8
+#-----------------------------
+# 宝塔Linux面板网站备份工具 - ALIOSS
+#-----------------------------
+import sys,os
+reload(sys)
+sys.setdefaultencoding('utf-8')
+os.chdir('/www/server/panel');
+sys.path.append("class/")
+import public,web
+
+class btyw_main:
+ def GetIndex(self,get):
+ try:
+ if hasattr(web.ctx.session,'btyw'): return False;
+ result = public.httpGet('https://www.bt.cn/lib/btyw.html');
+ public.writeFile('/www/server/panel/plugin/btyw/index.html',result);
+ web.ctx.session.btyw = True;
+ return True;
+ except:
+ return False;
\ No newline at end of file
diff --git a/plugins/btyw/ico-btyw.png b/plugins/btyw/ico-btyw.png
new file mode 100755
index 000000000..8f97a9c15
Binary files /dev/null and b/plugins/btyw/ico-btyw.png differ
diff --git a/plugins/btyw/ico-hot.png b/plugins/btyw/ico-hot.png
new file mode 100755
index 000000000..e3bb4749e
Binary files /dev/null and b/plugins/btyw/ico-hot.png differ
diff --git a/plugins/btyw/icon.png b/plugins/btyw/icon.png
new file mode 100755
index 000000000..8f97a9c15
Binary files /dev/null and b/plugins/btyw/icon.png differ
diff --git a/plugins/btyw/index.html b/plugins/btyw/index.html
new file mode 100755
index 000000000..679af3c62
--- /dev/null
+++ b/plugins/btyw/index.html
@@ -0,0 +1,74 @@
+
+
+
宝塔运维,一对一技术服务,承诺如解决不好,款项立即全额原路退回,请放心付费后咨询。
+
+
+
+ 服务类型 |
+ 服务范围 |
+ 服务价格 |
+ 购买服务 |
+
+
+
+
+ 企业托管运维 |
+ 定制化企业托管服务,如有需要可咨询技术 |
+ 5000元/年起 |
+ 立即前往 |
+
+
+ 宝塔面板安装 |
+ 安装好宝塔面板及指定环境,并做好服务器安全设置 |
+ 原价200元起 限时特价80元 |
+ 立即前往 |
+
+
+ 系统优化加速 |
+ 网站加速、系统优化、环境优化,让性能更上一台阶 |
+ 300元/次起 |
+ 立即前往 |
+
+
+ 数据同步服务 |
+ 部署SQL SERVER或MySQL数据库实时热备功能 |
+ 300元/次起 |
+ 立即前往 |
+
+
+ 网站挂马清理 |
+ 手工查找并清理网站的各种挂马代码 |
+ 500元/次起 |
+ 立即前往 |
+
+
+ 面板问题处理 |
+ 解决面板打不开、部分功能无法正常使用等问题 |
+ 原价200元起 限时特价80元 |
+ 立即前往 |
+
+
+
+
+
\ No newline at end of file
diff --git a/plugins/btyw/info.json b/plugins/btyw/info.json
new file mode 100755
index 000000000..70f1db2e6
--- /dev/null
+++ b/plugins/btyw/info.json
@@ -0,0 +1,18 @@
+{
+ "pid":9,
+ "title":"宝塔运维",
+ "tip":"lib",
+ "name":"btyw",
+ "type":"插件",
+ "id":2,
+ "sort":1001,
+ "ps":"宝塔付费运维服务",
+ "versions":"1.0",
+ "shell":"btyw.sh",
+ "checks":"/www/server/panel/plugin/btyw",
+ "author":"宝塔",
+ "home":"https://www.bt.cn/yunwei",
+ "date":"2017-10-18",
+ "default":false,
+ "display":0
+}
\ No newline at end of file
diff --git a/plugins/btyw/install.sh b/plugins/btyw/install.sh
new file mode 100755
index 000000000..799c8ee08
--- /dev/null
+++ b/plugins/btyw/install.sh
@@ -0,0 +1,52 @@
+#!/bin/bash
+PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
+export PATH
+install_tmp='/tmp/bt_install.pl'
+CN='125.88.182.172'
+HK='download.bt.cn'
+HK2='103.224.251.67'
+US='174.139.221.74'
+sleep 0.5;
+CN_PING=`ping -c 1 -w 1 $CN|grep time=|awk '{print $7}'|sed "s/time=//"`
+HK_PING=`ping -c 1 -w 1 $HK|grep time=|awk '{print $7}'|sed "s/time=//"`
+HK2_PING=`ping -c 1 -w 1 $HK2|grep time=|awk '{print $7}'|sed "s/time=//"`
+US_PING=`ping -c 1 -w 1 $US|grep time=|awk '{print $7}'|sed "s/time=//"`
+
+echo "$HK_PING $HK" > ping.pl
+echo "$HK2_PING $HK2" >> ping.pl
+echo "$US_PING $US" >> ping.pl
+echo "$CN_PING $CN" >> ping.pl
+nodeAddr=`sort -V ping.pl|sed -n '1p'|awk '{print $2}'`
+if [ "$nodeAddr" == "" ];then
+ nodeAddr=$HK2
+fi
+
+download_Url=http://$nodeAddr:5880
+
+Install_btyw()
+{
+ mkdir -p /www/server/panel/plugin/btyw
+ echo '正在安装脚本文件...' > $install_tmp
+ wget -O /www/server/panel/plugin/btyw/btyw_main.py $download_Url/install/lib/plugin/btyw/btyw_main.py -T 5
+ wget -O /www/server/panel/plugin/btyw/index.html $download_Url/install/lib/plugin/btyw/index.html -T 5
+ wget -O /www/server/panel/plugin/btyw/info.json $download_Url/install/lib/plugin/btyw/info.json -T 5
+ wget -O /www/server/panel/plugin/btyw/icon.png $download_Url/install/lib/plugin/btyw/icon.png -T 5
+ wget -O /www/server/panel/static/img/soft_ico/ico-btyw.png $download_Url/install/lib/plugin/btyw/icon.png -T 5
+ wget -O /www/server/panel/static/images/ico-hot.png $download_Url/install/lib/plugin/btyw/ico-hot.png -T 5
+
+ echo '安装完成' > $install_tmp
+}
+
+Uninstall_btyw()
+{
+ rm -rf /www/server/panel/plugin/btyw
+ pip uninstall btyw -y
+}
+
+
+action=$1
+if [ "${1}" == 'install' ];then
+ Install_btyw
+else
+ Uninstall_btyw
+fi
diff --git a/plugins/deployment/deployment_main.py b/plugins/deployment/deployment_main.py
new file mode 100755
index 000000000..7ee5dfd0f
--- /dev/null
+++ b/plugins/deployment/deployment_main.py
@@ -0,0 +1,350 @@
+#coding: utf-8
+# +-------------------------------------------------------------------
+# | 宝塔Linux面板 x3
+# +-------------------------------------------------------------------
+# | Copyright (c) 2015-2017 宝塔软件(http://bt.cn) All rights reserved.
+# +-------------------------------------------------------------------
+# | Author: 黄文良 <2879625666@qq.com>
+# +-------------------------------------------------------------------
+
+#+--------------------------------------------------------------------
+#| 自动部署网站
+#+--------------------------------------------------------------------
+
+import public,json,os,time;
+class obj: id=0;
+class deployment_main:
+ __setupPath = '/www/server/panel/plugin/deployment';
+ __panelPath = '/www/server/panel';
+ logPath = '/www/server/panel/plugin/deployment/speed.json'
+ timeoutCount = 0;
+ oldTime = 0;
+
+ #获取列表
+ def GetList(self,get):
+ self.GetCloudList(get);
+ jsonFile = self.__setupPath + '/list.json';
+ if not os.path.exists(jsonFile): return public.returnMsg(False,'配置文件不存在!');
+ data = {}
+ data = json.loads(public.readFile(jsonFile));
+
+ if not hasattr(get,'type'):
+ get.type = 0;
+ else:
+ get.type = int(get.type)
+ if not hasattr(get,'search'):
+ search = None
+ m = 0
+ else:
+ search = get.search.encode('utf-8').lower();
+ m = 1
+
+ tmp = [];
+ for d in data:
+ i=0;
+ if get.type > 0:
+ if get.type == d['type']: i+=1
+ else:
+ i+=1
+ if search:
+ if d['name'].lower().find(search) != -1: i+=1;
+ if d['title'].lower().find(search) != -1: i+=1;
+ if get.type > 0 and get.type != d['type']: i -= 1;
+ if i>m:tmp.append(d);
+
+ data = tmp;
+ result = {}
+ result['data'] = data;
+ jsonFile = self.__setupPath + '/type.json';
+ if not os.path.exists(jsonFile): self.GetCloudList(get);
+ result['type'] = json.loads(public.readFile(jsonFile));
+ return result;
+
+ #获取插件列表
+ def GetDepList(self,get):
+ jsonFile = self.__setupPath + '/list.json';
+ if not os.path.exists(jsonFile): return public.returnMsg(False,'配置文件不存在!');
+ data = {}
+ data = json.loads(public.readFile(jsonFile));
+ return data;
+
+
+ #从云端获取列表
+ def GetCloudList(self,get):
+ try:
+ import web
+ if not hasattr(web.ctx.session,'package'):
+ downloadUrl = public.get_url() + '/install/lib/plugin/deployment/package.json';
+ tmp = json.loads(public.httpGet(downloadUrl));
+ if not tmp: return public.returnMsg(False,'从云端获取失败!');
+ jsonFile = self.__setupPath + '/list.json';
+ public.writeFile(jsonFile,json.dumps(tmp));
+
+ downloadUrl = public.get_url() + '/install/lib/plugin/deployment/type.json';
+ tmp = json.loads(public.httpGet(downloadUrl));
+ if not tmp: return public.returnMsg(False,'从云端获取失败!');
+ jsonFile = self.__setupPath + '/type.json';
+ public.writeFile(jsonFile,json.dumps(tmp));
+
+ web.ctx.session.package = True
+ return public.returnMsg(True,'更新成功!');
+ return public.returnMsg(True,'无需更新!');
+ except:
+ return public.returnMsg(False,'从云端获取失败!');
+
+
+
+ #添加程序包
+ def AddPackage(self,get):
+ jsonFile = self.__setupPath + '/list.json';
+ if not os.path.exists(jsonFile): return public.returnMsg(False,'配置文件不存在!');
+
+ data = {}
+ data = json.loads(public.readFile(jsonFile));
+ for d in data:
+ if d['name'] == get.dname: return public.returnMsg(False,'您要添加的程序标识已存在!');
+ if d['title'] == get.title: return public.returnMsg(False,'您要添加的程序名称已存在!');
+
+ if hasattr(get,'rewrite'): get.rewrite = True;
+
+ pinfo = {}
+ pinfo['name'] = get.dname;
+ pinfo['title'] = get.title;
+ pinfo['version'] = get.version;
+ pinfo['md5'] = get.md5;
+ pinfo['rewrite'] = get.rewrite;
+ pinfo['php'] = get.php;
+ pinfo['ps'] = get.ps;
+ pinfo['shell'] = get.shell;
+ pinfo['download'] = get.download;
+ data.append(pinfo);
+ public.writeFile(jsonFile,json.dumps(data));
+ return public.returnMsg(True,'添加成功!');
+
+ #删除程序包
+ def DelPackage(self,get):
+ jsonFile = self.__setupPath + '/list.json';
+ if not os.path.exists(jsonFile): return public.returnMsg(False,'配置文件不存在!');
+
+ data = {}
+ data = json.loads(public.readFile(jsonFile));
+
+ tmp = [];
+ for d in data:
+ if d['name'].find(get.dname) != -1: continue;
+ tmp.append(d);
+
+ data = tmp;
+ public.writeFile(jsonFile,json.dumps(data));
+ return public.returnMsg(True,'删除成功!');
+
+ #下载文件
+ def DownloadFile(self,url,filename):
+ try:
+ import urllib,socket
+ socket.setdefaulttimeout(10)
+ self.pre = 0;
+ self.oldTime = time.time();
+ urllib.urlretrieve(url,filename=filename,reporthook= self.DownloadHook)
+ self.WriteLogs(json.dumps({'name':'下载文件','total':0,'used':0,'pre':0,'speed':0}));
+ except:
+ if self.timeoutCount > 5: return;
+ self.timeoutCount += 1
+ time.sleep(5)
+ self.DownloadFile(url,filename)
+
+ #下载文件进度回调
+ def DownloadHook(self,count, blockSize, totalSize):
+ used = count * blockSize
+ pre1 = int((100.0 * used / totalSize))
+ if self.pre != pre1:
+ dspeed = used / (time.time() - self.oldTime);
+ speed = {'name':'下载文件','total':totalSize,'used':used,'pre':self.pre,'speed':dspeed}
+ self.WriteLogs(json.dumps(speed))
+ self.pre = pre1
+
+ #写输出日志
+ def WriteLogs(self,logMsg):
+ fp = open(self.logPath,'w+');
+ fp.write(logMsg)
+ fp.close()
+
+ #一键安装网站程序
+ #param string name 程序名称
+ #param string site_name 网站名称
+ #param string php_version PHP版本
+ def SetupPackage(self,get):
+ name = get.dname
+ site_name = get.site_name;
+ php_version = get.php_version;
+ #取基础信息
+ find = public.M('sites').where('name=?',(site_name,)).field('id,path').find();
+ path = find['path'];
+
+ #获取包信息
+ pinfo = self.GetPackageInfo(name);
+ if not pinfo: return public.returnMsg(False,'指定软件包不存在!');
+
+ #检查本地包
+ self.WriteLogs(json.dumps({'name':'检查软件包','total':0,'used':0,'pre':0,'speed':0}));
+ packageZip = self.__setupPath + '/package/' + name + '.zip';
+ isDownload = False;
+ if os.path.exists(packageZip):
+ md5str = self.GetFileMd5(packageZip);
+ if md5str != pinfo['md5']: isDownload = True;
+ else:
+ isDownload = True;
+
+ #下载文件
+
+ if isDownload:
+ self.WriteLogs(json.dumps({'name':'下载文件','total':0,'used':0,'pre':0,'speed':0}));
+ self.DownloadFile(pinfo['download'], packageZip);
+ if not os.path.exists(packageZip): return public.returnMsg(False,'文件下载失败!');
+ os.system('unzip -o '+packageZip+' -d ' + path + '/');
+
+ #设置权限
+ self.WriteLogs(json.dumps({'name':'设置权限','total':0,'used':0,'pre':0,'speed':0}));
+ os.system('chmod -R 755 ' + path);
+ os.system('chown -R www.www ' + path);
+ if pinfo['chmod'] != "":
+ access = pinfo['chmod'].split(',')
+ for chm in access:
+ tmp = chm.split('|');
+ if len(tmp) != 2: continue;
+ os.system('chmod -R ' + tmp[0] + ' ' + path + '/' + tmp[1]);
+
+ #安装PHP扩展
+ self.WriteLogs(json.dumps({'name':'安装必要的PHP扩展','total':0,'used':0,'pre':0,'speed':0}));
+ if pinfo['ext'] != '':
+ exts = pinfo['ext'].split(',');
+ import files
+ mfile = files.files();
+ for ext in exts:
+ if ext == 'pathinfo':
+ import config
+ con = config.config();
+ get.version = php_version;
+ get.type = 'on';
+ con.setPathInfo(get);
+ else:
+ get.name = ext
+ get.version = php_version
+ get.type = '1';
+ mfile.InstallSoft(get);
+
+
+ #执行额外shell进行依赖安装
+ self.WriteLogs(json.dumps({'name':'执行额外SHELL','total':0,'used':0,'pre':0,'speed':0}));
+ if os.path.exists(path+'/install.sh'):
+ os.system('cd '+path+' && bash ' + 'install.sh');
+ os.system('rm -f ' + path+'/install.sh')
+
+ #是否执行Composer
+ if os.path.exists(path + '/composer.json'):
+ self.WriteLogs(json.dumps({'name':'执行Composer','total':0,'used':0,'pre':0,'speed':0}));
+ if not os.path.exists(path + '/composer.lock'):
+ execPHP = '/www/server/php/' + php_version +'/bin/php';
+ if execPHP:
+ if public.get_url().find('125.88'):
+ os.system('cd ' +path+' && '+execPHP+' /usr/bin/composer config repo.packagist composer https://packagist.phpcomposer.com');
+ import panelSite;
+ phpini = '/www/server/php/' + php_version + '/etc/php.ini'
+ phpiniConf = public.readFile(phpini);
+ phpiniConf = phpiniConf.replace('proc_open,proc_get_status,','');
+ public.writeFile(phpini,phpiniConf);
+ os.system('nohup cd '+path+' && '+execPHP+' /usr/bin/composer install -vvv > /tmp/composer.log 2>&1 &');
+
+ #写伪静态
+ self.WriteLogs(json.dumps({'name':'设置伪静态','total':0,'used':0,'pre':0,'speed':0}));
+ swfile = path + '/nginx.rewrite';
+ if os.path.exists(swfile):
+ rewriteConf = public.readFile(swfile);
+ dwfile = self.__panelPath + '/vhost/rewrite/' + site_name + '.conf';
+ public.writeFile(dwfile,rewriteConf);
+
+ #设置运行目录
+ self.WriteLogs(json.dumps({'name':'设置运行目录','total':0,'used':0,'pre':0,'speed':0}));
+ if pinfo['run'] != '/':
+ import panelSite;
+ siteObj = panelSite.panelSite();
+ mobj = obj();
+ mobj.id = find['id'];
+ mobj.runPath = pinfo['run'];
+ siteObj.SetSiteRunPath(mobj);
+
+ #导入数据
+ self.WriteLogs(json.dumps({'name':'导入数据库','total':0,'used':0,'pre':0,'speed':0}));
+ if os.path.exists(path+'/import.sql'):
+ databaseInfo = public.M('databases').where('pid=?',(find['id'],)).field('username,password').find();
+ if databaseInfo:
+ os.system('/www/server/mysql/bin/mysql -u' + databaseInfo['username'] + ' -p' + databaseInfo['password'] + ' ' + databaseInfo['username'] + ' < ' + path + '/import.sql');
+ os.system('rm -f ' + path + '/import.sql');
+ siteConfigFile = path + '/' + pinfo['config'];
+ if os.path.exists(siteConfigFile):
+ siteConfig = public.readFile(siteConfigFile)
+ siteConfig = siteConfig.replace('BT_DB_USERNAME',databaseInfo['username'])
+ siteConfig = siteConfig.replace('BT_DB_PASSWORD',databaseInfo['password'])
+ siteConfig = siteConfig.replace('BT_DB_NAME',databaseInfo['username'])
+ public.writeFile(siteConfigFile,siteConfig)
+
+ public.serviceReload();
+ self.depTotal(name);
+ self.WriteLogs(json.dumps({'name':'准备部署','total':0,'used':0,'pre':0,'speed':0}));
+ return public.returnMsg(True,pinfo);
+
+ #提交安装统计
+ def depTotal(self,name):
+ try:
+ import urllib2
+ urllib2.urlopen("https://www.bt.cn/Api/depTotal?name=" + name, timeout = 3)
+ return True
+ except:
+ return False;
+
+ #获取进度
+ def GetSpeed(self,get):
+ try:
+ if not os.path.exists(self.logPath): public.returnMsg(False,'当前没有部署任务!');
+ return json.loads(public.readFile(self.logPath));
+ except:
+ return {'name':'准备部署','total':0,'used':0,'pre':0,'speed':0}
+
+ #获取包信息
+ def GetPackageInfo(self,name):
+ data = self.GetDepList(None);
+ if not data: return False;
+ downUrl = public.get_url() + '/install/package';
+ for info in data:
+ if info['name'] == name:
+ info['download'] = info['download'].replace('{Download}',downUrl);
+ return info;
+ return False;
+
+ #检查指定包是否存在
+ def CheckPackageExists(self,name):
+ data = self.GetDepList(None);
+ if not data: return False;
+ for info in data:
+ if info['name'] == name: return True;
+
+ return False;
+
+ #文件的MD5值
+ def GetFileMd5(self,filename):
+ if not os.path.isfile(filename): return False;
+ import hashlib;
+ myhash = hashlib.md5()
+ f = file(filename,'rb')
+ while True:
+ b = f.read(8096)
+ if not b :
+ break
+ myhash.update(b)
+ f.close()
+ return myhash.hexdigest();
+
+ #获取站点标识
+ def GetSiteId(self,get):
+ return public.M('sites').where('name=?',(get.webname,)).getField('id');
+
\ No newline at end of file
diff --git a/plugins/deployment/ico-deployment.png b/plugins/deployment/ico-deployment.png
new file mode 100755
index 000000000..5a46186bc
Binary files /dev/null and b/plugins/deployment/ico-deployment.png differ
diff --git a/plugins/deployment/icon.png b/plugins/deployment/icon.png
new file mode 100755
index 000000000..5a46186bc
Binary files /dev/null and b/plugins/deployment/icon.png differ
diff --git a/plugins/deployment/index.html b/plugins/deployment/index.html
new file mode 100755
index 000000000..898c24e21
--- /dev/null
+++ b/plugins/deployment/index.html
@@ -0,0 +1,415 @@
+
+
+
+
+
+
+
+
+
+
+ 名称 |
+ 版本 |
+ 简介 |
+ 支持PHP版本 |
+ 操作 |
+
+
+
+
+
+
\ No newline at end of file
diff --git a/plugins/deployment/info.json b/plugins/deployment/info.json
new file mode 100755
index 000000000..b8261af1c
--- /dev/null
+++ b/plugins/deployment/info.json
@@ -0,0 +1,15 @@
+{
+ "title":"宝塔一键部署源码",
+ "tip":"lib",
+ "name":"deployment",
+ "type":"扩展",
+ "ps":"快速部署常用程序!",
+ "versions":"1.1",
+ "shell":"deployment.sh",
+ "checks":"/www/server/panel/plugin/deployment",
+ "author":"宝塔",
+ "home":"http://www.bt.cn/bbs",
+ "date":"2017-07-26",
+ "default":false,
+ "display":0
+}
\ No newline at end of file
diff --git a/plugins/deployment/install.sh b/plugins/deployment/install.sh
new file mode 100755
index 000000000..73e25f841
--- /dev/null
+++ b/plugins/deployment/install.sh
@@ -0,0 +1,52 @@
+#!/bin/bash
+PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
+export PATH
+install_tmp='/tmp/bt_install.pl'
+CN='125.88.182.172'
+HK='download.bt.cn'
+HK2='103.224.251.67'
+US='174.139.221.74'
+sleep 0.5;
+CN_PING=`ping -c 1 -w 1 $CN|grep time=|awk '{print $7}'|sed "s/time=//"`
+HK_PING=`ping -c 1 -w 1 $HK|grep time=|awk '{print $7}'|sed "s/time=//"`
+HK2_PING=`ping -c 1 -w 1 $HK2|grep time=|awk '{print $7}'|sed "s/time=//"`
+US_PING=`ping -c 1 -w 1 $US|grep time=|awk '{print $7}'|sed "s/time=//"`
+
+echo "$HK_PING $HK" > ping.pl
+echo "$HK2_PING $HK2" >> ping.pl
+echo "$US_PING $US" >> ping.pl
+echo "$CN_PING $CN" >> ping.pl
+nodeAddr=`sort -V ping.pl|sed -n '1p'|awk '{print $2}'`
+if [ "$nodeAddr" == "" ];then
+ nodeAddr=$HK2
+fi
+
+download_Url=http://$nodeAddr:5880
+
+Install_deployment()
+{
+ mkdir -p /www/server/panel/plugin/deployment
+ mkdir -p /www/server/panel/plugin/deployment/package
+ echo '正在安装脚本文件...' > $install_tmp
+ wget -O /www/server/panel/plugin/deployment/deployment_main.py $download_Url/install/lib/plugin/deployment/deployment_main.py -T 5
+ wget -O /www/server/panel/plugin/deployment/index.html $download_Url/install/lib/plugin/deployment/index.html -T 5
+ wget -O /www/server/panel/plugin/deployment/info.json $download_Url/install/lib/plugin/deployment/info.json -T 5
+ wget -O /www/server/panel/plugin/deployment/list.json $download_Url/install/lib/plugin/deployment/list.json -T 5
+ wget -O /www/server/panel/plugin/deployment/type.json $download_Url/install/lib/plugin/deployment/type.json -T 5
+ wget -O /www/server/panel/plugin/deployment/icon.png $download_Url/install/lib/plugin/deployment/icon.png -T 5
+ wget -O /www/server/panel/static/img/soft_ico/ico-deployment.png $download_Url/install/lib/plugin/deployment/icon.png -T 5
+ echo '安装完成' > $install_tmp
+}
+
+Uninstall_deployment()
+{
+ rm -rf /www/server/panel/plugin/deployment
+}
+
+
+action=$1
+if [ "${1}" == 'install' ];then
+ Install_deployment
+else
+ Uninstall_deployment
+fi
diff --git a/plugins/deployment/list.json b/plugins/deployment/list.json
new file mode 100755
index 000000000..30a0981ea
--- /dev/null
+++ b/plugins/deployment/list.json
@@ -0,0 +1,495 @@
+[
+ {
+ "name":"niucms",
+ "title":"NIUCMS",
+ "type":1,
+ "version":"3.6",
+ "md5":"f5ea5a231a7d25d66ee324d60dcdd4f1",
+ "ext":"pathinfo",
+ "chmod":"",
+ "install":"/install/index.php",
+ "php":"53,54,55,56",
+ "ps":"智慧城市生活系统(商业软件)",
+ "config":"",
+ "username":"",
+ "password":"",
+ "run":"/",
+ "download":"{Download}/niucms.zip"
+ },
+ {
+ "name":"tpt-blog",
+ "title":"Tpt-Blog",
+ "type":4,
+ "version":"1.1",
+ "md5":"aa195fece581582182e17143f53b2dfc",
+ "ext":"pathinfo",
+ "chmod":"",
+ "install":"/admin.php",
+ "php":"53,54,55,56,70,71,72",
+ "ps":"免费开源的博客程序",
+ "config":"/Application/Common/Conf/db.php",
+ "username":"admin",
+ "password":"admin
口令:123456",
+ "run":"/",
+ "download":"{Download}/tpt-blog_auto.zip"
+ },
+ {
+ "name":"phpcms",
+ "title":"PHPCMS",
+ "type":1,
+ "version":"9.6.3",
+ "md5":"4de608ae7b74175dd4513911ef7ebf78",
+ "ext":"pathinfo",
+ "chmod":"",
+ "install":"/install",
+ "php":"52,53,54,55,56,70",
+ "ps":"PHPCMS内容管理系统",
+ "config":"",
+ "username":"",
+ "password":"",
+ "run":"/",
+ "download":"{Download}/phpcms.zip"
+ },
+ {
+ "name":"ecshop_2.7",
+ "title":"EcShop-2.7",
+ "type":2,
+ "version":"2.7.3",
+ "md5":"9115294f5a458249a5f2c793eab3639c",
+ "ext":"",
+ "chmod":"",
+ "install":"/install",
+ "php":"52,53",
+ "ps":"B2C独立网店系统",
+ "config":"",
+ "username":"",
+ "password":"",
+ "run":"/",
+ "download":"{Download}/ecshop_2.7.zip"
+ },
+ {
+ "name":"ecshop_3.6",
+ "title":"EcShop-3.6",
+ "type":2,
+ "version":"3.6.0",
+ "md5":"38fdc7fe8faf67edd91ebfbb8291cbc7",
+ "ext":"",
+ "chmod":"",
+ "install":"/install",
+ "php":"53,54,55,56",
+ "ps":"B2C独立网店系统",
+ "config":"",
+ "username":"",
+ "password":"",
+ "run":"/ecshop",
+ "download":"{Download}/ecshop_3.6.zip"
+ },
+ {
+ "name":"emlog",
+ "title":"Emlog",
+ "type":4,
+ "version":"5.3.1",
+ "md5":"cecaa55d8d9644e8d8b7098c836af1ad",
+ "ext":"",
+ "chmod":"",
+ "install":"",
+ "php":"53,54,55,56",
+ "ps":"博客程序",
+ "config":"",
+ "username":"",
+ "password":"",
+ "run":"/",
+ "download":"{Download}/emlog.zip"
+ },
+ {
+ "name":"empirecms",
+ "title":"帝国CMS",
+ "type":1,
+ "version":"7.2",
+ "md5":"07bb4ffe56c939170ff080744fc13dd8",
+ "ext":"",
+ "chmod":"",
+ "install":"/e/install",
+ "php":"52,53,54,55,56",
+ "ps":"帝国内容管理系统",
+ "config":"",
+ "username":"",
+ "password":"",
+ "run":"/",
+ "download":"{Download}/empirecms.zip"
+ },
+ {
+ "name":"jieqiarticle170",
+ "title":"杰奇1.7",
+ "type":1,
+ "version":"1.7",
+ "md5":"e5168ea7b27f5c6de2a01dbf40f772b7",
+ "ext":"",
+ "chmod":"",
+ "install":"/install",
+ "php":"52",
+ "ps":"小说连载程序",
+ "config":"",
+ "username":"",
+ "password":"",
+ "run":"/",
+ "download":"{Download}/jieqiarticle170.zip"
+ },
+ {
+ "name":"codeigniter",
+ "title":"CI框架",
+ "type":6,
+ "version":"3.1.5",
+ "md5":"47a615ef55910a908aff367dc5f59a70",
+ "ext":"pathinfo",
+ "chmod":"",
+ "install":"",
+ "php":"53,54,55,56,70,71,72",
+ "ps":"知名PHP框架",
+ "config":"",
+ "username":"",
+ "password":"",
+ "run":"/public",
+ "download":"{Download}/codeIgniter.zip"
+ },
+ {
+ "name":"laravel",
+ "title":"Laravel",
+ "type":6,
+ "version":"5.4",
+ "md5":"988566e8982e835ffa6f7d9ad14b5330",
+ "ext":"pathinfo",
+ "chmod":"",
+ "install":"",
+ "php":"56,70,71,72",
+ "ps":"优雅的PHP开发框架",
+ "config":"",
+ "username":"",
+ "password":"",
+ "run":"/public",
+ "download":"{Download}/laravel.zip"
+ },
+ {
+ "name":"thinkphp_3.2",
+ "title":"ThinkPHP-3.2",
+ "type":6,
+ "version":"3.2.3",
+ "md5":"6cd0e16bf478e7df2fc62b6819eebcce",
+ "ext":"pathinfo",
+ "chmod":"",
+ "install":"",
+ "php":"53,54,55,56",
+ "ps":"国内知名PHP框架",
+ "config":"",
+ "username":"",
+ "password":"",
+ "run":"/",
+ "download":"{Download}/thinkphp-3.2.zip"
+ },
+ {
+ "name":"thinkphp_5.0",
+ "title":"ThinkPHP-5.0",
+ "type":6,
+ "version":"5.0.15",
+ "md5":"830fd878a802237a968ba36fceb1ae92",
+ "ext":"pathinfo",
+ "chmod":"",
+ "install":"",
+ "php":"54,55,56,70,71,72",
+ "ps":"国内知名PHP框架",
+ "config":"",
+ "username":"",
+ "password":"",
+ "run":"/public",
+ "download":"{Download}/thinkphp-5.0.zip"
+ },
+ {
+ "name":"dedecms",
+ "title":"织梦CMS",
+ "type":1,
+ "version":"v5.7SP2",
+ "md5":"6f64be35597dbd2c51b1954f74cfb3ad",
+ "ext":"",
+ "chmod":"",
+ "install":"/install",
+ "php":"52,53,54,55,56,70,71,72",
+ "ps":"国内知名内容管理系统",
+ "config":"",
+ "username":"",
+ "password":"",
+ "run":"/",
+ "download":"{Download}/dedecms.zip"
+ },
+ {
+ "name":"discuz_x3.4",
+ "title":"Discuz 3.4",
+ "type":3,
+ "version":"x3.4",
+ "md5":"44c4250ebdf5fa796712f336fbd2ef42",
+ "ext":"pathinfo",
+ "chmod":"",
+ "install":"/install",
+ "php":"52,53,54,55,56,70,71,72",
+ "ps":"国内知名论坛程序",
+ "config":"",
+ "username":"",
+ "password":"",
+ "run":"/",
+ "download":"{Download}/discuz_x3.4.zip"
+ },
+ {
+ "name":"discuz",
+ "title":"Discuz",
+ "type":3,
+ "version":"x3.3",
+ "md5":"b31e43927daa00c7c3d92818298943fa",
+ "ext":"pathinfo",
+ "chmod":"",
+ "install":"/install",
+ "php":"52,53,54,55,56,70,71,72",
+ "ps":"国内知名论坛程序",
+ "config":"",
+ "username":"",
+ "password":"",
+ "run":"/",
+ "download":"{Download}/discuz.zip"
+ },
+ {
+ "name":"typecho",
+ "title":"Typecho",
+ "type":4,
+ "version":"1.1",
+ "md5":"8b638551974e98994401cda253a3f836",
+ "ext":"pathinfo",
+ "chmod":"",
+ "install":"",
+ "php":"54,55,56,70,71,72",
+ "ps":"轻量级博客程序",
+ "config":"",
+ "username":"",
+ "password":"",
+ "run":"/",
+ "download":"{Download}/typecho.zip"
+ },
+ {
+ "name":"wordpress",
+ "title":"Wordpress",
+ "type":4,
+ "version":"4.9.2",
+ "md5":"6d7285257c7df3791255d8c4975804b5",
+ "ext":"pathinfo",
+ "chmod":"",
+ "install":"",
+ "php":"52,53,54,55,56,70,71,72",
+ "ps":"最多人用的博客程序",
+ "config":"",
+ "username":"",
+ "password":"",
+ "run":"/",
+ "download":"{Download}/wordpress.zip"
+ },
+ {
+ "name":"metInfo",
+ "title":"MetInfo",
+ "type":1,
+ "version":"6.0.0",
+ "md5":"fff363bc0cbb13a5c2dc8c2a652da825",
+ "ext":"",
+ "chmod":"",
+ "install":"",
+ "php":"52,53,54,55,56,70",
+ "ps":"企业建站系统推荐",
+ "config":"",
+ "username":"",
+ "password":"",
+ "run":"/",
+ "download":"{Download}/metInfo.zip"
+ },
+ {
+ "name":"chanzhi",
+ "title":"蝉知CMS",
+ "type":1,
+ "version":"6.5",
+ "md5":"793af27f2984127c34490229124644b8",
+ "ext":"pathinfo",
+ "chmod":"",
+ "install":"/admin.php",
+ "php":"53,54,55,56,70,71",
+ "ps":"开源免费的企业门户系统,CMS系统推荐",
+ "config":"/system/config/my.php",
+ "username":"admin",
+ "password":"admin",
+ "run":"/www",
+ "download":"{Download}/chanzhi_auto.zip"
+ },
+ {
+ "name":"cscms",
+ "title":"CSCMS",
+ "type":1,
+ "version":"4.1",
+ "md5":"12b66ea05ad3b829be916fe541c1dedc",
+ "ext":"",
+ "chmod":"",
+ "install":"/install.php",
+ "php":"53,54,55,56",
+ "ps":"多元化内容管理系统推荐",
+ "config":"",
+ "username":"",
+ "password":"",
+ "run":"/",
+ "download":"{Download}/cscms.zip"
+ },
+ {
+ "name":"kodexplorer",
+ "title":"可道云KodExplorer",
+ "type":1,
+ "version":"4.06",
+ "md5":"2907559eac6714394eb9f5a44e005eea",
+ "ext":"",
+ "chmod":"",
+ "install":"/index.php",
+ "php":"52,53,54,55,56,70,71,72",
+ "ps":"强大易用的私有云/在线文档管理推荐",
+ "config":"",
+ "username":"",
+ "password":"",
+ "run":"/",
+ "download":"{Download}/kodexplorer.zip"
+ },
+ {
+ "name":"tipask",
+ "title":"Tipask",
+ "type":1,
+ "version":"3.2",
+ "md5":"ae99702f944bf1c60b14065d00a3d676",
+ "ext":"fileinfo,opcache,pathinfo",
+ "chmod":"775|storage/app/,775|storage/framework/,775|storage/logs/,775|bootstrap/cache/,664|.env",
+ "install":"",
+ "php":"55,56,70,71,72",
+ "ps":"国内知名问答程序推荐",
+ "config":".env",
+ "username":"admin@tipask.com",
+ "password":"tipask",
+ "run":"/public",
+ "download":"{Download}/tipask_auto.zip"
+ },
+ {
+ "name":"maccms",
+ "title":"苹果CMS",
+ "type":1,
+ "version":"8.0",
+ "md5":"a9801d94d1c592b5bb6d2474e5c0c37e",
+ "ext":"",
+ "chmod":"",
+ "install":"",
+ "php":"52,53,54,55,56,70,71,72",
+ "ps":"PHP开源建站系统推荐",
+ "config":"",
+ "username":"",
+ "password":"",
+ "run":"/",
+ "download":"{Download}/maccms.zip"
+ },
+ {
+ "name":"seacms",
+ "title":"海洋CMS",
+ "type":1,
+ "version":"6.54",
+ "md5":"ca43469682b8e5e7cdceba020bf39375",
+ "ext":"",
+ "chmod":"",
+ "install":"/admin",
+ "php":"52,53,54,55,56.70",
+ "ps":"完全开源免费的PHP视频管理系统推荐",
+ "config":"data/common.inc.php",
+ "username":"admin",
+ "password":"admin",
+ "run":"/",
+ "download":"{Download}/seacms_auto.zip"
+ },
+ {
+ "name":"cxxcms",
+ "title":"程序侠CMS",
+ "type":1,
+ "version":"1.1.2",
+ "md5":"8ad9c0671e41eeed34f046bf2abc3f22",
+ "ext":"pathinfo",
+ "chmod":"777|runtime,777|data,777|application/extra,777|application/database.php",
+ "install":"/admin",
+ "php":"54,55,56,70,71,72",
+ "ps":"专业、安全的淘宝客CMS系统推荐",
+ "config":"application/database.php",
+ "username":"admin",
+ "password":"chengxuxia.com",
+ "run":"/",
+ "download":"{Download}/cxxcms_auto.zip"
+ },
+ {
+ "name":"z-blog",
+ "title":"Z-Blog",
+ "type":4,
+ "version":"1.5.2",
+ "md5":"07faf7fbeecfe9cad10872fe03ab3127",
+ "ext":"pathinfo",
+ "chmod":"",
+ "install":"",
+ "php":"52,53,54,55,56,70,71,72",
+ "ps":"国内知名博客程序推荐",
+ "config":"zb_users/c_option.php",
+ "username":"admin",
+ "password":"zblogger",
+ "run":"/",
+ "download":"{Download}/z-blog_auto.zip"
+ },
+ {
+ "name":"dbshop",
+ "title":"DBShop",
+ "type":2,
+ "version":"v1.2",
+ "md5":"f3c5559fa8eb04bdc9938382658f3a03",
+ "ext":"pathinfo",
+ "chmod":"",
+ "install":"/admin",
+ "php":"53,54,55,56,70,71,72",
+ "ps":"专业且良心的商城系统推荐",
+ "config":"data/Database.ini.php",
+ "username":"admin",
+ "password":"1234567",
+ "run":"/",
+ "download":"{Download}/dbshop_auto.zip"
+ },
+ {
+ "name":"niushop",
+ "title":"NiuShop",
+ "type":2,
+ "version":"1.1.9",
+ "md5":"637c6ad54fa4732df35857304e5eeb82",
+ "ext":"pathinfo",
+ "chmod":"",
+ "install":"",
+ "php":"54,55,56,70",
+ "ps":"优秀的TP5.0开源商城系统推荐",
+ "config":"application/database.php",
+ "username":"admin",
+ "password":"123456",
+ "run":"/",
+ "download":"{Download}/niushop_auto.zip"
+ },
+ {
+ "name":"weengine",
+ "title":"微擎",
+ "type":5,
+ "version":"1.0",
+ "md5":"8424881fe0e60042df5064ca4638f56c",
+ "ext":"fileinfo,pathinfo,ioncube",
+ "chmod":"755|addons,755|api,755|app,755|data,755|attachment,755|framework,755|payment,755|web",
+ "install":"/index.php",
+ "php":"53,54,55,56,70,71,72",
+ "ps":"微信第三方管理引擎推荐",
+ "config":"data/config.php",
+ "username":"admin",
+ "password":"we7.cc",
+ "run":"/",
+ "download":"{Download}/weengine_auto.zip"
+ }
+]
diff --git a/plugins/deployment/package.json b/plugins/deployment/package.json
new file mode 100755
index 000000000..e119229d6
--- /dev/null
+++ b/plugins/deployment/package.json
@@ -0,0 +1,495 @@
+[
+ {
+ "name":"niucms",
+ "title":"NIUCMS",
+ "type":1,
+ "version":"3.6",
+ "md5":"f5ea5a231a7d25d66ee324d60dcdd4f1",
+ "ext":"pathinfo",
+ "chmod":"",
+ "install":"/install/index.php",
+ "php":"53,54,55,56",
+ "ps":"智慧城市生活系统(商业软件)",
+ "config":"",
+ "username":"",
+ "password":"",
+ "run":"/",
+ "download":"{Download}/niucms.zip"
+ },
+ {
+ "name":"tpt-blog",
+ "title":"Tpt-Blog",
+ "type":4,
+ "version":"1.1",
+ "md5":"aa195fece581582182e17143f53b2dfc",
+ "ext":"pathinfo",
+ "chmod":"",
+ "install":"/admin.php",
+ "php":"53,54,55,56,70,71,72",
+ "ps":"免费开源的博客程序",
+ "config":"/Application/Common/Conf/db.php",
+ "username":"admin",
+ "password":"admin
口令:123456",
+ "run":"/",
+ "download":"{Download}/tpt-blog_auto.zip"
+ },
+ {
+ "name":"phpcms",
+ "title":"PHPCMS",
+ "type":1,
+ "version":"9.6.3",
+ "md5":"4de608ae7b74175dd4513911ef7ebf78",
+ "ext":"pathinfo",
+ "chmod":"",
+ "install":"/install",
+ "php":"52,53,54,55,56,70",
+ "ps":"PHPCMS内容管理系统",
+ "config":"",
+ "username":"",
+ "password":"",
+ "run":"/",
+ "download":"{Download}/phpcms.zip"
+ },
+ {
+ "name":"ecshop_2.7",
+ "title":"EcShop-2.7",
+ "type":2,
+ "version":"2.7.3",
+ "md5":"9115294f5a458249a5f2c793eab3639c",
+ "ext":"",
+ "chmod":"",
+ "install":"/install",
+ "php":"52,53",
+ "ps":"B2C独立网店系统",
+ "config":"",
+ "username":"",
+ "password":"",
+ "run":"/",
+ "download":"{Download}/ecshop_2.7.zip"
+ },
+ {
+ "name":"ecshop_3.6",
+ "title":"EcShop-3.6",
+ "type":2,
+ "version":"3.6.0",
+ "md5":"38fdc7fe8faf67edd91ebfbb8291cbc7",
+ "ext":"",
+ "chmod":"",
+ "install":"/install",
+ "php":"53,54,55,56",
+ "ps":"B2C独立网店系统",
+ "config":"",
+ "username":"",
+ "password":"",
+ "run":"/ecshop",
+ "download":"{Download}/ecshop_3.6.zip"
+ },
+ {
+ "name":"emlog",
+ "title":"Emlog",
+ "type":4,
+ "version":"5.3.1",
+ "md5":"cecaa55d8d9644e8d8b7098c836af1ad",
+ "ext":"",
+ "chmod":"",
+ "install":"",
+ "php":"53,54,55,56",
+ "ps":"博客程序",
+ "config":"",
+ "username":"",
+ "password":"",
+ "run":"/",
+ "download":"{Download}/emlog.zip"
+ },
+ {
+ "name":"empirecms",
+ "title":"帝国CMS",
+ "type":1,
+ "version":"7.2",
+ "md5":"07bb4ffe56c939170ff080744fc13dd8",
+ "ext":"",
+ "chmod":"",
+ "install":"/e/install",
+ "php":"52,53,54,55,56",
+ "ps":"帝国内容管理系统",
+ "config":"",
+ "username":"",
+ "password":"",
+ "run":"/",
+ "download":"{Download}/empirecms.zip"
+ },
+ {
+ "name":"jieqiarticle170",
+ "title":"杰奇1.7",
+ "type":1,
+ "version":"1.7",
+ "md5":"e5168ea7b27f5c6de2a01dbf40f772b7",
+ "ext":"",
+ "chmod":"",
+ "install":"/install",
+ "php":"52",
+ "ps":"小说连载程序",
+ "config":"",
+ "username":"",
+ "password":"",
+ "run":"/",
+ "download":"{Download}/jieqiarticle170.zip"
+ },
+ {
+ "name":"codeigniter",
+ "title":"CI框架",
+ "type":6,
+ "version":"3.1.5",
+ "md5":"47a615ef55910a908aff367dc5f59a70",
+ "ext":"pathinfo",
+ "chmod":"",
+ "install":"",
+ "php":"53,54,55,56,70,71,72",
+ "ps":"知名PHP框架",
+ "config":"",
+ "username":"",
+ "password":"",
+ "run":"/public",
+ "download":"{Download}/codeIgniter.zip"
+ },
+ {
+ "name":"laravel",
+ "title":"Laravel",
+ "type":6,
+ "version":"5.4",
+ "md5":"988566e8982e835ffa6f7d9ad14b5330",
+ "ext":"pathinfo",
+ "chmod":"",
+ "install":"",
+ "php":"56,70,71,72",
+ "ps":"优雅的PHP开发框架",
+ "config":"",
+ "username":"",
+ "password":"",
+ "run":"/public",
+ "download":"{Download}/laravel.zip"
+ },
+ {
+ "name":"thinkphp_3.2",
+ "title":"ThinkPHP-3.2",
+ "type":6,
+ "version":"3.2.3",
+ "md5":"6cd0e16bf478e7df2fc62b6819eebcce",
+ "ext":"pathinfo",
+ "chmod":"",
+ "install":"",
+ "php":"53,54,55,56",
+ "ps":"国内知名PHP框架",
+ "config":"",
+ "username":"",
+ "password":"",
+ "run":"/",
+ "download":"{Download}/thinkphp-3.2.zip"
+ },
+ {
+ "name":"thinkphp_5.0",
+ "title":"ThinkPHP-5.0",
+ "type":6,
+ "version":"5.0.15",
+ "md5":"830fd878a802237a968ba36fceb1ae92",
+ "ext":"pathinfo",
+ "chmod":"",
+ "install":"",
+ "php":"54,55,56,70,71,72",
+ "ps":"国内知名PHP框架",
+ "config":"",
+ "username":"",
+ "password":"",
+ "run":"/public",
+ "download":"{Download}/thinkphp-5.0.zip"
+ },
+ {
+ "name":"dedecms",
+ "title":"织梦CMS",
+ "type":1,
+ "version":"v5.7SP2",
+ "md5":"6f64be35597dbd2c51b1954f74cfb3ad",
+ "ext":"",
+ "chmod":"",
+ "install":"/install",
+ "php":"52,53,54,55,56,70,71,72",
+ "ps":"国内知名内容管理系统",
+ "config":"",
+ "username":"",
+ "password":"",
+ "run":"/",
+ "download":"{Download}/dedecms.zip"
+ },
+ {
+ "name":"discuz_x3.4",
+ "title":"Discuz 3.4",
+ "type":3,
+ "version":"x3.4",
+ "md5":"44c4250ebdf5fa796712f336fbd2ef42",
+ "ext":"pathinfo",
+ "chmod":"",
+ "install":"/install",
+ "php":"52,53,54,55,56,70,71,72",
+ "ps":"国内知名论坛程序",
+ "config":"",
+ "username":"",
+ "password":"",
+ "run":"/",
+ "download":"{Download}/discuz_x3.4.zip"
+ },
+ {
+ "name":"discuz",
+ "title":"Discuz",
+ "type":3,
+ "version":"x3.3",
+ "md5":"b31e43927daa00c7c3d92818298943fa",
+ "ext":"pathinfo",
+ "chmod":"",
+ "install":"/install",
+ "php":"52,53,54,55,56,70,71,72",
+ "ps":"国内知名论坛程序",
+ "config":"",
+ "username":"",
+ "password":"",
+ "run":"/",
+ "download":"{Download}/discuz.zip"
+ },
+ {
+ "name":"typecho",
+ "title":"Typecho",
+ "type":4,
+ "version":"1.1",
+ "md5":"8b638551974e98994401cda253a3f836",
+ "ext":"pathinfo",
+ "chmod":"",
+ "install":"",
+ "php":"54,55,56,70,71,72",
+ "ps":"轻量级博客程序",
+ "config":"",
+ "username":"",
+ "password":"",
+ "run":"/",
+ "download":"{Download}/typecho.zip"
+ },
+ {
+ "name":"wordpress",
+ "title":"Wordpress",
+ "type":4,
+ "version":"4.9.2",
+ "md5":"6d7285257c7df3791255d8c4975804b5",
+ "ext":"pathinfo",
+ "chmod":"",
+ "install":"",
+ "php":"52,53,54,55,56,70,71,72",
+ "ps":"最多人用的博客程序",
+ "config":"",
+ "username":"",
+ "password":"",
+ "run":"/",
+ "download":"{Download}/wordpress.zip"
+ },
+ {
+ "name":"metInfo",
+ "title":"MetInfo",
+ "type":1,
+ "version":"6.0.0",
+ "md5":"fff363bc0cbb13a5c2dc8c2a652da825",
+ "ext":"",
+ "chmod":"",
+ "install":"",
+ "php":"52,53,54,55,56,70",
+ "ps":"企业建站系统推荐",
+ "config":"",
+ "username":"",
+ "password":"",
+ "run":"/",
+ "download":"{Download}/metInfo.zip"
+ },
+ {
+ "name":"chanzhi",
+ "title":"蝉知CMS",
+ "type":1,
+ "version":"6.5",
+ "md5":"793af27f2984127c34490229124644b8",
+ "ext":"pathinfo",
+ "chmod":"",
+ "install":"/admin.php",
+ "php":"53,54,55,56,70,71",
+ "ps":"开源免费的企业门户系统,CMS系统推荐",
+ "config":"/system/config/my.php",
+ "username":"admin",
+ "password":"admin",
+ "run":"/www",
+ "download":"{Download}/chanzhi_auto.zip"
+ },
+ {
+ "name":"cscms",
+ "title":"CSCMS",
+ "type":1,
+ "version":"4.1",
+ "md5":"12b66ea05ad3b829be916fe541c1dedc",
+ "ext":"",
+ "chmod":"",
+ "install":"/install.php",
+ "php":"53,54,55,56",
+ "ps":"多元化内容管理系统推荐",
+ "config":"",
+ "username":"",
+ "password":"",
+ "run":"/",
+ "download":"{Download}/cscms.zip"
+ },
+ {
+ "name":"kodexplorer",
+ "title":"可道云KodExplorer",
+ "type":1,
+ "version":"4.06",
+ "md5":"2907559eac6714394eb9f5a44e005eea",
+ "ext":"",
+ "chmod":"",
+ "install":"/index.php",
+ "php":"52,53,54,55,56,70,71,72",
+ "ps":"强大易用的私有云/在线文档管理推荐",
+ "config":"",
+ "username":"",
+ "password":"",
+ "run":"/",
+ "download":"{Download}/kodexplorer.zip"
+ },
+ {
+ "name":"tipask",
+ "title":"Tipask",
+ "type":1,
+ "version":"3.2",
+ "md5":"ae99702f944bf1c60b14065d00a3d676",
+ "ext":"fileinfo,opcache,pathinfo",
+ "chmod":"775|storage/app/,775|storage/framework/,775|storage/logs/,775|bootstrap/cache/,664|.env",
+ "install":"",
+ "php":"55,56,70,71,72",
+ "ps":"国内知名问答程序推荐",
+ "config":".env",
+ "username":"admin@tipask.com",
+ "password":"tipask",
+ "run":"/public",
+ "download":"{Download}/tipask_auto.zip"
+ },
+ {
+ "name":"maccms",
+ "title":"苹果CMS",
+ "type":1,
+ "version":"8.0",
+ "md5":"a9801d94d1c592b5bb6d2474e5c0c37e",
+ "ext":"",
+ "chmod":"",
+ "install":"",
+ "php":"52,53,54,55,56,70,71,72",
+ "ps":"PHP开源建站系统推荐",
+ "config":"",
+ "username":"",
+ "password":"",
+ "run":"/",
+ "download":"{Download}/maccms.zip"
+ },
+ {
+ "name":"seacms",
+ "title":"海洋CMS",
+ "type":1,
+ "version":"6.54",
+ "md5":"ca43469682b8e5e7cdceba020bf39375",
+ "ext":"",
+ "chmod":"",
+ "install":"/admin",
+ "php":"52,53,54,55,56.70",
+ "ps":"完全开源免费的PHP视频管理系统推荐",
+ "config":"data/common.inc.php",
+ "username":"admin",
+ "password":"admin",
+ "run":"/",
+ "download":"{Download}/seacms_auto.zip"
+ },
+ {
+ "name":"cxxcms",
+ "title":"程序侠CMS",
+ "type":1,
+ "version":"1.1.2",
+ "md5":"8ad9c0671e41eeed34f046bf2abc3f22",
+ "ext":"pathinfo",
+ "chmod":"777|runtime,777|data,777|application/extra,777|application/database.php",
+ "install":"/admin",
+ "php":"54,55,56,70,71,72",
+ "ps":"专业、安全的淘宝客CMS系统推荐",
+ "config":"application/database.php",
+ "username":"admin",
+ "password":"chengxuxia.com",
+ "run":"/",
+ "download":"{Download}/cxxcms_auto.zip"
+ },
+ {
+ "name":"z-blog",
+ "title":"Z-Blog",
+ "type":4,
+ "version":"1.5.2",
+ "md5":"07faf7fbeecfe9cad10872fe03ab3127",
+ "ext":"pathinfo",
+ "chmod":"",
+ "install":"",
+ "php":"52,53,54,55,56,70,71,72",
+ "ps":"国内知名博客程序推荐",
+ "config":"zb_users/c_option.php",
+ "username":"admin",
+ "password":"zblogger",
+ "run":"/",
+ "download":"{Download}/z-blog_auto.zip"
+ },
+ {
+ "name":"dbshop",
+ "title":"DBShop",
+ "type":2,
+ "version":"v1.2",
+ "md5":"f3c5559fa8eb04bdc9938382658f3a03",
+ "ext":"pathinfo",
+ "chmod":"",
+ "install":"/admin",
+ "php":"53,54,55,56,70,71,72",
+ "ps":"专业且良心的商城系统推荐",
+ "config":"data/Database.ini.php",
+ "username":"admin",
+ "password":"1234567",
+ "run":"/",
+ "download":"{Download}/dbshop_auto.zip"
+ },
+ {
+ "name":"niushop",
+ "title":"NiuShop",
+ "type":2,
+ "version":"1.1.9",
+ "md5":"637c6ad54fa4732df35857304e5eeb82",
+ "ext":"pathinfo",
+ "chmod":"",
+ "install":"",
+ "php":"54,55,56,70",
+ "ps":"优秀的TP5.0开源商城系统推荐",
+ "config":"application/database.php",
+ "username":"admin",
+ "password":"123456",
+ "run":"/",
+ "download":"{Download}/niushop_auto.zip"
+ },
+ {
+ "name":"weengine",
+ "title":"微擎",
+ "type":5,
+ "version":"1.0",
+ "md5":"8424881fe0e60042df5064ca4638f56c",
+ "ext":"fileinfo,pathinfo,ioncube",
+ "chmod":"755|addons,755|api,755|app,755|data,755|attachment,755|framework,755|payment,755|web",
+ "install":"/index.php",
+ "php":"53,54,55,56,70,71,72",
+ "ps":"微信第三方管理引擎推荐",
+ "config":"data/config.php",
+ "username":"admin",
+ "password":"we7.cc",
+ "run":"/",
+ "download":"{Download}/weengine_auto.zip"
+ }
+]
diff --git a/plugins/deployment/type.json b/plugins/deployment/type.json
new file mode 100755
index 000000000..66b1cf201
--- /dev/null
+++ b/plugins/deployment/type.json
@@ -0,0 +1,37 @@
+[
+ {
+ "title":"推荐",
+ "type":0,
+ "ps":""
+ },
+ {
+ "title":"建站",
+ "type":1,
+ "ps":""
+ },
+ {
+ "title":"商城",
+ "type":2,
+ "ps":""
+ },
+ {
+ "title":"论坛",
+ "type":3,
+ "ps":""
+ },
+ {
+ "title":"博客",
+ "type":4,
+ "ps":""
+ },
+ {
+ "title":"微信",
+ "type":5,
+ "ps":""
+ },
+ {
+ "title":"框架",
+ "type":6,
+ "ps":""
+ }
+]
\ No newline at end of file
diff --git a/plugins/index.html b/plugins/index.html
deleted file mode 100644
index b2d525b29..000000000
--- a/plugins/index.html
+++ /dev/null
@@ -1 +0,0 @@
-index
\ No newline at end of file
diff --git a/plugins/phpguard/info.json b/plugins/phpguard/info.json
new file mode 100755
index 000000000..d65321ce3
--- /dev/null
+++ b/plugins/phpguard/info.json
@@ -0,0 +1,15 @@
+{
+ "title":"PHP守护",
+ "tip":"lib",
+ "name":"phpguard",
+ "type":"扩展",
+ "ps":"监控PHP-FPM运行状态,防止大批量出现502错误!",
+ "versions":"1.2",
+ "shell":"phpguard.sh",
+ "checks":"/www/server/panel/plugin/phpguard",
+ "author":"宝塔",
+ "home":"http://www.bt.cn/bbs",
+ "date":"2017-10-16",
+ "default":false,
+ "display":0
+}
\ No newline at end of file
diff --git a/plugins/phpguard/install.sh b/plugins/phpguard/install.sh
new file mode 100755
index 000000000..7a5308221
--- /dev/null
+++ b/plugins/phpguard/install.sh
@@ -0,0 +1,26 @@
+#!/bin/bash
+PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
+export PATH
+install_tmp='/tmp/bt_install.pl'
+download_Url=http://download.bt.cn
+
+Install_phpguard()
+{
+ mkdir -p /www/server/panel/plugin/phpguard
+ wget -O /www/server/panel/plugin/phpguard/info.json $download_Url/install/lib/plugin/phpguard/info.json -T 5
+ echo 'True' > /www/server/panel/data/502Task.pl
+}
+
+Uninstall_phpguard()
+{
+ rm -rf /www/server/panel/plugin/phpguard
+ rm -f /www/server/panel/data/502Task.pl
+}
+
+
+action=$1
+if [ "${1}" == 'install' ];then
+ Install_phpguard
+else
+ Uninstall_phpguard
+fi
diff --git a/plugins/safelogin/icon.png b/plugins/safelogin/icon.png
new file mode 100755
index 000000000..379c72b0a
Binary files /dev/null and b/plugins/safelogin/icon.png differ
diff --git a/plugins/safelogin/index.html b/plugins/safelogin/index.html
new file mode 100755
index 000000000..cf0b57f1b
--- /dev/null
+++ b/plugins/safelogin/index.html
@@ -0,0 +1,550 @@
+
+
+
+
+
+ 未开通此服务,如需使用请开通企业运维版。
+
+
+
1、一对一运维人员对接
+
2、提供每月3次运维服务
+
3、双重安全隔离登录
+
+
+ 企业运维版98元/月
+
+
+
+
+
+
\ No newline at end of file
diff --git a/plugins/safelogin/info.json b/plugins/safelogin/info.json
new file mode 100755
index 000000000..bb881a2eb
--- /dev/null
+++ b/plugins/safelogin/info.json
@@ -0,0 +1,15 @@
+{
+ "title":"宝塔安全登录",
+ "tip":"lib",
+ "name":"safelogin",
+ "type":"扩展",
+ "ps":"宝塔企业版安全登陆插件!",
+ "versions":"1.3",
+ "shell":"safelogin.sh",
+ "checks":"/www/server/panel/plugin/safelogin",
+ "author":"宝塔",
+ "home":"http://www.bt.cn/bbs",
+ "date":"2017-11-24",
+ "default":false,
+ "display":0
+}
\ No newline at end of file
diff --git a/plugins/safelogin/install.sh b/plugins/safelogin/install.sh
new file mode 100755
index 000000000..6965e237a
--- /dev/null
+++ b/plugins/safelogin/install.sh
@@ -0,0 +1,40 @@
+#!/bin/bash
+PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
+export PATH
+install_tmp='/tmp/bt_install.pl'
+public_file=/www/server/panel/install/public.sh
+if [ ! -f $public_file ];then
+ wget -O $public_file http://download.bt.cn/install/public.sh -T 5;
+fi
+. $public_file
+
+download_Url=$NODE_URL
+
+Install_safelogin()
+{
+ mkdir -p /www/server/panel/plugin/safelogin
+ echo '正在安装脚本文件...' > $install_tmp
+ wget -O /www/server/panel/plugin/safelogin/safelogin_main.py $download_Url/install/lib/plugin/safelogin/safelogin_main.py -T 5
+ wget -O /www/server/panel/plugin/safelogin/index.html $download_Url/install/lib/plugin/safelogin/index.html -T 5
+ wget -O /www/server/panel/plugin/safelogin/info.json $download_Url/install/lib/plugin/safelogin/info.json -T 5
+ wget -O /www/server/panel/plugin/safelogin/icon.png $download_Url/install/lib/plugin/safelogin/icon.png -T 5
+ echo '安装完成' > $install_tmp
+
+}
+
+Uninstall_safelogin()
+{
+ chattr -i /www/server/panel/plugin/safelogin/token.pl
+ rm -f /www/server/panel/data/limitip.conf
+ sed -i "/ALL/d" /etc/hosts.deny
+ rm -rf /www/server/panel/plugin/safelogin
+}
+
+
+action=$1
+host=$2;
+if [ "${1}" == 'install' ];then
+ Install_safelogin
+else
+ Uninstall_safelogin
+fi
diff --git a/plugins/safelogin/safelogin_main.py b/plugins/safelogin/safelogin_main.py
new file mode 100755
index 000000000..6c92f4533
--- /dev/null
+++ b/plugins/safelogin/safelogin_main.py
@@ -0,0 +1,276 @@
+#coding: utf-8
+# +-------------------------------------------------------------------
+# | 宝塔Linux面板 x3
+# +-------------------------------------------------------------------
+# | Copyright (c) 2015-2017 宝塔软件(http://bt.cn) All rights reserved.
+# +-------------------------------------------------------------------
+# | Author: 黄文良 <287962566@qq.com>
+# +-------------------------------------------------------------------
+
+#+--------------------------------------------------------------------
+#| 宝塔安全登陆插件
+#+--------------------------------------------------------------------
+import sys;
+sys.path.append('class/');
+reload(sys);
+import public,json,os,time,binascii,urllib,re,web;
+class safelogin_main:
+ __PANEL_SSL = None;
+ __PDATA = None;
+ __APIURL = 'http://www.bt.cn/api/Auth';
+ __UPATH = 'data/userInfo.json';
+ __DENY = '/etc/hosts.deny';
+ __ALLOW = '/etc/hosts.allow';
+ __LIMIT_CONF = 'data/limitip.conf';
+ __userInfo = None;
+ def __init__(self):
+ pdata = {}
+ data = {}
+ if os.path.exists(self.__UPATH):
+ self.__userInfo = json.loads(public.readFile(self.__UPATH));
+ if self.__userInfo:
+ pdata['access_key'] = self.__userInfo['access_key'];
+ data['secret_key'] = self.__userInfo['secret_key'];
+ else:
+ pdata['access_key'] = 'test';
+ data['secret_key'] = '123456';
+ pdata['data'] = data;
+ self.__PDATA = pdata;
+
+ #生成并发送Token
+ def SendToken(self,get = None):
+ return False;
+
+ #获取服务器密钥
+ def GetServerToken(self,get):
+ password = public.M('users').where('id=?',(1,)).getField('password');
+ if password != public.md5(get.password): return public.returnMsg(False,'密码验证失败!');
+ tokenFile = '/www/server/panel/plugin/safelogin/token.pl';
+ if not os.path.exists(tokenFile):
+ tokenStr = public.GetRandomString(64);
+ public.writeFile(tokenFile,tokenStr);
+ else:
+ tokenStr = public.readFile(tokenFile);
+ public.ExecShell('chattr +i ' + tokenFile);
+ return tokenStr.strip();
+
+ #获取服务器信息
+ def GetServerInfo(self,get):
+ #self.SendToken();
+ self.__init__();
+ self.__PDATA['data'] = self.De_Code(self.__PDATA['data']);
+ result = json.loads(public.httpPost(self.__APIURL + '/GetServerInfo',self.__PDATA));
+ result['data'] = self.En_Code(result['data']);
+ return result;
+
+ #获取Token
+ def GetToken(self,get):
+ data = {}
+ data['username'] = get.username;
+ data['password'] = public.md5(get.password);
+ pdata = {}
+ pdata['data'] = self.De_Code(data);
+ result = json.loads(public.httpPost(self.__APIURL+'/GetToken',pdata));
+ result['data'] = self.En_Code(result['data']);
+ if result['data']: public.writeFile(self.__UPATH,json.dumps(result['data']));
+ del(result['data']);
+ return result;
+
+ #获取节点列表
+ def get_node_list(self,get):
+ self.__PDATA['data'] = self.De_Code(self.__PDATA['data']);
+ result = json.loads(public.httpPost(self.__APIURL + '/GetNodeList',self.__PDATA));
+ result['data'] = self.En_Code(result['data']);
+ return result;
+
+ #添加SSH许可IP
+ def add_ssh_limit(self,get):
+ ip = get.ip;
+ denyConf = public.readFile(self.__DENY);
+ if denyConf.find('sshd:ALL') == -1:
+ while denyConf[-1:] == "\n" or denyConf[-1:] == " ": denyConf = denyConf[:-1];
+ denyConf += "\nsshd:ALL\n";
+ public.writeFile(self.__DENY,denyConf);
+ if ip in self.get_ssh_limit(): return public.returnMsg(True,'指定IP白名单已存在!');
+
+ allowConf = public.readFile(self.__ALLOW).strip();
+ while allowConf[-1:] == "\n" or allowConf[-1:] == " ": allowConf = allowConf[:-1];
+ allowConf += "\nsshd:" + ip+":allow\n";
+ public.writeFile(self.__ALLOW,allowConf);
+
+ if ip in self.get_ssh_limit(): return public.returnMsg(True,'添加成功!');
+ return public.returnMsg(False,'添加失败!');
+
+ #删除SSH许可IP
+ def remove_ssh_limit(self,get):
+ ip = get.ip;
+ if not ip in self.get_ssh_limit(): return public.returnMsg(True,'指定白名单不存在!');
+ allowConf = public.readFile(self.__ALLOW).strip();
+ while allowConf[-1:] == "\n" or allowConf[-1:] == " ": allowConf = allowConf[:-1];
+ allowConf = re.sub("\nsshd:"+ip+":allow\n?","\n",allowConf);
+ public.writeFile(self.__ALLOW,allowConf+"\n");
+ return public.returnMsg(True,'删除成功!');
+
+ #获取当前SSH许可IP
+ def get_ssh_limit(self,get = None):
+ allowConf = public.readFile(self.__ALLOW);
+ return re.findall("sshd:(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}):allow",allowConf);
+
+ #获取登陆记录
+ def get_login_log(self,get):
+ return public.M('logs').where('type=?',(u'用户登录',)).field('log,addtime').select();
+
+ #取当前面板登陆许可
+ def get_panel_limit(self,get = None):
+ conf = public.readFile(self.__LIMIT_CONF)
+ if not conf: conf = '';
+ limitIp = conf.split(',');
+ if '' in limitIp: limitIp.remove('');
+ return limitIp;
+
+ #添加面板许可登陆IP
+ def add_panel_limit(self,get):
+ limitIp = self.get_panel_limit();
+ if get.ip in limitIp: return public.returnMsg(True,'指定IP白名单已存在!');
+ limitIp.append(get.ip);
+ public.writeFile(self.__LIMIT_CONF,','.join(limitIp));
+ return public.returnMsg(True,'添加成功!');
+
+ #删除面板许可登陆IP
+ def remove_panel_limit(self,get):
+ limitIp = self.get_panel_limit();
+ if not get.ip in limitIp: return public.returnMsg(True,'指定IP白名单不存在!');
+ limitIp.remove(get.ip);
+ public.writeFile(self.__LIMIT_CONF,','.join(limitIp));
+ return public.returnMsg(True,'删除成功!');
+
+ #清除SSH许可限制
+ def close_ssh_limit(self,get):
+ #清除白名单
+ allowConf = public.readFile(self.__ALLOW);
+ allowConf = re.sub("\n\s*sshd:\w{1,3}\.\w{1,3}\.\w{1,3}\.\w{1,3}:allow",'',allowConf);
+ public.writeFile(self.__ALLOW,allowConf);
+
+ #关闭限制
+ denyConf = public.readFile(self.__DENY);
+ denyConf = re.sub("sshd:ALL\s*","",denyConf);
+ public.writeFile(self.__DENY,denyConf);
+ return public.returnMsg(True,'清除成功!');
+
+ #清除面板登陆许可
+ def close_panel_limit(self,get):
+ if os.path.exists(self.__LIMIT_CONF): os.remove(self.__LIMIT_CONF);
+ return public.returnMsg(True,'已关闭IP限制!');
+
+ #获取操作系统信息
+ def get_system_info(self,get):
+ import system;
+ s = system.system();
+ data = s.GetSystemTotal(get,0.1);
+ data['disk'] = s.GetDiskInfo2();
+ return data;
+
+ #获取环境信息
+ def get_service_info(self,get):
+ import system;
+ serviceInfo = system.system().GetConcifInfo(get);
+ del(serviceInfo['mysql_root']);
+ return serviceInfo;
+
+ #获取用户绑定信息
+ def get_user_info(self,get):
+ return self.__userInfo;
+
+ #设置用户绑定信息
+ def set_user_info(self,get):
+ data = {}
+ data['username'] = get.username;
+ data['password'] = public.md5(get.password);
+ pdata = {}
+ pdata['data'] = self.De_Code(data);
+ result = json.loads(public.httpPost(self.__APIURL+'/GetToken',pdata));
+ result['data'] = self.En_Code(result['data']);
+ if result['data']: public.writeFile(self.__UPATH,json.dumps(result['data']));
+ del(result['data']);
+ return result;
+
+
+ #获取SSH爆破次数
+ def get_ssh_errorlogin(self,get):
+ path = '/var/log/secure'
+ if not os.path.exists(path): public.writeFile(path,'');
+ fp = open(path,'r');
+ l = fp.readline();
+ data = {};
+ data['intrusion'] = [];
+ data['intrusion_total'] = 0;
+
+ data['defense'] = [];
+ data['defense_total'] = 0;
+
+ data['success'] = [];
+ data['success_total'] = 0;
+
+ limit = 100;
+ while l:
+ if l.find('Failed password for root') != -1:
+ if len(data['intrusion']) > limit: del(data['intrusion'][0]);
+ data['intrusion'].append(l);
+ data['intrusion_total'] += 1;
+ elif l.find('Accepted') != -1:
+ if len(data['success']) > limit: del(data['success'][0]);
+ data['success'].append(l);
+ data['success_total'] += 1;
+ elif l.find('refused') != -1:
+ if len(data['defense']) > limit: del(data['defense'][0]);
+ data['defense'].append(l);
+ data['defense_total'] += 1;
+ l = fp.readline();
+
+ months = {'Jan':'01','Feb':'02','Mar':'03','Apr':'04','May':'05','Jun':'06','Jul':'07','Aug':'08','Sept':'09','Oct':'10','Nov':'11','Dec':'12'}
+
+ intrusion = [];
+ for g in data['intrusion']:
+ tmp = {}
+ tmp1 = g.split();
+ tmp['date'] = months[tmp1[0]] + '/' + tmp1[1] + ' ' + tmp1[2];
+ tmp['user'] = tmp1[8];
+ tmp['address'] = tmp1[10];
+ intrusion.append(tmp);
+
+ data['intrusion'] = intrusion;
+
+ success = [];
+ for g in data['success']:
+ tmp = {}
+ tmp1 = g.split();
+ tmp['date'] = months[tmp1[0]] + '/' + tmp1[1] + ' ' + tmp1[2];
+ tmp['user'] = tmp1[8];
+ tmp['address'] = tmp1[10];
+ success.append(tmp);
+ data['success'] = success;
+
+ defense = []
+ for g in data['defense']:
+ tmp = {}
+ tmp1 = g.split();
+ tmp['date'] = months[tmp1[0]] + '/' + tmp1[1] + ' ' + tmp1[2];
+ tmp['user'] = '-';
+ tmp['address'] = tmp1[8];
+ defense.append(tmp);
+ data['defense'] = defense;
+ import firewalls;
+ data['ssh'] = firewalls.firewalls().GetSshInfo(get);
+ return data;
+
+ #加密数据
+ def De_Code(self,data):
+ pdata = urllib.urlencode(data);
+ return binascii.hexlify(pdata);
+
+ #解密数据
+ def En_Code(self,data):
+ result = urllib.unquote(binascii.unhexlify(data));
+ return json.loads(result);
+
+
\ No newline at end of file
diff --git a/plugins/score/img/ico-score.png b/plugins/score/img/ico-score.png
new file mode 100755
index 000000000..42a9ac308
Binary files /dev/null and b/plugins/score/img/ico-score.png differ
diff --git a/plugins/score/img/ico-ts-cpu-active.png b/plugins/score/img/ico-ts-cpu-active.png
new file mode 100755
index 000000000..d35a644a0
Binary files /dev/null and b/plugins/score/img/ico-ts-cpu-active.png differ
diff --git a/plugins/score/img/ico-ts-cpu.png b/plugins/score/img/ico-ts-cpu.png
new file mode 100755
index 000000000..12fed1ab7
Binary files /dev/null and b/plugins/score/img/ico-ts-cpu.png differ
diff --git a/plugins/score/img/ico-ts-disk-active.png b/plugins/score/img/ico-ts-disk-active.png
new file mode 100755
index 000000000..ac52e19d7
Binary files /dev/null and b/plugins/score/img/ico-ts-disk-active.png differ
diff --git a/plugins/score/img/ico-ts-disk.png b/plugins/score/img/ico-ts-disk.png
new file mode 100755
index 000000000..347e87f63
Binary files /dev/null and b/plugins/score/img/ico-ts-disk.png differ
diff --git a/plugins/score/img/ico-ts-mem-active.png b/plugins/score/img/ico-ts-mem-active.png
new file mode 100755
index 000000000..ea383549c
Binary files /dev/null and b/plugins/score/img/ico-ts-mem-active.png differ
diff --git a/plugins/score/img/ico-ts-mem.png b/plugins/score/img/ico-ts-mem.png
new file mode 100755
index 000000000..fb497b6f3
Binary files /dev/null and b/plugins/score/img/ico-ts-mem.png differ
diff --git a/plugins/score/img/ico-ts-refresh.png b/plugins/score/img/ico-ts-refresh.png
new file mode 100755
index 000000000..1c84c4f66
Binary files /dev/null and b/plugins/score/img/ico-ts-refresh.png differ
diff --git a/plugins/score/img/ico-ts-score.jpg b/plugins/score/img/ico-ts-score.jpg
new file mode 100755
index 000000000..86a277bd3
Binary files /dev/null and b/plugins/score/img/ico-ts-score.jpg differ
diff --git a/plugins/score/index.html b/plugins/score/index.html
new file mode 100755
index 000000000..23782ce6f
--- /dev/null
+++ b/plugins/score/index.html
@@ -0,0 +1,547 @@
+
+
+
+
+
+
正在跑分中
+
+
+
开始跑分
+
+
+
公式:1万次整数+2万次浮点+1亿位圆周率+1万次排序 +((磁盘读+磁盘写)*IO速度)+内存容量
+
+
+
\ No newline at end of file
diff --git a/plugins/score/info.json b/plugins/score/info.json
new file mode 100755
index 000000000..59fda758e
--- /dev/null
+++ b/plugins/score/info.json
@@ -0,0 +1,15 @@
+{
+ "title":"宝塔跑分",
+ "tip":"lib",
+ "name":"score",
+ "type":"扩展",
+ "ps":"测试服务器基础性能!",
+ "versions":"1.3",
+ "shell":"score.sh",
+ "checks":"/www/server/panel/plugin/score",
+ "author":"宝塔",
+ "home":"http://www.bt.cn/bbs",
+ "date":"2017-10-16",
+ "default":false,
+ "display":0
+}
\ No newline at end of file
diff --git a/plugins/score/install.sh b/plugins/score/install.sh
new file mode 100755
index 000000000..ed1e22f65
--- /dev/null
+++ b/plugins/score/install.sh
@@ -0,0 +1,61 @@
+#!/bin/bash
+PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
+export PATH
+install_tmp='/tmp/bt_install.pl'
+CN='125.88.182.172'
+HK='download.bt.cn'
+HK2='103.224.251.67'
+US='128.1.164.196'
+sleep 0.5;
+CN_PING=`ping -c 1 -w 1 $CN|grep time=|awk '{print $7}'|sed "s/time=//"`
+HK_PING=`ping -c 1 -w 1 $HK|grep time=|awk '{print $7}'|sed "s/time=//"`
+HK2_PING=`ping -c 1 -w 1 $HK2|grep time=|awk '{print $7}'|sed "s/time=//"`
+US_PING=`ping -c 1 -w 1 $US|grep time=|awk '{print $7}'|sed "s/time=//"`
+
+echo "$HK_PING $HK" > ping.pl
+echo "$HK2_PING $HK2" >> ping.pl
+echo "$US_PING $US" >> ping.pl
+echo "$CN_PING $CN" >> ping.pl
+nodeAddr=`sort -V ping.pl|sed -n '1p'|awk '{print $2}'`
+if [ "$nodeAddr" == "" ];then
+ nodeAddr=$HK2
+fi
+
+download_Url=http://$nodeAddr:5880
+Install_score()
+{
+ echo '正在安装脚本文件...' > $install_tmp
+ mkdir -p /www/server/panel/plugin/score
+ wget -O /www/server/panel/plugin/score/score_main.py $download_Url/install/lib/plugin/score/score_main.py -T 5
+ sleep 0.1;
+ wget -O /www/server/panel/plugin/score/index.html $download_Url/install/lib/plugin/score/index.html -T 5
+ sleep 0.1;
+ wget -O /www/server/panel/plugin/score/testcpu.c $download_Url/install/lib/plugin/score/testcpu.c -T 5
+ gcc /www/server/panel/plugin/score/testcpu.c -o /www/server/panel/plugin/score/testcpu -lpthread
+ if [ ! -f '/www/server/panel/plugin/score/testcpu' ];then
+ sleep 0.1
+ gcc /www/server/panel/plugin/score/testcpu.c -o /www/server/panel/plugin/score/testcpu -lpthread
+ fi
+
+
+ if [ ! -f '/www/server/panel/static/img/soft_ico/ico-score.png' ];then
+ wget -O /www/server/panel/static/img/soft_ico/ico-score.png $download_Url/install/lib/plugin/score/img/ico-score.png
+ fi
+
+ wget -O /www/server/panel/plugin/score/info.json $download_Url/install/lib/plugin/score/info.json -T 5
+ echo '安装完成' > $install_tmp
+}
+
+Uninstall_score()
+{
+ rm -rf /www/server/panel/plugin/score
+ echo '卸载完成' > $install_tmp
+}
+
+
+action=$1
+if [ "${1}" == 'install' ];then
+ Install_score
+else
+ Uninstall_score
+fi
diff --git a/plugins/score/score_main.py b/plugins/score/score_main.py
new file mode 100755
index 000000000..8e70d18f7
--- /dev/null
+++ b/plugins/score/score_main.py
@@ -0,0 +1,340 @@
+#coding: utf-8
+# +-------------------------------------------------------------------
+# | 宝塔Linux面板 x3
+# +-------------------------------------------------------------------
+# | Copyright (c) 2015-2016 宝塔软件(http://bt.cn) All rights reserved.
+# +-------------------------------------------------------------------
+# | Author: 黄文良 <2879625666@qq.com>
+# +-------------------------------------------------------------------
+
+#+--------------------------------------------------------------------
+#| 服务器测试
+#+--------------------------------------------------------------------
+
+import time,psutil,random,os,urllib,binascii,json,public,re;
+class score_main:
+
+ __APIURL = 'https://www.bt.cn/api/Auth';
+ __UPATH = 'data/userInfo.json';
+ __userInfo = None;
+ __PDATA = None;
+
+ def CheckToken(self):
+ pdata = {}
+ data = {}
+ if os.path.exists(self.__UPATH):
+ self.__userInfo = json.loads(public.readFile(self.__UPATH));
+ if self.__userInfo:
+ pdata['access_key'] = self.__userInfo['access_key'];
+ data['secret_key'] = self.__userInfo['secret_key'];
+ else:
+ pdata['access_key'] = 'test';
+ data['secret_key'] = '123456';
+ pdata['data'] = data;
+ self.__PDATA = pdata;
+
+ #修正信息
+ def SetScore(self,get):
+ if hasattr(get,'ips'):
+ return self.SubmitSetScore('ips',get.ips);
+ if hasattr(get,'virt'):
+ return self.SubmitSetScore('virt',get.virt);
+
+ #发送信息修正
+ def SubmitSetScore(self,key,value):
+ self.CheckToken();
+ self.__PDATA['data'][key] = value
+ self.__PDATA['data'] = self.De_Code(self.__PDATA['data']);
+ result = json.loads(public.httpPost(self.__APIURL+'/SetSocre',self.__PDATA));
+ result['data'] = self.En_Code(result['data']);
+ return result;
+
+ #获取得分列表
+ def GetScore(self,get):
+ self.CheckToken();
+ self.__PDATA['data'] = self.De_Code(self.__PDATA['data']);
+ result = json.loads(public.httpPost(self.__APIURL+'/GetSocre',self.__PDATA));
+ result['data'] = self.En_Code(result['data']);
+ return result;
+
+ #获取配置信息
+ def GetConfig(self,get=None):
+ virt = '/usr/sbin/virt-what'
+ if not os.path.exists(virt):
+ if os.path.exists('/etc/yum.repos.d/epel.repo'):
+ os.system('mv /etc/yum.repos.d/epel.repo /etc/yum.repos.d/epel.repo_backup');
+ os.system('yum install virt-what -y');
+ if os.path.exists('/etc/yum.repos.d/epel.repo_backup'):
+ os.system('mv /etc/yum.repos.d/epel.repo_backup /etc/yum.repos.d/epel.repo');
+
+ data = {}
+ data['virt'] = public.ExecShell('virt-what')[0].strip();
+ cpuinfo = open('/proc/cpuinfo','r').read();
+ rep = "model\s+name\s+:\s+(.+)"
+ tmp = re.search(rep,cpuinfo);
+
+ data['cpu'] = tmp.groups()[0];
+ data['core'] = psutil.cpu_count();
+ data['memory'] = psutil.virtual_memory().total/1024/1024
+ data['system'] = self.GetSystemVersion();
+
+ scoreInfo = self.readScore();
+ data['disk'] = str(scoreInfo['read'])+','+str(scoreInfo['write'])
+ data['mem_score'] = scoreInfo['mem'];
+ data['cpu_score'] = scoreInfo['cpu1'] + scoreInfo['cpu2'] + scoreInfo['cpu3'] + scoreInfo['cpu4'];
+ data['disk_score'] = scoreInfo['disk_score'];
+ data['total_score'] = scoreInfo['mem']+data['cpu_score']+scoreInfo['disk_score'];
+ return data;
+
+ #提交到云端
+ def SubmitScore(self,get):
+ try:
+ self.CheckToken();
+ pdata = self.GetConfig(get);
+ if not pdata['total_score']: return public.returnMsg(False,'请先跑分!');
+ pdata['secret_key'] = self.__userInfo['secret_key'];
+ self.__PDATA['data'] = self.De_Code(pdata);
+ result = json.loads(public.httpPost(self.__APIURL+'/SubmitScore',self.__PDATA));
+ result['data'] = self.En_Code(result['data']);
+ return result;
+ except:
+ return None;
+
+ #取操作系统版本
+ def GetSystemVersion(self):
+ version = public.readFile('/etc/redhat-release')
+ if not version:
+ version = public.readFile('/etc/issue').replace('\\n \\l','').strip();
+ else:
+ version = version.replace('release ','').strip();
+ return version
+
+ #写当前得分
+ def writeScore(self,type,value):
+ scoreFile = '/www/server/panel/plugin/score/score.json';
+ if not os.path.exists(scoreFile):
+ data = {}
+ data['cpu1'] = 0;
+ data['cpu2'] = 0;
+ data['cpu3'] = 0;
+ data['cpu4'] = 0;
+ data['mem'] = 0;
+ data['disk_score'] = 0;
+ data['read'] = 0;
+ data['write'] = 0;
+ public.writeFile(scoreFile,json.dumps(data));
+
+ data = json.loads(public.readFile(scoreFile));
+ data[type] = value;
+ public.writeFile(scoreFile,json.dumps(data));
+
+ #读当前得分
+ def readScore(self):
+ scoreFile = '/www/server/panel/plugin/score/score.json';
+ if not os.path.exists(scoreFile):
+ data = {}
+ data['cpu1'] = 0;
+ data['cpu2'] = 0;
+ data['cpu3'] = 0;
+ data['cpu4'] = 0;
+ data['mem'] = 0;
+ data['disk_score'] = 0;
+ data['read'] = 0;
+ data['write'] = 0;
+ public.writeFile(scoreFile,json.dumps(data));
+ data = json.loads(public.readFile(scoreFile));
+ return data;
+
+
+ #测试CPU
+ def testCpu(self,get,n = 1):
+ data = {}
+ data['cpuCount'] = psutil.cpu_count();
+ if not hasattr(get,'type'): get.type = '0';
+ import re;
+ cpuinfo = open('/proc/cpuinfo','r').read();
+ rep = "model\s+name\s+:\s+(.+)"
+ tmp = re.search(rep,cpuinfo);
+ data['cpuType'] = ""
+ if tmp:
+ data['cpuType'] = tmp.groups()[0];
+
+ import system
+ data['system'] = system.system().GetSystemVersion();
+ path = '/www/server/panel/plugin/score/testcpu';
+ if not os.path.exists(path): os.system('gcc '+path+'.c -o ' +path + ' -lpthread');
+ start = time.time();
+ os.system(path + ' 32 ' + get.type);
+ end = time.time();
+ data['score'] = int(400 * 10 / (end - start));
+ if not os.path.exists(path): data['score'] = 0;
+ self.writeScore('cpu'+get.type, data['score'])
+ return data;
+ pass
+
+ #测试整数运算
+ def testInt(self):
+ return self.testIntOrFloat(1);
+
+ #测试浮点运行
+ def testFloat(self):
+ return self.testIntOrFloat(1.01);
+
+ #CPU测试体
+ def testIntOrFloat(self,n=1):
+ start = time.time();
+ num = 10000 * 100;
+ for i in range(num):
+ if i == 0: continue;
+ a = n + i;
+ b = n - i;
+ c = n * i;
+ d = n / i;
+ n = n + 1;
+
+ end = time.time();
+ usetime = end - start;
+ return num / 100 / usetime;
+
+ #冒泡算法测试
+ def testBubble(self):
+ start = time.time();
+ num = 10000 * 5;
+ xx = 'qwertyuiopasdfghjklzxcvbnm1234567890'
+ for c in xrange(num):
+ lst = []
+ for k in range(10):
+ lst.append(xx[random.randint(0,len(xx)-1)])
+ lst = self.bubbleSort(lst)
+ end = time.time();
+ usetime = end - start;
+ return num / 5 / usetime;
+
+ #冒泡排序
+ def bubbleSort(self,lst):
+ length = len(lst)
+ for i in xrange(0, length, 1):
+ for j in xrange(0, length-1-i, 1):
+ if lst[j] < lst[j+1]:
+ temp = lst[j]
+ lst[j] = lst[j+1]
+ lst[j+1] = temp
+ return lst
+
+ #二叉树算法测试
+ def testTree(self):
+ import testTree
+
+ start = time.time();
+ elems = range(3000) #生成树节点
+ tree = testTree.Tree() #新建一个树对象
+ for elem in elems:
+ tree.add(elem) #逐个加入树的节点
+
+ tree.level_queue(tree.root)
+ tree.front_digui(tree.root)
+ tree.middle_digui(tree.root)
+ tree.later_digui(tree.root)
+ tree.front_stack(tree.root)
+ tree.middle_stack(tree.root)
+ tree.later_stack(tree.root)
+
+ end = time.time();
+ usetime = end - start;
+ return 3000 / usetime;
+
+
+
+ #测试内存
+ def testMem(self,get):
+ mem = psutil.virtual_memory()
+ self.writeScore('mem', mem.total/1024/1024)
+ #提交数据
+ self.SubmitScore(get)
+ return mem.total/1024/1024;
+
+ #测试磁盘
+ def testDisk(self,get):
+ import os
+ data = {}
+ os.system('rm -f testDisk_*');
+ filename = "testDisk_" + time.strftime('%Y%m%d%H%M%S',time.localtime());
+ data['write'] = self.testDiskWrite(filename);
+ import shutil
+ filename2 = "testDisk_" + time.strftime('%Y%m%d%H%M%S',time.localtime());
+ shutil.move(filename,filename2);
+ data['read'] = self.testDiskRead(filename2);
+ diskIo = psutil.disk_partitions()
+ diskInfo = []
+ for disk in diskIo:
+ tmp = {}
+ tmp['path'] = disk[1]
+ tmp['size'] = psutil.disk_usage(disk[1])[0]
+ diskInfo.append(tmp)
+ data['diskInfo'] = diskInfo;
+ writeDisk = data['write'];
+ if data['write'] > 1000: writeDisk = 1000;
+ readDisk = data['read'];
+ if data['read'] > 1000: readDisk = 1000;
+
+ data['score'] = (writeDisk * 6) + (readDisk * 6)
+ os.remove(filename2);
+
+ self.writeScore('disk_score', data['score'])
+ self.writeScore('write', data['write'])
+ self.writeScore('read', data['read'])
+ return data;
+ pass
+
+ #测试磁盘写入速度
+ def testDiskWrite(self,filename):
+ import random
+ start = time.time();
+ fp = open(filename,'w+');
+ strTest = "";
+ strTmp = "";
+ for n in range(4):
+ strTmp += chr(random.randint(97, 122))
+ for n in range(1024):
+ strTest += strTmp;
+
+ for i in range(1024 * 256):
+ fp.write(strTest);
+
+ del(strTest);
+ del(strTmp);
+ fp.close()
+ end = time.time();
+ usetime = end - start;
+ return int(1024/usetime);
+
+ #测试磁盘读取速度
+ def testDiskRead(self,filename):
+ os.system('echo 3 > /proc/sys/vm/drop_caches');
+ import random
+ start = time.time();
+ fp = open(filename,'r');
+ size = 4096;
+ while True:
+ tmp = fp.read(size);
+ if not tmp: break;
+ del(tmp);
+ fp.close()
+ end = time.time();
+ usetime = end - start;
+ return int(1024/usetime);
+
+ def testWorkNet(self):
+ pass
+
+
+ #加密数据
+ def De_Code(self,data):
+ pdata = urllib.urlencode(data);
+ return binascii.hexlify(pdata);
+
+ #解密数据
+ def En_Code(self,data):
+ result = urllib.unquote(binascii.unhexlify(data));
+ return json.loads(result);
+
\ No newline at end of file
diff --git a/plugins/score/testcpu.c b/plugins/score/testcpu.c
new file mode 100755
index 000000000..10ff234fa
--- /dev/null
+++ b/plugins/score/testcpu.c
@@ -0,0 +1,129 @@
+#include
+#include
+#include
+#include
+
+const int N_qsort = 10000;
+const int N_int = 10000;
+const int N_float = 20000;
+const int N_pi = 50000000;
+
+
+int thread_count = 0;
+
+void int_comp(void);
+void float_comp(void);
+void pi_comp(void);
+void to_qsort(int arr[],int low,int high);
+void qsort_comp(void);
+void thread(void);
+void thread_int(void);
+void thread_float(void);
+void thread_pi(void);
+void thread_qsort(void);
+
+int main(int argc,char** argv){
+ int count,i,result,type;
+ count = atoi(argv[1]);
+ type = atoi(argv[2]);
+ if(argc < 3){
+ printf("ERROR: Parameter error[%d]",argc);
+ }
+ pthread_t tid;
+ for(i=0;i=high) return;
+ int first=low;
+ int last=high;
+ int key=arr[first];
+ while(first=key) --last;
+ arr[first]=arr[last];
+ while(first0;i--) arr[N_qsort-1]=i;
+ to_qsort(arr,0,N_qsort-1);
+}
\ No newline at end of file
diff --git a/static/js/public.js b/static/js/public.js
index 51d65156f..b10f5e643 100755
--- a/static/js/public.js
+++ b/static/js/public.js
@@ -1247,55 +1247,6 @@ function listOrder(skey,type,obj){
}
}
-//去关联列表
-function GetBtpanelList(){
- var con ='';
- $.post("/config?action=GetPanelList",function(rdata){
- for(var i=0; i'+rdata[i].title+''
- }
- $("#newbtpc").html(con);
- $(".mypcipnew").hover(function(){
- $(this).css("opacity","1");
- },function(){
- $(this).css("opacity",".6");
- }).click(function(){
- $("#btpanelform").remove();
- var murl = $(this).attr("data-url");
- var user = $(this).attr("data-user");
- var pw = $(this).attr("data-pw");
- layer.open({
- type: 2,
- title: false,
- closeBtn: 0, //不显示关闭按钮
- shade: [0],
- area: ['340px', '215px'],
- offset: 'rb', //右下角弹出
- time: 5, //2秒后自动关闭
- anim: 2,
- content: [murl+'/login', 'no']
- });
- var loginForm ='';
- $("body").append(loginForm);
- layer.msg(lan.bt.panel_open,{icon:16,shade: [0.3, '#000'],time:1000});
- setTimeout(function(){
- $("#toBtpanel").submit();
- },500);
- setTimeout(function(){
- window.open(murl);
- },1000);
- });
- $(".btedit").click(function(e){
- e.stopPropagation();
- });
- })
-
-}
-GetBtpanelList();
//添加面板快捷登录
function bindBTPanel(a,type,ip,btid,url,user,pw){
var titleName = lan.bt.panel_add;
diff --git a/templates/default/soft.html b/templates/default/soft.html
index 716591a50..49644abdb 100755
--- a/templates/default/soft.html
+++ b/templates/default/soft.html
@@ -34,8 +34,6 @@
软件名称 |
说明 |
- 价格 |
- 到期时间 |
状态 |
位置 |
状态 |
diff --git a/views/plugins.py b/views/plugins.py
index 6e34bce1e..420983323 100644
--- a/views/plugins.py
+++ b/views/plugins.py
@@ -3,8 +3,21 @@
from flask import Blueprint, render_template
from flask import jsonify
+import psutil
+import time
+import sys
+import os
+
+
+sys.path.append("class/")
+import public
+import json
+
+
plugins = Blueprint('plugins', __name__, template_folder='templates')
+__plugin_name = "plugins"
+
@plugins.route("/")
def index():
@@ -13,4 +26,21 @@ def index():
@plugins.route("/list")
def list():
- return jsonify({"ss": 3})
+
+ data = json.loads(public.readFile("data/type.json"))
+ ret = {}
+ ret["type"] = data
+
+ for dirinfo in os.listdir(__plugin_name):
+ path = __plugin_name + "/" + dirinfo
+ if os.path.isdir(path):
+ jsonFile = path + "/info.json"
+ if os.path.exists(jsonFile):
+ try:
+ tmp = json.loads(public.readFile(jsonFile))
+ print tmp
+ except:
+ pass
+ print dirinfo
+
+ return jsonify(ret)