@ -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'; |
@ -0,0 +1,86 @@ |
|||||||
|
<div id="beta-1" class="bt-form pd20 pb55" style="padding-top:0"> |
||||||
|
<div class="neice_con"> |
||||||
|
<div class="tit">注意事项</div> |
||||||
|
<div class="nc_con"> |
||||||
|
<p style="color:red">1、注意,请不要在正式商用网站及自己生产环境的面板申请测试版。</p> |
||||||
|
<p>2、所有新功能做完内部初审后都会第一时间向所有内测用户推送。</p> |
||||||
|
<p>3、内测版会有诸多小Bug,如遇到,可以论坛或QQ找我们,我们一定负责到底。</p> |
||||||
|
<p>4、内测意义在于为广大宝塔用户找Bug,宝塔团队再一次感谢您的积极参与。</p> |
||||||
|
<p>5、如果你不是愿意付出及肯折腾学习的人,我们不建议申请内测。</p> |
||||||
|
</div> |
||||||
|
<div class="nc_opt"><label><input type="checkbox" name="yes" value="yes" />以上5句我已阅读并知晓</label></div> |
||||||
|
<div class="tit">联系方式</div> |
||||||
|
<div class="nc_con nc_con_user"> |
||||||
|
<p><span>论坛用户名</span><input id="ename" name="name" value=""></p> |
||||||
|
<p style="line-height: 10px; margin-left: 80px; position: relative; top: -5px;">请如实填写宝塔论坛账号,提交后我们会审核,如未有,<a style="color:#20a53a" href="http://www.bt.cn/bbs/member.php?mod=register" target="_blank">去注册宝塔论坛账户</a></p> |
||||||
|
<p><span>QQ号码</span><input id="qq" name="qq" value=""></p> |
||||||
|
<p><span>邮箱</span><input id="email" name="email" value=""></p> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
<div class="bt-form-submit-btn"> |
||||||
|
<button type="button" class="btn btn-danger btn-sm" onclick="layer.closeAll()">取消</button> |
||||||
|
<button type="button" class="btn btn-success btn-sm" onclick="neice()">提交</button> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
<div id="beta-2" class="nc-tips" style="display:none;"> |
||||||
|
<p style="font-size: 16px; margin-bottom: 10px;">恭喜您,成为内测组的一员!</p> |
||||||
|
<p>您的宝塔论坛认证用户为:<span id="bbs_user"></span></p> |
||||||
|
<p>您可以用这个账号在内测专用版块反馈交流,<a href="http://www.bt.cn/bbs/forum.php?mod=forumdisplay&fid=39" target="_blank">宝塔论坛内测专用版块</a></p> |
||||||
|
<p>如果您想返回正式版,则直接SSH里再执行安装代码即可</p> |
||||||
|
</div> |
||||||
|
<script type="javascript/text"> |
||||||
|
$(function(){ |
||||||
|
$(".nc_con_user input").addClass("disabled").attr({"disabled":"disabled","placeholder":"阅读注意事项并确认"}); |
||||||
|
$.get('/plugin?action=a&name=beta&s=GetConfig',function(rdata){ |
||||||
|
if(rdata.status === false){ |
||||||
|
layer.closeAll(); |
||||||
|
layer.msg(rdata.msg,{icon:5}); |
||||||
|
return; |
||||||
|
} |
||||||
|
if(rdata != 'False'){ |
||||||
|
$("#beta-1").hide(); |
||||||
|
$("#beta-2").show(); |
||||||
|
$("#bbs_user").text(rdata.split('|')[0]); |
||||||
|
}else{ |
||||||
|
$("#beta-2").hide(); |
||||||
|
$("#beta-1").show(); |
||||||
|
} |
||||||
|
}); |
||||||
|
}); |
||||||
|
|
||||||
|
$(".nc_opt label").click(function(){ |
||||||
|
var check = $(".nc_opt input").prop("checked"); |
||||||
|
if(!check){ |
||||||
|
$(".nc_con_user input").addClass("disabled").attr({"disabled":"disabled","placeholder":"阅读注意事项并确认"}); |
||||||
|
} |
||||||
|
else{ |
||||||
|
$(".nc_con_user input").removeClass("disabled").removeAttr("disabled").removeAttr("placeholder"); |
||||||
|
} |
||||||
|
}); |
||||||
|
$('#qq').on('input', function() { |
||||||
|
var str = $(this).val(); |
||||||
|
$("#email").val(str+"@qq.com"); |
||||||
|
}); |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function neice(){ |
||||||
|
var bbs_name = $("#ename").val(); |
||||||
|
var qq = $("#qq").val(); |
||||||
|
var email = $("#email").val(); |
||||||
|
|
||||||
|
if(bbs_name == '' || qq == '' || email == ''){ |
||||||
|
layer.msg('论坛用户名/QQ/邮箱不能为空!',{icon:2}); |
||||||
|
return; |
||||||
|
} |
||||||
|
|
||||||
|
var data = 'bbs_name=' + bbs_name + '&qq=' + qq + '&email=' + email; |
||||||
|
var loadT = layer.msg("正在提交,请稍候...",{icon:16,time:0,shade:[0.3,'#000']}); |
||||||
|
$.post('/plugin?action=a&name=beta&s=SetConfig',data,function(rdata){ |
||||||
|
layer.close(loadT); |
||||||
|
if(rdata.status) layer.closeAll(); |
||||||
|
layer.msg(rdata.msg,{icon:rdata.status?1:2}); |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
</script> |
@ -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 |
||||||
|
} |
@ -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 |
@ -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; |
After Width: | Height: | Size: 1.8 KiB |
After Width: | Height: | Size: 891 B |
After Width: | Height: | Size: 1.8 KiB |
@ -0,0 +1,74 @@ |
|||||||
|
<style> |
||||||
|
.btyw .table td,.btyw .table th { |
||||||
|
height: 50px; |
||||||
|
vertical-align: middle; |
||||||
|
} |
||||||
|
.btyw .ico-hot{ |
||||||
|
background: url(/static/images/ico-hot.png) no-repeat 0 0/26px auto; |
||||||
|
} |
||||||
|
.btyw .bgf6{ |
||||||
|
background-color: #f9f9f9; |
||||||
|
} |
||||||
|
</style> |
||||||
|
<div class="pd15 btyw divtable"> |
||||||
|
<p style="margin-bottom:15px;font-size:14px;color:red">宝塔运维,一对一技术服务,承诺如解决不好,款项立即全额原路退回,请放心付费后咨询。</p> |
||||||
|
<table class="table table-hover"> |
||||||
|
<thead> |
||||||
|
<tr> |
||||||
|
<th>服务类型</th> |
||||||
|
<th>服务范围</th> |
||||||
|
<th>服务价格</th> |
||||||
|
<th>购买服务</th> |
||||||
|
</tr> |
||||||
|
</thead> |
||||||
|
<tbody> |
||||||
|
<tr> |
||||||
|
<td>企业托管运维</td> |
||||||
|
<td class="text-left">定制化企业托管服务,如有需要可咨询技术</td> |
||||||
|
<td>5000元/年起</td> |
||||||
|
<td><a class="btlink" href="https://www.bt.cn/admin/yunwei" target="_blank">立即前往</a></td> |
||||||
|
</tr> |
||||||
|
<tr class="bgf6"> |
||||||
|
<td>宝塔面板安装</td> |
||||||
|
<td class="text-left">安装好宝塔面板及指定环境,并做好服务器安全设置</td> |
||||||
|
<td style="line-height: 20px;"><s>原价200元起</s><br><span style="color:red">限时特价80元</span></td> |
||||||
|
<td><a class="btlink" href="https://www.bt.cn/admin/yunwei" target="_blank">立即前往</a></td> |
||||||
|
</tr> |
||||||
|
<tr> |
||||||
|
<td>系统优化加速</td> |
||||||
|
<td class="text-left">网站加速、系统优化、环境优化,让性能更上一台阶</td> |
||||||
|
<td>300元/次起</td> |
||||||
|
<td><a class="btlink" href="https://www.bt.cn/admin/yunwei" target="_blank">立即前往</a></td> |
||||||
|
</tr> |
||||||
|
<tr class="bgf6"> |
||||||
|
<td>数据同步服务</td> |
||||||
|
<td class="text-left">部署SQL SERVER或MySQL数据库实时热备功能</td> |
||||||
|
<td>300元/次起 </td> |
||||||
|
<td><a class="btlink" href="https://www.bt.cn/admin/yunwei" target="_blank">立即前往</a></td> |
||||||
|
</tr> |
||||||
|
<tr> |
||||||
|
<td>网站挂马清理</td> |
||||||
|
<td class="text-left">手工查找并清理网站的各种挂马代码</td> |
||||||
|
<td>500元/次起</td> |
||||||
|
<td><a class="btlink" href="https://www.bt.cn/admin/yunwei" target="_blank">立即前往</a></td> |
||||||
|
</tr> |
||||||
|
<tr class="bgf6"> |
||||||
|
<td class="ico-hot">面板问题处理</td> |
||||||
|
<td class="text-left">解决面板打不开、部分功能无法正常使用等问题</td> |
||||||
|
<td style="line-height: 20px;"><s>原价200元起</s><br><span style="color:red">限时特价80元</span></td> |
||||||
|
<td><a class="btlink" href="https://www.bt.cn/admin/yunwei" target="_blank">立即前往</a></td> |
||||||
|
</tr> |
||||||
|
</tbody> |
||||||
|
</table> |
||||||
|
</div> |
||||||
|
<script type="javascript/text"> |
||||||
|
function GetIndex(){ |
||||||
|
$.get('/plugin?action=a&name=btyw&s=GetIndex',function(rdata){ |
||||||
|
if(rdata === true){ |
||||||
|
layer.closeAll(); |
||||||
|
PluginMan('btyw','宝塔运维'); |
||||||
|
} |
||||||
|
}); |
||||||
|
} |
||||||
|
GetIndex(); |
||||||
|
</script> |
@ -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 |
||||||
|
} |
@ -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 |
@ -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'); |
||||||
|
|
After Width: | Height: | Size: 553 B |
After Width: | Height: | Size: 553 B |
@ -0,0 +1,415 @@ |
|||||||
|
<style> |
||||||
|
.disable { |
||||||
|
background-color: #ededed; |
||||||
|
} |
||||||
|
.onekeyCode .table > tbody > tr > td{ |
||||||
|
line-height:1.7; |
||||||
|
} |
||||||
|
.oneKeysearchBar{ |
||||||
|
position: absolute; |
||||||
|
top: 10px; |
||||||
|
right:15px; |
||||||
|
z-index: 20; |
||||||
|
} |
||||||
|
.success-msg .suc-con { |
||||||
|
float: right; |
||||||
|
width: 280px; |
||||||
|
} |
||||||
|
.bt-progress { |
||||||
|
background-color: #e2e2e2; |
||||||
|
border-radius: 8px; |
||||||
|
height: 16px; |
||||||
|
line-height: 16px; |
||||||
|
position: relative; |
||||||
|
margin:5px 0; |
||||||
|
} |
||||||
|
.bt-progress-bar { |
||||||
|
background-color: #5ab76c; |
||||||
|
border-radius: 8px; |
||||||
|
height: 16px; |
||||||
|
max-width: 100%; |
||||||
|
position: absolute; |
||||||
|
text-align: right; |
||||||
|
transition: all 0.3s ease 0s; |
||||||
|
width: 0; |
||||||
|
} |
||||||
|
.bt-progress-text { |
||||||
|
font-size: 12px; |
||||||
|
color: #fff; |
||||||
|
padding: 0 10px; |
||||||
|
position: static; |
||||||
|
} |
||||||
|
.onekey-menu-sub{ |
||||||
|
background-color: #fff; |
||||||
|
border-bottom: 1px solid #ccc; |
||||||
|
height: 50px; |
||||||
|
line-height: 50px; |
||||||
|
} |
||||||
|
.onekey-menu-sub span{ |
||||||
|
height: 50px; |
||||||
|
padding: 0 15px; |
||||||
|
cursor: pointer; |
||||||
|
display: inline-block; |
||||||
|
font-size: 14px; |
||||||
|
} |
||||||
|
.onekey-menu-sub .on { |
||||||
|
border-bottom: 2px solid #20a53a; |
||||||
|
color: #20a53a; |
||||||
|
font-weight: bold; |
||||||
|
} |
||||||
|
</style> |
||||||
|
<div class="oneKeysearchBar"> |
||||||
|
<input class="searchInput bt-input-text" type="text" placeholder="请输入检索条件" value="" style="width:140px" /> |
||||||
|
<button class="btn btn-default btn-sm va0" onclick="GetSrcList();">查找</button> |
||||||
|
</div> |
||||||
|
<div class="onekey-menu-sub mlr15 onekey-type"></div> |
||||||
|
<div class="divtable pd15 onekeyCode" style="max-height:500px; overflow:auto"> |
||||||
|
<table class="table table-hover" width="100%"> |
||||||
|
<thead> |
||||||
|
<tr> |
||||||
|
<th>名称</th> |
||||||
|
<th>版本</th> |
||||||
|
<th>简介</th> |
||||||
|
<th>支持PHP版本</th> |
||||||
|
<th style="text-align: right;" width="80">操作</th> |
||||||
|
</tr> |
||||||
|
</thead> |
||||||
|
<tbody id="zipBody"></tbody> |
||||||
|
</table> |
||||||
|
</div> |
||||||
|
<script type="javascript/text"> |
||||||
|
$('.layui-layer-page').css({'width':'760px'}); |
||||||
|
var openId = add = null; |
||||||
|
function AddDeployment(maction){ |
||||||
|
if(maction == 1){ |
||||||
|
var pdata = 'title=' + $("input[name='title']").val() |
||||||
|
+'&dname=' + $("input[name='name']").val() |
||||||
|
+'&ps=' + $("input[name='ps']").val() |
||||||
|
+'&version=' + $("input[name='version']").val() |
||||||
|
+'&rewrite=' + ($("input[name='rewrite']").attr('checked')?1:0) |
||||||
|
+'&shell=' + ($("input[name='shell']").attr('checked')?1:0) |
||||||
|
+'&php=' + $("input[name='php']").val() |
||||||
|
+'&md5=' + $("input[name='md5']").val() |
||||||
|
+'&download=' + $("input[name='download']").val() |
||||||
|
var loadT = layer.msg('正在提交 <img src="/static/img/ing.gif">',{icon:16,time:0,shade: [0.3, '#000']}); |
||||||
|
$.post('/plugin?action=a&name=deployment&s=AddPackage',pdata,function(rdata){ |
||||||
|
layer.close(loadT); |
||||||
|
layer.msg(rdata.msg,{icon:rdata.status?1:5}); |
||||||
|
if(rdata.status) { |
||||||
|
GetSrcList(); |
||||||
|
layer.close(openId); |
||||||
|
} |
||||||
|
}); |
||||||
|
|
||||||
|
return; |
||||||
|
} |
||||||
|
openId = layer.open({ |
||||||
|
type: 1, |
||||||
|
skin: 'demo-class', |
||||||
|
area: '480px', |
||||||
|
title: '添加源码包', |
||||||
|
closeBtn: 2, |
||||||
|
shift: 5, |
||||||
|
shadeClose: false, |
||||||
|
content:'标题:<input type="text" name="title"><br>\ |
||||||
|
标识:<input type="text" name="name"><br>\ |
||||||
|
描述:<input type="text" name="ps"><br>\ |
||||||
|
版本:<input type="text" name="version"><br>\ |
||||||
|
是否写伪静态:<input type="checkbox" name="rewrite"><br>\ |
||||||
|
是否执行安装脚本:<input type="checkbox" name="shell"><br>\ |
||||||
|
支持的PHP版本:<input type="text" name="php"><br>\ |
||||||
|
md5:<input type="text" name="md5">\ |
||||||
|
下载地址:<input type="text" name="download"><br>\ |
||||||
|
<button class="btn btn-default btn-sm" onclick="AddDeployment(1);">提交</button>' |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
$(".searchInput").keyup(function(e){ |
||||||
|
if(e.keyCode == 13){ |
||||||
|
GetSrcList(); |
||||||
|
} |
||||||
|
}); |
||||||
|
|
||||||
|
function AddSite(codename){ |
||||||
|
var array; |
||||||
|
var str=""; |
||||||
|
var domainlist=''; |
||||||
|
var domain = array = $("#mainDomain").val().split("\n"); |
||||||
|
var Webport=[]; |
||||||
|
var checkDomain = domain[0].split('.'); |
||||||
|
if(checkDomain.length < 1){ |
||||||
|
layer.msg('域名格式不正确,请重新输入!',{icon:2}); |
||||||
|
return; |
||||||
|
} |
||||||
|
for(var i=1; i<domain.length; i++){ |
||||||
|
domainlist += '"'+domain[i]+'",'; |
||||||
|
} |
||||||
|
Webport = domain[0].split(":")[1];//主域名端口 |
||||||
|
if(Webport==undefined){ |
||||||
|
Webport="80"; |
||||||
|
} |
||||||
|
domainlist = domainlist.substring(0,domainlist.length-1);//子域名json |
||||||
|
mainDomain = domain[0].split(':')[0]; |
||||||
|
domain ='{"domain":"'+domain[0]+'","domainlist":['+domainlist+'],"count":'+domain.length+'}';//拼接joson |
||||||
|
var php_version = $("select[name='version']").val(); |
||||||
|
var loadT = layer.msg('正在创建站点 <img src="/static/img/ing.gif">',{icon:16,time:0,shade: [0.3, "#000"]}) |
||||||
|
var data = $("#addweb").serialize()+"&port="+Webport+"&webname="+domain+'&ftp=false&sql=true&address=localhost&codeing=utf8&version='+php_version; |
||||||
|
$.post('/site?action=AddSite', data, function(ret) { |
||||||
|
layer.close(loadT) |
||||||
|
if(!ret.siteStatus){ |
||||||
|
layer.msg(ret.msg,{icon:5}); |
||||||
|
return; |
||||||
|
} |
||||||
|
layer.close(add) |
||||||
|
var sqlData = ''; |
||||||
|
if (ret.databaseStatus) { |
||||||
|
sqlData = "<p class='p1'>数据库账号资料</p>\ |
||||||
|
<p><span>数据库名:</span><strong>" + ret.databaseUser + "</strong></p>\ |
||||||
|
<p><span>用户:</span><strong>" + ret.databaseUser + "</strong></p>\ |
||||||
|
<p><span>密码:</span><strong>" + ret.databasePass + "</strong></p>\ |
||||||
|
" |
||||||
|
} |
||||||
|
var pdata = 'dname=' + codename + '&site_name=' + mainDomain + '&php_version='+php_version; |
||||||
|
var loadT = layer.msg('<div class="depSpeed">正在提交 <img src="/static/img/ing.gif"></div>',{icon:16,time:0,shade: [0.3, "#000"]}); |
||||||
|
|
||||||
|
setTimeout(function(){ |
||||||
|
GetSpeed(); |
||||||
|
},2000); |
||||||
|
|
||||||
|
$.post('/plugin?action=a&name=deployment&s=SetupPackage',pdata,function(rdata){ |
||||||
|
layer.close(loadT) |
||||||
|
if(!rdata.status){ |
||||||
|
layer.msg('源码下载失败!',{icon:5}); |
||||||
|
return; |
||||||
|
} |
||||||
|
|
||||||
|
if(rdata.msg.username != ''){ |
||||||
|
sqlData = "<p class='p1'>已成功部署,无需安装,请登录修改默认账号密码</p>\ |
||||||
|
<p><span>用户:</span><strong>" + rdata.msg.username + "</strong></p>\ |
||||||
|
<p><span>密码:</span><strong>" + rdata.msg.password + "</strong></p>\ |
||||||
|
" |
||||||
|
} |
||||||
|
sqlData += "<p><span>访问站点:</span><a class='btlink' href='http://" + mainDomain + rdata.msg.install + "' target='_blank'>http://" + mainDomain + rdata.msg.install + "</a></p>"; |
||||||
|
|
||||||
|
layer.open({ |
||||||
|
type: 1, |
||||||
|
area: '600px', |
||||||
|
title: '已成功部署'+codename, |
||||||
|
closeBtn:2, |
||||||
|
shadeClose: false, |
||||||
|
content: "<div class='success-msg'>\ |
||||||
|
<div class='pic'><img src='/static/img/success-pic.png'></div>\ |
||||||
|
<div class='suc-con'>\ |
||||||
|
" + sqlData + "\ |
||||||
|
</div>\ |
||||||
|
</div>", |
||||||
|
}); |
||||||
|
if ($(".success-msg").height() < 150) { |
||||||
|
$(".success-msg").find("img").css({ |
||||||
|
"width": "150px", |
||||||
|
"margin-top": "30px" |
||||||
|
}); |
||||||
|
} |
||||||
|
}); |
||||||
|
|
||||||
|
|
||||||
|
}); |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
function GetSpeed(){ |
||||||
|
if(!$('.depSpeed')) return; |
||||||
|
$.get('/plugin?action=a&name=deployment&s=GetSpeed',function(speed){ |
||||||
|
if(speed.status === false) return; |
||||||
|
if(speed.name == '下载文件'){ |
||||||
|
speed = '<p>正在'+speed.name+' <img src="/static/img/ing.gif"></p>\ |
||||||
|
<div class="bt-progress"><div class="bt-progress-bar" style="width:'+speed.pre+'%"><span class="bt-progress-text">'+speed.pre+'%</span></div></div>\ |
||||||
|
<p class="f12 c9"><span class="pull-left">'+ToSize(speed.used)+'/'+ToSize(speed.total)+'</span><span class="pull-right">'+ToSize(speed.speed)+'/s</span></p>'; |
||||||
|
$('.depSpeed').prev().hide(); |
||||||
|
$('.depSpeed').css({"margin-left":"-37px","width":"380px"}); |
||||||
|
$('.depSpeed').parents(".layui-layer").css({"margin-left":"-100px"}); |
||||||
|
}else{ |
||||||
|
speed = '<p>'+speed.name+'</p>'; |
||||||
|
$('.depSpeed').prev().show(); |
||||||
|
$('.depSpeed').removeAttr("style"); |
||||||
|
$('.depSpeed').parents(".layui-layer").css({"margin-left":"0"}); |
||||||
|
} |
||||||
|
|
||||||
|
$('.depSpeed').html(speed); |
||||||
|
setTimeout(function(){ |
||||||
|
GetSpeed(); |
||||||
|
},1000); |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
function onekeyCodeSite(codename,versions){ |
||||||
|
$.post('/site?action=GetPHPVersion',function(rdata){ |
||||||
|
var php_version = ""; |
||||||
|
var n = 0; |
||||||
|
for(var i=rdata.length-1;i>=0;i--){ |
||||||
|
if(versions.indexOf(rdata[i].version) != -1){ |
||||||
|
php_version += "<option value='"+rdata[i].version+"'>"+rdata[i].name+"</option>"; |
||||||
|
n++; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
if(n == 0){ |
||||||
|
layer.msg('缺少被支持的PHP版本,请安装!',{icon:5}); |
||||||
|
return; |
||||||
|
} |
||||||
|
var con='<form class="bt-form pd20 pb70" id="addweb">\ |
||||||
|
<div class="line"><span class="tname">域名</span>\ |
||||||
|
<div class="info-r c4"><textarea id="mainDomain" class="bt-input-text" name="webname" style="width:398px;height:100px;line-height:22px"></textarea>\ |
||||||
|
<div class="placeholder c9" style="top:10px;left:10px">每行填写一个域名,默认为80端口<br>泛解析添加方法 *.domain.com<br>如另加端口格式为 www.domain.com:88</div>\ |
||||||
|
</div>\ |
||||||
|
</div>\ |
||||||
|
<div class="line"><span class="tname">备注</span>\ |
||||||
|
<div class="info-r c4"><input id="Wbeizhu" class="bt-input-text" name="ps" placeholder="网站备注" style="width:398px" type="text"> </div>\ |
||||||
|
</div>\ |
||||||
|
<div class="line"><span class="tname">根目录</span>\ |
||||||
|
<div class="info-r c4"><input id="inputPath" class="bt-input-text mr5" name="path" value="/www/wwwroot/" placeholder="网站根目录" style="width:398px" type="text"><span class="glyphicon glyphicon-folder-open cursor" onclick="ChangePath(\'inputPath\')"></span> </div>\ |
||||||
|
</div>\ |
||||||
|
<div class="line"><span class="tname">数据库</span>\ |
||||||
|
<div class="info-r c4">\ |
||||||
|
<input id="datauser" class="bt-input-text" name="datauser" placeholder="用户名/数据库名" style="width:190px;margin-right:13px" type="text">\ |
||||||
|
<input id="datapassword" class="bt-input-text" name="datapassword" placeholder="密码" style="width:190px" type="text">\ |
||||||
|
</div>\ |
||||||
|
</div>\ |
||||||
|
<div class="line"><span class="tname">源码</span>\ |
||||||
|
<input class="bt-input-text mr5 disable" name="code" style="width:100px" value="'+codename+'" disabled>\ |
||||||
|
<span class="c9">准备为你部署的源码程序</span>\ |
||||||
|
</div>\ |
||||||
|
<div class="line"><span class="tname">PHP版本</span>\ |
||||||
|
<select class="bt-input-text mr5" name="version" id="c_k3" style="width:100px">\ |
||||||
|
'+php_version+'\ |
||||||
|
</select>\ |
||||||
|
<span class="c9">请选择源码程序支持的php版本</span>\ |
||||||
|
</div>\ |
||||||
|
<div class="bt-form-submit-btn">\ |
||||||
|
<button type="button" class="btn btn-danger btn-sm onekeycodeclose">取消</button>\ |
||||||
|
<button type="button" class="btn btn-success btn-sm" onclick="AddSite(\''+codename+'\')">提交</button>\ |
||||||
|
</div>\ |
||||||
|
</from>'; |
||||||
|
add = layer.open({ |
||||||
|
type: 1, |
||||||
|
title: "宝塔一键部署"+codename, |
||||||
|
area: '560px', |
||||||
|
closeBtn: 2, |
||||||
|
shadeClose: false, |
||||||
|
content:con |
||||||
|
}); |
||||||
|
var placeholder = "<div class='placeholder c9' style='top:10px;left:10px'>每行填写一个域名,默认为80端口<br>泛解析添加方法 *.domain.com<br>如另加端口格式为 www.domain.com:88</div>"; |
||||||
|
$(".onekeycodeclose").click(function(){ |
||||||
|
layer.close(add); |
||||||
|
}); |
||||||
|
$('#mainDomain').after(placeholder); |
||||||
|
$(".placeholder").click(function(){ |
||||||
|
$(this).hide(); |
||||||
|
$('#mainDomain').focus(); |
||||||
|
}) |
||||||
|
$('#mainDomain').focus(function() { |
||||||
|
$(".placeholder").hide(); |
||||||
|
}); |
||||||
|
|
||||||
|
$('#mainDomain').blur(function() { |
||||||
|
if($(this).val().length==0){ |
||||||
|
$(".placeholder").show(); |
||||||
|
} |
||||||
|
}); |
||||||
|
//FTP账号数据绑定域名 |
||||||
|
$('#mainDomain').on('input', function() { |
||||||
|
var defaultPath = '/www/wwwroot'; |
||||||
|
var array; |
||||||
|
var res,ress; |
||||||
|
var str = $(this).val(); |
||||||
|
var len = str.replace(/[^\x00-\xff]/g, "**").length; |
||||||
|
array = str.split("\n"); |
||||||
|
ress =array[0].split(":")[0]; |
||||||
|
res = ress.replace(new RegExp(/([-.])/g), '_'); |
||||||
|
if(res.length > 15) res = res.substr(0,15); |
||||||
|
if($("#inputPath").val().substr(0,defaultPath.length) == defaultPath) $("#inputPath").val(defaultPath+'/'+ress); |
||||||
|
if(!isNaN(res.substr(0,1))) res = "sql"+res; |
||||||
|
if(res.length > 15) res = res.substr(0,15); |
||||||
|
$("#Wbeizhu").val(ress); |
||||||
|
$("#datauser").val(res); |
||||||
|
}) |
||||||
|
$('#Wbeizhu').on('input', function() { |
||||||
|
var str = $(this).val(); |
||||||
|
var len = str.replace(/[^\x00-\xff]/g, "**").length; |
||||||
|
if (len > 20) { |
||||||
|
str = str.substring(0, 20); |
||||||
|
$(this).val(str); |
||||||
|
layer.msg('不要超出20个字符', { |
||||||
|
icon: 0 |
||||||
|
}); |
||||||
|
} |
||||||
|
}) |
||||||
|
//获取当前时间时间戳,截取后6位 |
||||||
|
var timestamp = new Date().getTime().toString(); |
||||||
|
var dtpw = timestamp.substring(7); |
||||||
|
$("#datauser").val("sql" + dtpw); |
||||||
|
$("#datapassword").val(_getRandomString(10)); |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
//生成n位随机密码 |
||||||
|
function _getRandomString(len) { |
||||||
|
len = len || 32; |
||||||
|
var $chars = 'ABCDEFGHJKMNPQRSTWXYZabcdefhijkmnprstwxyz2345678'; // 默认去掉了容易混淆的字符oOLl,9gq,Vv,Uu,I1 |
||||||
|
var maxPos = $chars.length; |
||||||
|
var pwd = ''; |
||||||
|
for (i = 0; i < len; i++) { |
||||||
|
pwd += $chars.charAt(Math.floor(Math.random() * maxPos)); |
||||||
|
} |
||||||
|
return pwd; |
||||||
|
} |
||||||
|
function GetSrcList(){ |
||||||
|
var loadT = layer.msg('正在获取列表 <img src="/static/img/ing.gif">',{icon:16,time:0,shade: [0.3, '#000']}); |
||||||
|
var search = $(".searchInput").val(); |
||||||
|
if(search != ''){ |
||||||
|
search = '&search=' + search+'&'; |
||||||
|
} |
||||||
|
var type = ''; |
||||||
|
var istype = getCookie('depType'); |
||||||
|
if(istype == 'undefined' || istype == 'null' || !istype) { |
||||||
|
istype = '0'; |
||||||
|
} |
||||||
|
type = '&type='+istype; |
||||||
|
|
||||||
|
$.get('/plugin?action=a&name=deployment&s=GetList' + search + type,function(mlist){ |
||||||
|
layer.close(loadT); |
||||||
|
|
||||||
|
tbody = ''; |
||||||
|
for(var i=0;i<mlist.type.length;i++){ |
||||||
|
var c = ''; |
||||||
|
if(istype == mlist.type[i].type){ |
||||||
|
c = 'class="on"'; |
||||||
|
} |
||||||
|
tbody += '<span typeid="'+mlist.type[i].type+'" '+c+'>'+mlist.type[i].title+'</span>'; |
||||||
|
} |
||||||
|
|
||||||
|
$(".onekey-type").html(tbody); |
||||||
|
|
||||||
|
var zbody = ''; |
||||||
|
for(var i=mlist.data.length-1;i>=0;i--){ |
||||||
|
zbody += '<tr>' |
||||||
|
+'<td>'+mlist.data[i].title+'</td>' |
||||||
|
+'<td>'+mlist.data[i].version+'</td>' |
||||||
|
+'<td>'+mlist.data[i].ps+'</td>' |
||||||
|
+'<td>'+mlist.data[i].php+'</td>' |
||||||
|
+'<td class="text-right"><a href="javascript:onekeyCodeSite(\''+mlist.data[i].name+'\',\''+mlist.data[i].php+'\');" class="btlink">一键部署</a></td>' |
||||||
|
+'</tr>' |
||||||
|
} |
||||||
|
$("#zipBody").html(zbody); |
||||||
|
$(".searchInput").val(''); |
||||||
|
|
||||||
|
$(".onekey-menu-sub span").click(function(){ |
||||||
|
setCookie('depType',$(this).attr('typeid')); |
||||||
|
$(this).addClass("on").siblings().removeClass("on"); |
||||||
|
GetSrcList(); |
||||||
|
}); |
||||||
|
}); |
||||||
|
} |
||||||
|
GetSrcList(); |
||||||
|
</script> |
@ -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 |
||||||
|
} |
@ -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 |
@ -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<br>口令: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":"<a href='https://www.bt.cn/redirect?name=metInfo' class='btlink' target='_blank'>MetInfo</a>", |
||||||
|
"type":1, |
||||||
|
"version":"6.0.0", |
||||||
|
"md5":"fff363bc0cbb13a5c2dc8c2a652da825", |
||||||
|
"ext":"", |
||||||
|
"chmod":"", |
||||||
|
"install":"", |
||||||
|
"php":"52,53,54,55,56,70", |
||||||
|
"ps":"企业建站系统<font style='color: #fff;padding: 1px 4px;position: relative;margin-left: 6px;border-radius: 3px;background-color: #fc6d26;'>推荐</font>", |
||||||
|
"config":"", |
||||||
|
"username":"", |
||||||
|
"password":"", |
||||||
|
"run":"/", |
||||||
|
"download":"{Download}/metInfo.zip" |
||||||
|
}, |
||||||
|
{ |
||||||
|
"name":"chanzhi", |
||||||
|
"title":"<a href='https://www.bt.cn/redirect?name=chanzhi' class='btlink' target='_blank'>蝉知CMS</a>", |
||||||
|
"type":1, |
||||||
|
"version":"6.5", |
||||||
|
"md5":"793af27f2984127c34490229124644b8", |
||||||
|
"ext":"pathinfo", |
||||||
|
"chmod":"", |
||||||
|
"install":"/admin.php", |
||||||
|
"php":"53,54,55,56,70,71", |
||||||
|
"ps":"开源免费的企业门户系统,CMS系统<font style='color: #fff;padding: 1px 4px;position: relative;margin-left: 6px;border-radius: 3px;background-color: #fc6d26;'>推荐</font>", |
||||||
|
"config":"/system/config/my.php", |
||||||
|
"username":"admin", |
||||||
|
"password":"admin", |
||||||
|
"run":"/www", |
||||||
|
"download":"{Download}/chanzhi_auto.zip" |
||||||
|
}, |
||||||
|
{ |
||||||
|
"name":"cscms", |
||||||
|
"title":"<a href='https://www.bt.cn/redirect?name=cscms' class='btlink' target='_blank'>CSCMS</a>", |
||||||
|
"type":1, |
||||||
|
"version":"4.1", |
||||||
|
"md5":"12b66ea05ad3b829be916fe541c1dedc", |
||||||
|
"ext":"", |
||||||
|
"chmod":"", |
||||||
|
"install":"/install.php", |
||||||
|
"php":"53,54,55,56", |
||||||
|
"ps":"多元化内容管理系统<font style='color: #fff;padding: 1px 4px;position: relative;margin-left: 6px;border-radius: 3px;background-color: #fc6d26;'>推荐</font>", |
||||||
|
"config":"", |
||||||
|
"username":"", |
||||||
|
"password":"", |
||||||
|
"run":"/", |
||||||
|
"download":"{Download}/cscms.zip" |
||||||
|
}, |
||||||
|
{ |
||||||
|
"name":"kodexplorer", |
||||||
|
"title":"<a href='https://www.bt.cn/redirect?name=kodexplorer' class='btlink' target='_blank'>可道云KodExplorer</a>", |
||||||
|
"type":1, |
||||||
|
"version":"4.06", |
||||||
|
"md5":"2907559eac6714394eb9f5a44e005eea", |
||||||
|
"ext":"", |
||||||
|
"chmod":"", |
||||||
|
"install":"/index.php", |
||||||
|
"php":"52,53,54,55,56,70,71,72", |
||||||
|
"ps":"强大易用的私有云/在线文档管理<font style='color: #fff;padding: 1px 4px;position: relative;margin-left: 6px;border-radius: 3px;background-color: #fc6d26;'>推荐</font>", |
||||||
|
"config":"", |
||||||
|
"username":"", |
||||||
|
"password":"", |
||||||
|
"run":"/", |
||||||
|
"download":"{Download}/kodexplorer.zip" |
||||||
|
}, |
||||||
|
{ |
||||||
|
"name":"tipask", |
||||||
|
"title":"<a href='https://www.bt.cn/redirect?name=tipask' class='btlink' target='_blank'>Tipask</a>", |
||||||
|
"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":"国内知名问答程序<font style='color: #fff;padding: 1px 4px;position: relative;margin-left: 6px;border-radius: 3px;background-color: #fc6d26;'>推荐</font>", |
||||||
|
"config":".env", |
||||||
|
"username":"admin@tipask.com", |
||||||
|
"password":"tipask", |
||||||
|
"run":"/public", |
||||||
|
"download":"{Download}/tipask_auto.zip" |
||||||
|
}, |
||||||
|
{ |
||||||
|
"name":"maccms", |
||||||
|
"title":"<a href='https://www.bt.cn/redirect?name=maccms' class='btlink' target='_blank'>苹果CMS</a>", |
||||||
|
"type":1, |
||||||
|
"version":"8.0", |
||||||
|
"md5":"a9801d94d1c592b5bb6d2474e5c0c37e", |
||||||
|
"ext":"", |
||||||
|
"chmod":"", |
||||||
|
"install":"", |
||||||
|
"php":"52,53,54,55,56,70,71,72", |
||||||
|
"ps":"PHP开源建站系统<font style='color: #fff;padding: 1px 4px;position: relative;margin-left: 6px;border-radius: 3px;background-color: #fc6d26;'>推荐</font>", |
||||||
|
"config":"", |
||||||
|
"username":"", |
||||||
|
"password":"", |
||||||
|
"run":"/", |
||||||
|
"download":"{Download}/maccms.zip" |
||||||
|
}, |
||||||
|
{ |
||||||
|
"name":"seacms", |
||||||
|
"title":"<a href='https://www.bt.cn/redirect?name=seacms' class='btlink' target='_blank'>海洋CMS</a>", |
||||||
|
"type":1, |
||||||
|
"version":"6.54", |
||||||
|
"md5":"ca43469682b8e5e7cdceba020bf39375", |
||||||
|
"ext":"", |
||||||
|
"chmod":"", |
||||||
|
"install":"/admin", |
||||||
|
"php":"52,53,54,55,56.70", |
||||||
|
"ps":"完全开源免费的PHP视频管理系统<font style='color: #fff;padding: 1px 4px;position: relative;margin-left: 6px;border-radius: 3px;background-color: #fc6d26;'>推荐</font>", |
||||||
|
"config":"data/common.inc.php", |
||||||
|
"username":"admin", |
||||||
|
"password":"admin", |
||||||
|
"run":"/", |
||||||
|
"download":"{Download}/seacms_auto.zip" |
||||||
|
}, |
||||||
|
{ |
||||||
|
"name":"cxxcms", |
||||||
|
"title":"<a href='https://www.bt.cn/redirect?name=cxxcms' class='btlink' target='_blank'>程序侠CMS</a>", |
||||||
|
"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系统<font style='color: #fff;padding: 1px 4px;position: relative;margin-left: 6px;border-radius: 3px;background-color: #fc6d26;'>推荐</font>", |
||||||
|
"config":"application/database.php", |
||||||
|
"username":"admin", |
||||||
|
"password":"chengxuxia.com", |
||||||
|
"run":"/", |
||||||
|
"download":"{Download}/cxxcms_auto.zip" |
||||||
|
}, |
||||||
|
{ |
||||||
|
"name":"z-blog", |
||||||
|
"title":"<a href='https://www.bt.cn/redirect?name=z-blog' class='btlink' target='_blank'>Z-Blog</a>", |
||||||
|
"type":4, |
||||||
|
"version":"1.5.2", |
||||||
|
"md5":"07faf7fbeecfe9cad10872fe03ab3127", |
||||||
|
"ext":"pathinfo", |
||||||
|
"chmod":"", |
||||||
|
"install":"", |
||||||
|
"php":"52,53,54,55,56,70,71,72", |
||||||
|
"ps":"国内知名博客程序<font style='color: #fff;padding: 1px 4px;position: relative;margin-left: 6px;border-radius: 3px;background-color: #fc6d26;'>推荐</font>", |
||||||
|
"config":"zb_users/c_option.php", |
||||||
|
"username":"admin", |
||||||
|
"password":"zblogger", |
||||||
|
"run":"/", |
||||||
|
"download":"{Download}/z-blog_auto.zip" |
||||||
|
}, |
||||||
|
{ |
||||||
|
"name":"dbshop", |
||||||
|
"title":"<a href='https://www.bt.cn/redirect?name=dbshop' class='btlink' target='_blank'>DBShop</a>", |
||||||
|
"type":2, |
||||||
|
"version":"v1.2", |
||||||
|
"md5":"f3c5559fa8eb04bdc9938382658f3a03", |
||||||
|
"ext":"pathinfo", |
||||||
|
"chmod":"", |
||||||
|
"install":"/admin", |
||||||
|
"php":"53,54,55,56,70,71,72", |
||||||
|
"ps":"专业且良心的商城系统<font style='color: #fff;padding: 1px 4px;position: relative;margin-left: 6px;border-radius: 3px;background-color: #fc6d26;'>推荐</font>", |
||||||
|
"config":"data/Database.ini.php", |
||||||
|
"username":"admin", |
||||||
|
"password":"1234567", |
||||||
|
"run":"/", |
||||||
|
"download":"{Download}/dbshop_auto.zip" |
||||||
|
}, |
||||||
|
{ |
||||||
|
"name":"niushop", |
||||||
|
"title":"<a href='https://www.bt.cn/redirect?name=niushop' class='btlink' target='_blank'>NiuShop</a>", |
||||||
|
"type":2, |
||||||
|
"version":"1.1.9", |
||||||
|
"md5":"637c6ad54fa4732df35857304e5eeb82", |
||||||
|
"ext":"pathinfo", |
||||||
|
"chmod":"", |
||||||
|
"install":"", |
||||||
|
"php":"54,55,56,70", |
||||||
|
"ps":"优秀的TP5.0开源商城系统<font style='color: #fff;padding: 1px 4px;position: relative;margin-left: 6px;border-radius: 3px;background-color: #fc6d26;'>推荐</font>", |
||||||
|
"config":"application/database.php", |
||||||
|
"username":"admin", |
||||||
|
"password":"123456", |
||||||
|
"run":"/", |
||||||
|
"download":"{Download}/niushop_auto.zip" |
||||||
|
}, |
||||||
|
{ |
||||||
|
"name":"weengine", |
||||||
|
"title":"<a href='https://www.bt.cn/redirect?name=weengine' class='btlink' target='_blank'>微擎</a>", |
||||||
|
"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":"微信第三方管理引擎<font style='color: #fff;padding: 1px 4px;position: relative;margin-left: 6px;border-radius: 3px;background-color: #fc6d26;'>推荐</font>", |
||||||
|
"config":"data/config.php", |
||||||
|
"username":"admin", |
||||||
|
"password":"we7.cc", |
||||||
|
"run":"/", |
||||||
|
"download":"{Download}/weengine_auto.zip" |
||||||
|
} |
||||||
|
] |
@ -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<br>口令: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":"<a href='https://www.bt.cn/redirect?name=metInfo' class='btlink' target='_blank'>MetInfo</a>", |
||||||
|
"type":1, |
||||||
|
"version":"6.0.0", |
||||||
|
"md5":"fff363bc0cbb13a5c2dc8c2a652da825", |
||||||
|
"ext":"", |
||||||
|
"chmod":"", |
||||||
|
"install":"", |
||||||
|
"php":"52,53,54,55,56,70", |
||||||
|
"ps":"企业建站系统<font style='color: #fff;padding: 1px 4px;position: relative;margin-left: 6px;border-radius: 3px;background-color: #fc6d26;'>推荐</font>", |
||||||
|
"config":"", |
||||||
|
"username":"", |
||||||
|
"password":"", |
||||||
|
"run":"/", |
||||||
|
"download":"{Download}/metInfo.zip" |
||||||
|
}, |
||||||
|
{ |
||||||
|
"name":"chanzhi", |
||||||
|
"title":"<a href='https://www.bt.cn/redirect?name=chanzhi' class='btlink' target='_blank'>蝉知CMS</a>", |
||||||
|
"type":1, |
||||||
|
"version":"6.5", |
||||||
|
"md5":"793af27f2984127c34490229124644b8", |
||||||
|
"ext":"pathinfo", |
||||||
|
"chmod":"", |
||||||
|
"install":"/admin.php", |
||||||
|
"php":"53,54,55,56,70,71", |
||||||
|
"ps":"开源免费的企业门户系统,CMS系统<font style='color: #fff;padding: 1px 4px;position: relative;margin-left: 6px;border-radius: 3px;background-color: #fc6d26;'>推荐</font>", |
||||||
|
"config":"/system/config/my.php", |
||||||
|
"username":"admin", |
||||||
|
"password":"admin", |
||||||
|
"run":"/www", |
||||||
|
"download":"{Download}/chanzhi_auto.zip" |
||||||
|
}, |
||||||
|
{ |
||||||
|
"name":"cscms", |
||||||
|
"title":"<a href='https://www.bt.cn/redirect?name=cscms' class='btlink' target='_blank'>CSCMS</a>", |
||||||
|
"type":1, |
||||||
|
"version":"4.1", |
||||||
|
"md5":"12b66ea05ad3b829be916fe541c1dedc", |
||||||
|
"ext":"", |
||||||
|
"chmod":"", |
||||||
|
"install":"/install.php", |
||||||
|
"php":"53,54,55,56", |
||||||
|
"ps":"多元化内容管理系统<font style='color: #fff;padding: 1px 4px;position: relative;margin-left: 6px;border-radius: 3px;background-color: #fc6d26;'>推荐</font>", |
||||||
|
"config":"", |
||||||
|
"username":"", |
||||||
|
"password":"", |
||||||
|
"run":"/", |
||||||
|
"download":"{Download}/cscms.zip" |
||||||
|
}, |
||||||
|
{ |
||||||
|
"name":"kodexplorer", |
||||||
|
"title":"<a href='https://www.bt.cn/redirect?name=kodexplorer' class='btlink' target='_blank'>可道云KodExplorer</a>", |
||||||
|
"type":1, |
||||||
|
"version":"4.06", |
||||||
|
"md5":"2907559eac6714394eb9f5a44e005eea", |
||||||
|
"ext":"", |
||||||
|
"chmod":"", |
||||||
|
"install":"/index.php", |
||||||
|
"php":"52,53,54,55,56,70,71,72", |
||||||
|
"ps":"强大易用的私有云/在线文档管理<font style='color: #fff;padding: 1px 4px;position: relative;margin-left: 6px;border-radius: 3px;background-color: #fc6d26;'>推荐</font>", |
||||||
|
"config":"", |
||||||
|
"username":"", |
||||||
|
"password":"", |
||||||
|
"run":"/", |
||||||
|
"download":"{Download}/kodexplorer.zip" |
||||||
|
}, |
||||||
|
{ |
||||||
|
"name":"tipask", |
||||||
|
"title":"<a href='https://www.bt.cn/redirect?name=tipask' class='btlink' target='_blank'>Tipask</a>", |
||||||
|
"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":"国内知名问答程序<font style='color: #fff;padding: 1px 4px;position: relative;margin-left: 6px;border-radius: 3px;background-color: #fc6d26;'>推荐</font>", |
||||||
|
"config":".env", |
||||||
|
"username":"admin@tipask.com", |
||||||
|
"password":"tipask", |
||||||
|
"run":"/public", |
||||||
|
"download":"{Download}/tipask_auto.zip" |
||||||
|
}, |
||||||
|
{ |
||||||
|
"name":"maccms", |
||||||
|
"title":"<a href='https://www.bt.cn/redirect?name=maccms' class='btlink' target='_blank'>苹果CMS</a>", |
||||||
|
"type":1, |
||||||
|
"version":"8.0", |
||||||
|
"md5":"a9801d94d1c592b5bb6d2474e5c0c37e", |
||||||
|
"ext":"", |
||||||
|
"chmod":"", |
||||||
|
"install":"", |
||||||
|
"php":"52,53,54,55,56,70,71,72", |
||||||
|
"ps":"PHP开源建站系统<font style='color: #fff;padding: 1px 4px;position: relative;margin-left: 6px;border-radius: 3px;background-color: #fc6d26;'>推荐</font>", |
||||||
|
"config":"", |
||||||
|
"username":"", |
||||||
|
"password":"", |
||||||
|
"run":"/", |
||||||
|
"download":"{Download}/maccms.zip" |
||||||
|
}, |
||||||
|
{ |
||||||
|
"name":"seacms", |
||||||
|
"title":"<a href='https://www.bt.cn/redirect?name=seacms' class='btlink' target='_blank'>海洋CMS</a>", |
||||||
|
"type":1, |
||||||
|
"version":"6.54", |
||||||
|
"md5":"ca43469682b8e5e7cdceba020bf39375", |
||||||
|
"ext":"", |
||||||
|
"chmod":"", |
||||||
|
"install":"/admin", |
||||||
|
"php":"52,53,54,55,56.70", |
||||||
|
"ps":"完全开源免费的PHP视频管理系统<font style='color: #fff;padding: 1px 4px;position: relative;margin-left: 6px;border-radius: 3px;background-color: #fc6d26;'>推荐</font>", |
||||||
|
"config":"data/common.inc.php", |
||||||
|
"username":"admin", |
||||||
|
"password":"admin", |
||||||
|
"run":"/", |
||||||
|
"download":"{Download}/seacms_auto.zip" |
||||||
|
}, |
||||||
|
{ |
||||||
|
"name":"cxxcms", |
||||||
|
"title":"<a href='https://www.bt.cn/redirect?name=cxxcms' class='btlink' target='_blank'>程序侠CMS</a>", |
||||||
|
"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系统<font style='color: #fff;padding: 1px 4px;position: relative;margin-left: 6px;border-radius: 3px;background-color: #fc6d26;'>推荐</font>", |
||||||
|
"config":"application/database.php", |
||||||
|
"username":"admin", |
||||||
|
"password":"chengxuxia.com", |
||||||
|
"run":"/", |
||||||
|
"download":"{Download}/cxxcms_auto.zip" |
||||||
|
}, |
||||||
|
{ |
||||||
|
"name":"z-blog", |
||||||
|
"title":"<a href='https://www.bt.cn/redirect?name=z-blog' class='btlink' target='_blank'>Z-Blog</a>", |
||||||
|
"type":4, |
||||||
|
"version":"1.5.2", |
||||||
|
"md5":"07faf7fbeecfe9cad10872fe03ab3127", |
||||||
|
"ext":"pathinfo", |
||||||
|
"chmod":"", |
||||||
|
"install":"", |
||||||
|
"php":"52,53,54,55,56,70,71,72", |
||||||
|
"ps":"国内知名博客程序<font style='color: #fff;padding: 1px 4px;position: relative;margin-left: 6px;border-radius: 3px;background-color: #fc6d26;'>推荐</font>", |
||||||
|
"config":"zb_users/c_option.php", |
||||||
|
"username":"admin", |
||||||
|
"password":"zblogger", |
||||||
|
"run":"/", |
||||||
|
"download":"{Download}/z-blog_auto.zip" |
||||||
|
}, |
||||||
|
{ |
||||||
|
"name":"dbshop", |
||||||
|
"title":"<a href='https://www.bt.cn/redirect?name=dbshop' class='btlink' target='_blank'>DBShop</a>", |
||||||
|
"type":2, |
||||||
|
"version":"v1.2", |
||||||
|
"md5":"f3c5559fa8eb04bdc9938382658f3a03", |
||||||
|
"ext":"pathinfo", |
||||||
|
"chmod":"", |
||||||
|
"install":"/admin", |
||||||
|
"php":"53,54,55,56,70,71,72", |
||||||
|
"ps":"专业且良心的商城系统<font style='color: #fff;padding: 1px 4px;position: relative;margin-left: 6px;border-radius: 3px;background-color: #fc6d26;'>推荐</font>", |
||||||
|
"config":"data/Database.ini.php", |
||||||
|
"username":"admin", |
||||||
|
"password":"1234567", |
||||||
|
"run":"/", |
||||||
|
"download":"{Download}/dbshop_auto.zip" |
||||||
|
}, |
||||||
|
{ |
||||||
|
"name":"niushop", |
||||||
|
"title":"<a href='https://www.bt.cn/redirect?name=niushop' class='btlink' target='_blank'>NiuShop</a>", |
||||||
|
"type":2, |
||||||
|
"version":"1.1.9", |
||||||
|
"md5":"637c6ad54fa4732df35857304e5eeb82", |
||||||
|
"ext":"pathinfo", |
||||||
|
"chmod":"", |
||||||
|
"install":"", |
||||||
|
"php":"54,55,56,70", |
||||||
|
"ps":"优秀的TP5.0开源商城系统<font style='color: #fff;padding: 1px 4px;position: relative;margin-left: 6px;border-radius: 3px;background-color: #fc6d26;'>推荐</font>", |
||||||
|
"config":"application/database.php", |
||||||
|
"username":"admin", |
||||||
|
"password":"123456", |
||||||
|
"run":"/", |
||||||
|
"download":"{Download}/niushop_auto.zip" |
||||||
|
}, |
||||||
|
{ |
||||||
|
"name":"weengine", |
||||||
|
"title":"<a href='https://www.bt.cn/redirect?name=weengine' class='btlink' target='_blank'>微擎</a>", |
||||||
|
"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":"微信第三方管理引擎<font style='color: #fff;padding: 1px 4px;position: relative;margin-left: 6px;border-radius: 3px;background-color: #fc6d26;'>推荐</font>", |
||||||
|
"config":"data/config.php", |
||||||
|
"username":"admin", |
||||||
|
"password":"we7.cc", |
||||||
|
"run":"/", |
||||||
|
"download":"{Download}/weengine_auto.zip" |
||||||
|
} |
||||||
|
] |
@ -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":"" |
||||||
|
} |
||||||
|
] |
@ -1 +0,0 @@ |
|||||||
index |
|
@ -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 |
||||||
|
} |
@ -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 |
After Width: | Height: | Size: 715 B |
@ -0,0 +1,550 @@ |
|||||||
|
<style> |
||||||
|
|
||||||
|
|
||||||
|
/*危险按钮*/ |
||||||
|
.bts-danger:hover{ |
||||||
|
color: #fff; |
||||||
|
background-color: #c9302c; |
||||||
|
border-color: #ac2925; |
||||||
|
} |
||||||
|
#whiteList a{ |
||||||
|
color: red; |
||||||
|
} |
||||||
|
|
||||||
|
/*弹窗*/ |
||||||
|
.Add_view{ |
||||||
|
height: 100px; |
||||||
|
padding-left: 35px; |
||||||
|
padding-top: 35px; |
||||||
|
} |
||||||
|
.Add_view label{ |
||||||
|
margin-right: 10px; |
||||||
|
font-size: 15px; |
||||||
|
font-weight: 100; |
||||||
|
} |
||||||
|
.Add_view input{ |
||||||
|
width: 230px; |
||||||
|
} |
||||||
|
.Add_view .error{ |
||||||
|
border: 1px solid red; |
||||||
|
} |
||||||
|
.Add_view .correct{ |
||||||
|
border: 1px solid #20a53a; |
||||||
|
} |
||||||
|
|
||||||
|
/*日志管理*/ |
||||||
|
.btnTitle{ |
||||||
|
font-weight: 100; |
||||||
|
font-size: 16px; |
||||||
|
line-height: 34px; |
||||||
|
height: 34px; |
||||||
|
margin-right: 15px; |
||||||
|
position: relative; |
||||||
|
top: 2px; |
||||||
|
} |
||||||
|
.whiteList-table{ |
||||||
|
margin-top: 10px; |
||||||
|
} |
||||||
|
/*登录日志表单*/ |
||||||
|
.viewTwo .whiteList-table{ |
||||||
|
overflow-x: hidden; |
||||||
|
height: 500px; |
||||||
|
} |
||||||
|
.maks{ |
||||||
|
background: rgba(39, 39, 39, 0.4); |
||||||
|
position: absolute; |
||||||
|
width: 700px; |
||||||
|
height: 555px; |
||||||
|
z-index: 999; |
||||||
|
overflow: hidden; |
||||||
|
} |
||||||
|
.boxshow{ |
||||||
|
position: absolute; |
||||||
|
height: 150px; |
||||||
|
width: 400px; |
||||||
|
margin-left: -200px; |
||||||
|
margin-top: -75px; |
||||||
|
left: 50%; |
||||||
|
top: 50%; |
||||||
|
z-index: 1000; |
||||||
|
background: #fff; |
||||||
|
padding: 25px 20px; |
||||||
|
overflow: hidden; |
||||||
|
} |
||||||
|
.btPayment { |
||||||
|
float: left; |
||||||
|
padding: 8px 10px; |
||||||
|
width: 190px; |
||||||
|
height: 100px; |
||||||
|
line-height: 33px; |
||||||
|
text-align: center; |
||||||
|
border-left: 1px solid #ececec; |
||||||
|
} |
||||||
|
.btPayment .t2{ |
||||||
|
display: block; |
||||||
|
width: 100%; |
||||||
|
text-align: center; |
||||||
|
font-size: 16px; |
||||||
|
margin-bottom: 5px; |
||||||
|
} |
||||||
|
.btPayment .price{ |
||||||
|
color: #20A53A; |
||||||
|
font-size: 22px; |
||||||
|
margin: 0 5px; |
||||||
|
|
||||||
|
} |
||||||
|
.bt-form{ |
||||||
|
overflow: hidden; |
||||||
|
} |
||||||
|
.boxtext{ |
||||||
|
line-height: 32px; |
||||||
|
margin-top: -17px; |
||||||
|
text-align: center; |
||||||
|
border-bottom: #eee 1px solid; |
||||||
|
height: 39px; |
||||||
|
font-size: 14px; |
||||||
|
} |
||||||
|
</style> |
||||||
|
<div class="maks" style="display: none"></div> |
||||||
|
<div class="boxshow" style="display: none;"> |
||||||
|
<div> |
||||||
|
<div class="boxtext"> |
||||||
|
<span>未开通此服务,如需使用请开通企业运维版。</span> |
||||||
|
</div> |
||||||
|
<div class="btvipinfo" style="width: 170px;padding-left: 20px"> |
||||||
|
<p style="height: 25px">1、一对一运维人员对接</p> |
||||||
|
<p style="height: 25px">2、提供每月3次运维服务</p> |
||||||
|
<p style="height: 25px">3、双重安全隔离登录</p> |
||||||
|
</div> |
||||||
|
<div class="btPayment"> |
||||||
|
<span class="t2">企业运维版<span class="price">98</span>元/月</span> |
||||||
|
<button class="btn btn-success btn-sm" style="width:80%" onclick="window.open('https://www.bt.cn/admin/index.html')">立即开通</button> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
<div class="bt-form"> |
||||||
|
<div class="bt-w-main"> |
||||||
|
<div class="bt-w-menu"> |
||||||
|
<p class="bgw">密钥</p> |
||||||
|
<p>面板设置</p> |
||||||
|
<p>面板登录日志</p> |
||||||
|
<p>SSH设置</p> |
||||||
|
<p>SSH日志管理</p> |
||||||
|
</div> |
||||||
|
<div class="bt-w-con pd15"> |
||||||
|
<div class="soft-man-con viewZoo"> |
||||||
|
<p class="status" style="margin-top:10px;margin-left:10px;height: 80px;margin-bottom:15px;"> |
||||||
|
<span style="float:left;margin-top:-5px">密钥:</span> |
||||||
|
<textarea class="bt-input-text" name="token" readonly="readonly" style="background-color: #eee;width:400px;height:80px;padding: 8px 15px;" placeholder="密钥已隐藏..."></textarea> |
||||||
|
</p> |
||||||
|
<input type="button" class="btn btn-success btn-sm" name="ButtonShow" style="margin-left:52px;width:100px" onclick="sagelogin.tokenShow()" value="显示密钥" /> |
||||||
|
<ul style="margin: 15px 5px;padding-left: 70px;list-style-type: disc;line-height: 25px;"> |
||||||
|
<li>宝塔企业运维后台连接您的服务器需要此密钥,请妥善记录并保存</li> |
||||||
|
<li>一但密钥丢失,可能导致您无法登录服务器</li> |
||||||
|
</ul> |
||||||
|
</div> |
||||||
|
<div class="soft-man-con viewOne" style="display: none;"> |
||||||
|
<p class="status">当前状态: |
||||||
|
<span>开启</span> |
||||||
|
<span style="color: #20a53a; margin-left: 3px;" class="glyphicon glyphicon glyphicon-play"></span> |
||||||
|
<span style="color: red; margin-left: 3px; display: none" class="glyphicon glyphicon-pause"></span> |
||||||
|
</p> |
||||||
|
<div class="sfm-opt"> |
||||||
|
<button class="btn btn-default btn-sm bts-danger" onclick="sagelogin.Panel_Admin()">清除面板登录限制IP</button> |
||||||
|
<button class="btn btn-default btn-sm bts-safety" onclick="sagelogin.Add_view('面板白名单',true)">添加白名单</button> |
||||||
|
</div> |
||||||
|
<div class="whiteList-table divtable" style="overflow-x: hidden;height: 420px"> |
||||||
|
<table class="table table-hover" style="max-height: 380px; overflow: auto;"> |
||||||
|
<thead> |
||||||
|
<tr> |
||||||
|
<th>IP地址</th> |
||||||
|
<th style="text-align: right;">操作</th> |
||||||
|
</tr> |
||||||
|
</thead> |
||||||
|
<tbody id="whiteListOne"></tbody> |
||||||
|
</table> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
<div class="soft-man-con viewTwo" style="display: none"> |
||||||
|
<div class="whiteList-table divtable"> |
||||||
|
<table class="table table-hover" style=" max-height: 380px; overflow: auto;"> |
||||||
|
<thead> |
||||||
|
<tr> |
||||||
|
<th>操作记录</th> |
||||||
|
<th>操作时间</th> |
||||||
|
</tr> |
||||||
|
</thead> |
||||||
|
<tbody id="whiteListTwo"></tbody> |
||||||
|
</table> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
<div class="soft-man-con viewThree" style="display: none"> |
||||||
|
<p class="status">当前状态: |
||||||
|
<span>开启</span> |
||||||
|
<span style="color: #20a53a; margin-left: 3px;" class="glyphicon glyphicon glyphicon-play"> |
||||||
|
</span> |
||||||
|
<span style="color: red; margin-left: 3px; display: none" class="glyphicon glyphicon-pause"></span> |
||||||
|
</p> |
||||||
|
<div class="sfm-opt"> |
||||||
|
<button class="btn btn-default btn-sm bts-danger" onclick="sagelogin.Panel_Admin()">清除SSH登录限制IP</button> |
||||||
|
<button class="btn btn-default btn-sm bts-safety" onclick="sagelogin.Add_view('SSH白名单',false)">添加白名单</button> |
||||||
|
</div> |
||||||
|
<div class="whiteList-table divtable" style="overflow-x: hidden;height: 420px"> |
||||||
|
<table class="table table-hover" style="max-height: 380px; overflow: auto;"> |
||||||
|
<thead> |
||||||
|
<tr> |
||||||
|
<th>IP地址</th> |
||||||
|
<th style="text-align: right;">操作</th> |
||||||
|
</tr> |
||||||
|
</thead> |
||||||
|
<tbody id="whiteListThree"></tbody> |
||||||
|
</table> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
<div class="soft-man-con viewFour" style="display: none"> |
||||||
|
<div class="btnclick"> |
||||||
|
<label class="btnTitle">日志分类</label> |
||||||
|
<div class="btn-group"> |
||||||
|
<input type="submit" name="btnOne" class="btn btn-success" onclick="sagelogin.SSH_Defense_List(0)" value="已防御" /> |
||||||
|
<input type="submit" name="btnTwo" class="btn btn-default" onclick="sagelogin.SSH_Defense_List(1)" value="入侵日志"/> |
||||||
|
<input type="submit" name="btnThree" class="btn btn-default" onclick="sagelogin.SSH_Defense_List(2)" value="登录日志"/> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
<div class="whiteList-table divtable" style="overflow-x: hidden;height: 470px;"> |
||||||
|
<table class="table table-hover" style="max-height: 380px; overflow: auto;"> |
||||||
|
<thead> |
||||||
|
<tr> |
||||||
|
<th>源IP地址</th> |
||||||
|
<th>用户</th> |
||||||
|
<th style="text-align: right;">登录时间</th> |
||||||
|
</tr> |
||||||
|
</thead> |
||||||
|
<tbody id="whiteListFour"></tbody> |
||||||
|
</table> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
<script type="javascript/text"> |
||||||
|
//宝塔安全登录 |
||||||
|
$(function(){ |
||||||
|
$(".bt-w-menu p").click(function(){ |
||||||
|
$(this).addClass("bgw").siblings().removeClass("bgw"); |
||||||
|
$('.bt-w-con .soft-man-con').hide().eq($(this).index()).show(); |
||||||
|
switch($(this).index()) { |
||||||
|
case 0: |
||||||
|
break; |
||||||
|
case 1: |
||||||
|
sagelogin.Panel_White_List(); |
||||||
|
break; |
||||||
|
case 2: |
||||||
|
sagelogin.Panel_journal(); |
||||||
|
break; |
||||||
|
case 3: |
||||||
|
sagelogin.SSH_White_List(); |
||||||
|
break; |
||||||
|
case 4: |
||||||
|
sagelogin.SSH_Defense_List(0); |
||||||
|
break; |
||||||
|
} |
||||||
|
}); |
||||||
|
layer.load(); |
||||||
|
$.get('/plugin?action=a&name=safelogin&s=GetServerInfo',function(data) { |
||||||
|
layer.closeAll('loading'); |
||||||
|
if (data.status) { |
||||||
|
$('.boxshow').hide(); |
||||||
|
$('.maks').hide(); |
||||||
|
}else{ |
||||||
|
$('.boxshow').show(); |
||||||
|
$('.maks').show(); |
||||||
|
} |
||||||
|
}); |
||||||
|
}); |
||||||
|
var sagelogin = new Object(); |
||||||
|
sagelogin = { |
||||||
|
Addview:'', |
||||||
|
SSHlogList:'', |
||||||
|
PanelLogList:'', |
||||||
|
// SSH管理 |
||||||
|
SSH_Admin:function(){ |
||||||
|
var confirm = layer.confirm('确定清除面板登录限制IP地址?',{icon: 1}, { |
||||||
|
btn: ['确认','取消'], |
||||||
|
}, function(){ |
||||||
|
$.get('/plugin?action=a&name=safelogin&s=close_ssh_limit',function(data) { |
||||||
|
if (data.status) { |
||||||
|
layer.msg(data.msg,{icon:1}); |
||||||
|
sagelogin.SSH_White_List(); |
||||||
|
}else{ |
||||||
|
layer.msg(data.msg,{icon:2}); |
||||||
|
} |
||||||
|
}); |
||||||
|
}, function(){ |
||||||
|
layer.close(confirm); |
||||||
|
}); |
||||||
|
}, |
||||||
|
tokenShow:function(){ |
||||||
|
var inputPwd = layer.open({ |
||||||
|
type: 1, |
||||||
|
title: '验证面板密码', |
||||||
|
shadeClose: true, |
||||||
|
shade: 0.3, |
||||||
|
area: ['380px', '190px'], |
||||||
|
btn:['确定','取消'], |
||||||
|
content:'<div class="Add_view" style="height:90px"><label>面板密码:</label><input name="panel_pwd" class=" bt-input-text" type="password"></div>', |
||||||
|
yes:function(){ |
||||||
|
var passwordStr = $("input[name='panel_pwd']").val(); |
||||||
|
var index = layer.load(0, {shade: false}); |
||||||
|
$.post('/plugin?action=a&name=safelogin&s=GetServerToken',{password:passwordStr},function(token) { |
||||||
|
layer.close(index); |
||||||
|
if(token.status === false){ |
||||||
|
layer.msg(token.msg,{icon:2}); |
||||||
|
return; |
||||||
|
} |
||||||
|
layer.close(inputPwd); |
||||||
|
$("textarea[name='token']").val(token); |
||||||
|
}); |
||||||
|
}, |
||||||
|
btn2:function(){ |
||||||
|
layer.close(inputPwd); |
||||||
|
} |
||||||
|
}); |
||||||
|
}, |
||||||
|
// SSH白名单——列表 |
||||||
|
SSH_White_List:function(){ |
||||||
|
var index = layer.load(0, {shade: false}); |
||||||
|
$.get('/plugin?action=a&name=safelogin&s=get_ssh_limit','',function(data){ |
||||||
|
$('#whiteListThree').empty(); |
||||||
|
var List = ''; |
||||||
|
if (data.length == 0){ |
||||||
|
$('.viewThree .status span:eq(0)').html('关闭'); |
||||||
|
$('.viewThree .glyphicon-pause').show(); |
||||||
|
$('.viewThree .glyphicon-play').hide(); |
||||||
|
}else { |
||||||
|
$('.viewThree .status span:eq(0)').html('开启'); |
||||||
|
$('.viewThree .glyphicon-pause').hide(); |
||||||
|
$('.viewThree .glyphicon-play').show(); |
||||||
|
} |
||||||
|
for (var i = 0; i < data.length; i++) { |
||||||
|
List = List + '<tr><td>'+ data[i] +'</td><td style="text-align:right;"><a href="javascript:;" ip-val="'+ data[i] +'" onclick="sagelogin.SSH_Del_White_List(event)" style="color:red">删除</a></td></tr>' |
||||||
|
} |
||||||
|
$('#whiteListThree').append(List); |
||||||
|
layer.close(index); |
||||||
|
}); |
||||||
|
}, |
||||||
|
// SSH白名单——删除 |
||||||
|
SSH_Del_White_List:function(ev){ |
||||||
|
var ip = ev.currentTarget.getAttribute('ip-val'); |
||||||
|
var confirm = layer.confirm('确定删除IP['+ ip +']限制地址?', { |
||||||
|
btn: ['确认','取消'] //按钮 |
||||||
|
}, function(){ |
||||||
|
$.get('/plugin?action=a&name=safelogin&s=remove_ssh_limit',{ip:ip},function(data){ |
||||||
|
if (data.status) { |
||||||
|
sagelogin.SSH_White_List(); |
||||||
|
layer.msg(data.msg,{icon:1}); |
||||||
|
}else { |
||||||
|
layer.msg(data.msg,{icon:2}); |
||||||
|
} |
||||||
|
}); |
||||||
|
}, function(){ |
||||||
|
layer.close(confirm); |
||||||
|
}); |
||||||
|
}, |
||||||
|
// SSH白名单——添加 |
||||||
|
SSH_Add_White_List:function(ip){ |
||||||
|
$.post('/plugin?action=a&name=safelogin&s=add_ssh_limit',{ip:ip},function(data){ |
||||||
|
layer.close(sagelogin.Addview); |
||||||
|
if (data.status) { |
||||||
|
sagelogin.SSH_White_List(); |
||||||
|
layer.msg(data.msg,{icon:1}); |
||||||
|
}else{ |
||||||
|
layer.msg(data.msg,{icon:2}); |
||||||
|
} |
||||||
|
}); |
||||||
|
}, |
||||||
|
// SSH日志管理 |
||||||
|
SSH_Defense_List:function(status){ |
||||||
|
$('.btnclick input').removeClass('btn-success').addClass('btn-default'); |
||||||
|
$('.btnclick input').eq(status).addClass('btn-success').removeClass('btn-default'); |
||||||
|
if (sagelogin.SSHlogList == '') { |
||||||
|
$.get('/plugin?action=a&s=get_ssh_errorlogin&name=safelogin',function(data){ |
||||||
|
sagelogin.SSHlogList = data; |
||||||
|
sagelogin.DefenseFor(sagelogin.SSHlogList.defense); |
||||||
|
}); |
||||||
|
}else{ |
||||||
|
switch(status) { |
||||||
|
case 0: |
||||||
|
sagelogin.DefenseFor(sagelogin.SSHlogList.defense); |
||||||
|
break; |
||||||
|
case 1: |
||||||
|
sagelogin.DefenseFor(sagelogin.SSHlogList.intrusion); |
||||||
|
break; |
||||||
|
case 2: |
||||||
|
sagelogin.DefenseFor(sagelogin.SSHlogList.success); |
||||||
|
break; |
||||||
|
} |
||||||
|
} |
||||||
|
}, |
||||||
|
// SSH日志渲染模板 |
||||||
|
DefenseFor:function(data){ |
||||||
|
var List = ''; |
||||||
|
$('#whiteListFour').empty(); |
||||||
|
for (var i = data.length - 1; i >= 0; i--) { |
||||||
|
List = List + '<tr><td>'+data[i].address+'</td><td>' + data[i].user + '</td><td style="text-align:right">'+ data[i].date+'</td></tr>' |
||||||
|
} |
||||||
|
$('#whiteListFour').append(List); |
||||||
|
}, |
||||||
|
// 面板管理 |
||||||
|
Panel_Admin:function(){ |
||||||
|
var confirm = layer.confirm('确定清除面板登录限制IP地址?', { |
||||||
|
btn: ['确认','取消'] //按钮 |
||||||
|
}, function(){ |
||||||
|
$.get('/plugin?action=a&name=safelogin&s=close_panel_limit',function(data) { |
||||||
|
if (data.status) { |
||||||
|
layer.msg(data.msg,{icon:1}); |
||||||
|
sagelogin.Panel_White_List(); |
||||||
|
}else{ |
||||||
|
layer.msg(data.msg,{icon:2}); |
||||||
|
} |
||||||
|
}); |
||||||
|
}, function(){ |
||||||
|
layer.close(confirm); |
||||||
|
}); |
||||||
|
|
||||||
|
}, |
||||||
|
// 面板白名单——列表 |
||||||
|
Panel_White_List:function(){ |
||||||
|
$.get('/plugin?action=a&name=safelogin&s=get_panel_limit','',function(data){ |
||||||
|
$('#whiteListOne').empty(); |
||||||
|
var List = ''; |
||||||
|
if (data.length == 0){ |
||||||
|
$('.viewOne .status span:eq(0)').html('关闭'); |
||||||
|
$('.viewOne .glyphicon-pause').show(); |
||||||
|
$('.viewOne .glyphicon-play').hide(); |
||||||
|
}else { |
||||||
|
$('.viewOne .status span:eq(0)').html('开启'); |
||||||
|
$('.viewOne .glyphicon-pause').hide(); |
||||||
|
$('.viewOne .glyphicon-play').show(); |
||||||
|
} |
||||||
|
for (var i = 0; i < data.length; i++) { |
||||||
|
List = List + '<tr><td>'+ data[i] +'</td><td style="text-align:right;"><a href="javascript:;" ip-val="'+ data[i] +'" onclick="sagelogin.Panel_Del_White_List(event)" style="color:red">删除</a></td></tr>' |
||||||
|
} |
||||||
|
$('#whiteListOne').append(List); |
||||||
|
}); |
||||||
|
}, |
||||||
|
// 面板白名单——删除 |
||||||
|
Panel_Del_White_List:function(ev){ |
||||||
|
var ip = ev.currentTarget.getAttribute('ip-val'); |
||||||
|
var confirm = layer.confirm('确定删除IP['+ ip +']限制地址?', { |
||||||
|
btn: ['确认','取消'] //按钮 |
||||||
|
}, function(){ |
||||||
|
$.get('/plugin?action=a&name=safelogin&s=remove_ssh_limit',{ip:ip},function(data){ |
||||||
|
if (data.status) { |
||||||
|
sagelogin.Panel_White_List(); |
||||||
|
layer.msg(data.msg,{icon:1}); |
||||||
|
}else { |
||||||
|
layer.msg(data.msg,{icon:2}); |
||||||
|
} |
||||||
|
}); |
||||||
|
}, function(){ |
||||||
|
layer.close(confirm); |
||||||
|
}); |
||||||
|
}, |
||||||
|
// 面板白名单——添加 |
||||||
|
Panel_Add_White_List:function(ip){ |
||||||
|
$.post('/plugin?action=a&name=safelogin&s=add_panel_limit', {ip: ip}, function(data) { |
||||||
|
layer.close(sagelogin.Addview); |
||||||
|
if (data.status) { |
||||||
|
sagelogin.Panel_White_List(); |
||||||
|
layer.msg(data.msg,{icon:1}); |
||||||
|
}else{ |
||||||
|
layer.msg(data.msg,{icon:2}); |
||||||
|
} |
||||||
|
}); |
||||||
|
}, |
||||||
|
// 面板日志——列表 |
||||||
|
Panel_journal:function(){ |
||||||
|
var index = layer.load(0, {shade: false}); |
||||||
|
$.get('/plugin?action=a&name=safelogin&s=get_login_log',function(data){ |
||||||
|
$('#whiteListTwo').empty(); |
||||||
|
var List = ''; |
||||||
|
sagelogin.PanelLogList = data; |
||||||
|
for (var i = sagelogin.PanelLogList.length - 1; i >= 0; i--) { |
||||||
|
List = List + '<tr><td>'+ sagelogin.PanelLogList[i].log +'</td><td style="text-align:right;">'+ sagelogin.PanelLogList[i].addtime +'</tr>'; |
||||||
|
} |
||||||
|
$('#whiteListTwo').append(List); |
||||||
|
layer.close(index); |
||||||
|
}); |
||||||
|
}, |
||||||
|
// IP正则:192.168.1.0/24 |
||||||
|
CheckIP:function(ip) { |
||||||
|
var reg = /^(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])(\/\d{1,2})?$/; |
||||||
|
return reg.test(ip); |
||||||
|
}, |
||||||
|
CheckIPTwo:function(ip) { |
||||||
|
var reg = /^([1-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])(\.([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])){3}$/gi; |
||||||
|
return reg.test(ip); |
||||||
|
}, |
||||||
|
// 添加表单效验 |
||||||
|
addViewVul:function(status){ |
||||||
|
var ip = $('.addViewVul'); |
||||||
|
if (status) { |
||||||
|
console.log(sagelogin.CheckIP(ip.val())); |
||||||
|
if(sagelogin.CheckIPTwo(ip.val())){ |
||||||
|
ip.addClass('correct').removeClass('error'); |
||||||
|
return true; |
||||||
|
}else { |
||||||
|
ip.addClass('error').removeClass('correct'); |
||||||
|
return false; |
||||||
|
} |
||||||
|
}else{ |
||||||
|
|
||||||
|
if(sagelogin.CheckIP(ip.val())){ |
||||||
|
ip.addClass('correct').removeClass('error'); |
||||||
|
return true; |
||||||
|
}else { |
||||||
|
ip.addClass('error').removeClass('correct'); |
||||||
|
return false; |
||||||
|
} |
||||||
|
} |
||||||
|
}, |
||||||
|
// 添加界面 |
||||||
|
Add_view:function(title,status){ |
||||||
|
var _this = this; |
||||||
|
var text = '' |
||||||
|
var statuss = true; |
||||||
|
if (status) { |
||||||
|
text = ''; |
||||||
|
statuss = true; |
||||||
|
}else{ |
||||||
|
text = '<p style="color:red;margin: 5px 0px 0px 67px;font-size: 14px;">支持IP段,如:192.168.1.0/24</p>'; |
||||||
|
statuss = false; |
||||||
|
} |
||||||
|
sagelogin.Addview = layer.open({ |
||||||
|
type: 1, |
||||||
|
title: title, |
||||||
|
shadeClose: true, |
||||||
|
shade: 0.1, |
||||||
|
area: ['380px', '200px'], |
||||||
|
btn:['确定','取消'], |
||||||
|
content:'<div class="Add_view"><label>IP地址:</label><input class="addViewVul bt-input-text" onchange="sagelogin.addViewVul('+ statuss +')" type="text">'+ text +'</div>', |
||||||
|
yes:function(){ |
||||||
|
if (sagelogin.addViewVul(statuss)) { |
||||||
|
if(status){ |
||||||
|
sagelogin.Panel_Add_White_List($('.addViewVul').val()); |
||||||
|
}else{ |
||||||
|
sagelogin.SSH_Add_White_List($('.addViewVul').val()); |
||||||
|
} |
||||||
|
}else{ |
||||||
|
layer.msg('请输入合法的IP地址',{icon:2}) |
||||||
|
} |
||||||
|
}, |
||||||
|
btn2:function(){ |
||||||
|
layer.close(sagelogin.Addview); |
||||||
|
} |
||||||
|
}); |
||||||
|
$('.addViewVul').focus(); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
</script> |
@ -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 |
||||||
|
} |
@ -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 |
@ -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); |
||||||
|
|
||||||
|
|
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 874 B |
After Width: | Height: | Size: 683 B |
After Width: | Height: | Size: 2.9 KiB |
After Width: | Height: | Size: 3.9 KiB |
@ -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 |
||||||
|
} |
@ -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 |
@ -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); |
||||||
|
|
@ -0,0 +1,129 @@ |
|||||||
|
#include <stdio.h> |
||||||
|
#include <pthread.h> |
||||||
|
#include <unistd.h> |
||||||
|
#include <time.h> |
||||||
|
|
||||||
|
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<count;i++){ |
||||||
|
switch(type){ |
||||||
|
case 1: |
||||||
|
pthread_create(&tid,NULL,(void *) thread_int,NULL); |
||||||
|
break; |
||||||
|
case 2: |
||||||
|
pthread_create(&tid,NULL,(void *) thread_float,NULL); |
||||||
|
break; |
||||||
|
case 3: |
||||||
|
pthread_create(&tid,NULL,(void *) thread_pi,NULL); |
||||||
|
break; |
||||||
|
case 4: |
||||||
|
pthread_create(&tid,NULL,(void *) thread_qsort,NULL); |
||||||
|
break; |
||||||
|
default: |
||||||
|
pthread_create(&tid,NULL,(void *) thread,NULL); |
||||||
|
break; |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
while(thread_count != count){ |
||||||
|
sleep(0.1); |
||||||
|
} |
||||||
|
return 0; |
||||||
|
} |
||||||
|
|
||||||
|
void thread(void){ |
||||||
|
int_comp(); |
||||||
|
float_comp(); |
||||||
|
pi_comp(); |
||||||
|
qsort_comp(); |
||||||
|
thread_count++; |
||||||
|
} |
||||||
|
|
||||||
|
void thread_int(void){ |
||||||
|
int_comp(); |
||||||
|
thread_count++; |
||||||
|
} |
||||||
|
|
||||||
|
void thread_float(void){ |
||||||
|
float_comp(); |
||||||
|
thread_count++; |
||||||
|
} |
||||||
|
|
||||||
|
void thread_pi(void){ |
||||||
|
pi_comp(); |
||||||
|
thread_count++; |
||||||
|
} |
||||||
|
|
||||||
|
void thread_qsort(void){ |
||||||
|
qsort_comp(); |
||||||
|
thread_count++; |
||||||
|
} |
||||||
|
|
||||||
|
void int_comp(void){ |
||||||
|
int i,j; |
||||||
|
for(i=0;i<N_int;i++) |
||||||
|
for(j=0;j<N_float;j++); |
||||||
|
} |
||||||
|
|
||||||
|
void float_comp(void){ |
||||||
|
float i,j; |
||||||
|
for(i=0;i<N_int;i++) |
||||||
|
for(j=0;j<N_float;j++); |
||||||
|
} |
||||||
|
|
||||||
|
void pi_comp(void){ |
||||||
|
int m,i=1; |
||||||
|
double s=0; |
||||||
|
for(m=1;m<N_pi;m+=2){ |
||||||
|
s+=i*(1.0/m); |
||||||
|
i=-i; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
void to_qsort(int arr[],int low,int high){ |
||||||
|
if(low>=high) return; |
||||||
|
int first=low; |
||||||
|
int last=high; |
||||||
|
int key=arr[first]; |
||||||
|
while(first<last){ |
||||||
|
while(first<last&&arr[last]>=key) --last; |
||||||
|
arr[first]=arr[last]; |
||||||
|
while(first<last&&arr[first]<=key) ++first; |
||||||
|
arr[last]=arr[first]; |
||||||
|
} |
||||||
|
arr[first]=key; |
||||||
|
to_qsort(arr,low,first-1); |
||||||
|
to_qsort(arr,first+1,high); |
||||||
|
} |
||||||
|
|
||||||
|
void qsort_comp(void){ |
||||||
|
int arr[N_qsort],i; |
||||||
|
for(i=N_qsort;i>0;i--) arr[N_qsort-1]=i; |
||||||
|
to_qsort(arr,0,N_qsort-1); |
||||||
|
} |