pull/109/head
midoks 7 years ago
parent 7dfd820329
commit bade1c5018
  1. 4
      app.py
  2. 443
      data/list.json
  3. 5
      data/type.json
  4. BIN
      plugins/vpn/icon.png
  5. 550
      plugins/vpn/index.html
  6. 15
      plugins/vpn/info.json
  7. 40
      plugins/vpn/install.sh
  8. BIN
      static/img/soft_ico/ico-vpn.png
  9. 76
      static/js/soft.js
  10. 51
      templates/default/layout.html
  11. 15
      templates/default/soft.html
  12. 14
      views/plugins.py

@ -21,6 +21,10 @@ DEFAULT_MODULES = (
(views.task, "/task"),
)
import time
print "time.time(): %f " % time.time()
app.config.version = "0.0.1" + str(time.time())
def setting_modules(app, modules):
for module, url_prefix in modules:

@ -1,443 +0,0 @@
[
{
"sort": 1,
"ps": "轻量级,占有内存少,并发能力强",
"shell": "nginx.sh",
"name": "nginx",
"title": "Nginx",
"default": false,
"pid": 1,
"versions": "1.12,1.8,-Tengine2.2,openresty",
"update":"1.12.2,1.8.1,-Tengine2.2.1,openresty",
"tip": "soft",
"checks": "/www/server/nginx/sbin/nginx",
"display": 1,
"author": "nginx.org",
"date": "2017-04-01",
"home": "https://www.nginx.org",
"type": "Web服务器",
"id": 1
},
{
"sort": 2,
"ps": " 世界排名第一,快速、可靠并且可通过简单的API扩充",
"shell": "httpd.sh",
"name": "apache",
"title": "Apache",
"default": false,
"pid": 2,
"versions": "2.4,2.2",
"update":"2.4.29,2.2.32",
"tip": "soft",
"checks": "/www/server/apache/bin/httpd",
"display": 1,
"author": "APACHE",
"date": "2017-04-01",
"home": "http://www.apache.org",
"type": "Web服务器",
"id": 1
},
{
"sort": 3,
"ps": "MySQL是一种关系数据库管理系统!",
"shell": "mysql.sh",
"name": "mysql",
"title": "MySQL",
"default": false,
"pid": 3,
"versions": "5.1,5.5,5.6,5.7,AliSQL,mariadb_10.0,mariadb_10.1",
"update":"5.1.73,5.5.58,5.6.38,5.7.20,AliSQL 5.6.32,mariadb_10.0.31,mariadb_10.1.28",
"tip": "soft",
"checks": "/www/server/mysql/bin/mysql,/www/server/mysql/bin/mysqldump",
"display": 1,
"author": "Oracle",
"date": "2017-04-01",
"home": "https://www.mysql.com",
"type": "SQL数据库",
"id": 1
},
{
"sort": 4,
"ps": "PureFTPd是一款专注于程序健壮和软件安全的免费FTP服务器软件",
"shell": "pure-ftpd.sh",
"name": "pure-ftpd",
"title": "Pure-Ftpd",
"default": false,
"pid": 4,
"versions": "1.0.47",
"update": "1.0.47",
"tip": "soft",
"checks": "/www/server/pure-ftpd/bin/pure-pw",
"display": 1,
"author": "Pure-Ftpd",
"date": "2017-04-01",
"home": "https://www.pureftpd.org",
"type": "FTP服务器",
"id": 1
},
{
"sort": 5,
"ps": "开发和调试JSP程序的首选",
"shell": "tomcat.sh",
"name": "tomcat",
"title": "Tomcat",
"default": false,
"pid": 5,
"versions": "7,8,9",
"update": "7.0.76,8.5.12,9.0.0.M18",
"tip": "soft",
"checks": "/www/server/tomcat/bin/catalina.sh",
"display": 1,
"author": "APACHE",
"date": "2017-04-01",
"home": "https://www.apache.org",
"type": "语言解释器",
"id": 1
},
{
"sort": 6,
"ps": "Web端MySQL管理工具",
"shell": "phpmyadmin.sh",
"name": "phpmyadmin",
"title": "phpMyAdmin",
"default": false,
"pid": 6,
"versions": "4.0,4.4,4.6,4.7",
"update": "4.0,4.4,4.6,4.7",
"tip": "soft",
"checks": "/www/server/phpmyadmin/version.pl",
"display": 1,
"author": "phpMyAdmin",
"date": "2017-04-01",
"home": "https://www.phpmyadmin.net",
"type": "数据库工具",
"id": 2
},
{
"sort": 7,
"ps": "PHP是世界上最好的编程语言",
"shell": "php.sh",
"name": "php",
"title": "PHP",
"default": false,
"pid": 7,
"versions": "5.2,5.3,5.4,5.5,5.6,7.0,7.1,7.2",
"update": "5.2.17p1,5.3.29,5.4.45,5.5.38,5.6.32,7.0.26,7.1.12,7.2.0",
"tip": "soft",
"checks": "/www/server/php/VERSION/bin/php",
"display": 1,
"author": "Zend",
"date": "2017-04-01",
"home": "https://www.php.net",
"type": "语言解释器",
"id": 1
},
{
"sort": 8,
"ps": "快速部署常用程序!",
"shell": "deployment.sh",
"name": "deployment",
"title": "宝塔一键部署源码",
"default": false,
"pid": 18,
"versions": "1.0",
"tip": "lib",
"checks": "/www/server/panel/plugin/deployment",
"display": 1,
"author": "宝塔",
"date": "2017-07-26",
"home": "http://www.bt.cn/bbs",
"type": "扩展",
"id": 3
},
{
"pid":9,
"title":"宝塔运维",
"tip":"lib",
"name":"btyw",
"type":"插件",
"id":3,
"sort":9,
"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":1
},
{
"pid":24,
"title":"宝塔安全登陆",
"tip":"lib",
"name":"safelogin",
"type":"插件",
"id":3,
"sort":9,
"ps":"宝塔企业版安全登陆插件。",
"versions":"1.1",
"shell":"safelogin.sh",
"checks":"/www/server/panel/plugin/safelogin",
"author":"宝塔",
"home":"https://www.bt.cn/yunwei",
"date":"2017-10-18",
"default":false,
"display":1
},
{
"sort":10,
"title":"又拍云存储",
"tip":"lib",
"name":"upyun",
"type":"扩展",
"ps":"又拍云对象存储,宝塔用户首月免费200G流量+首次充值9折优惠<a href='https://console.upyun.com/register/?invite=B1bZJtIYb' target='_blank' class='btlink'> [点击申请]</a>",
"versions":"1.1",
"shell":"upyun.sh",
"pid": 18,
"checks":"/www/server/panel/plugin/upyun",
"author":"宝塔",
"home":"http://www.bt.cn/bbs",
"date":"2017-09-16",
"default":false,
"display":0,
"id":2
},
{
"sort": 11,
"ps": "将网站或数据库打包备份到FTP存储空间.",
"shell": "ftp.sh",
"name": "ftp",
"title": "FTP存储空间",
"default": false,
"pid": 10,
"versions": "1.6",
"tip": "lib",
"checks": "/www/server/panel/plugin/ftp",
"display": 1,
"author": "宝塔",
"date": "2017-02-03",
"home": "http://www.bt.cn/bbs",
"type": "计划任务",
"id": 2
},
{
"sort": 12,
"ps": "申请内测资格,审核完成后将会获得内测版本更新推送,并可在宝塔论坛内测专用版块参与讨论",
"shell": "beta.sh",
"name": "beta",
"title": "申请内测",
"default": false,
"pid": 11,
"versions": "1.2",
"tip": "lib",
"checks": "/www/server/panel/data/beta.pl,/www/server/panel/plugin/beta/config.conf",
"display": 1,
"author": "宝塔",
"date": "2017-02-01",
"home": "http://www.bt.cn/bbs/thread-1392-1-1.html",
"type": "其它",
"id": 3
},
{
"sort": 13,
"ps": "监控PHP-FPM运行状态,防止大批量出现502错误!",
"shell": "phpguard.sh",
"name": "phpguard",
"title": "PHP守护",
"default": false,
"pid": 12,
"versions": "1.2",
"tip": "lib",
"checks": "/www/server/panel/data/502Task.pl,/www/server/panel/plugin/phpguard",
"display": 1,
"author": "宝塔",
"date": "2017-02-01",
"home": "http://www.bt.cn/bbs",
"type": "其它",
"id": 3
},
{
"sort": 14,
"ps": "测试服务器基础性能!",
"shell": "score.sh",
"name": "score",
"title": "宝塔跑分",
"default": false,
"pid": 13,
"versions": "1.3",
"tip": "lib",
"checks": "/www/server/panel/plugin/score",
"display": 1,
"author": "宝塔",
"date": "2017-05-10",
"home": "http://www.bt.cn/bbs",
"type": "其它",
"id": 3
},
{
"sort": 15,
"ps": "Linux系统工具,配置DNS、Swap、时区!",
"shell": "linuxsys.sh",
"name": "linuxsys",
"title": "Linux工具箱",
"default": false,
"pid": 14,
"versions": "1.1",
"tip": "lib",
"checks": "/www/server/panel/plugin/linuxsys",
"display": 1,
"author": "宝塔",
"date": "2017-05-15",
"home": "http://www.bt.cn/bbs",
"type": "系统工具",
"id": 2
},
{
"sort": 16,
"ps": "Redis 是一个高性能的key-value数据库(要使用PHP连接redis,需在PHP设置中安装redis扩展)",
"shell": "redis_soft.sh",
"name": "redis",
"title": "Redis",
"default": false,
"pid": 15,
"versions": "4.0",
"update": "4.0.2",
"tip": "soft",
"checks": "/www/server/redis/runtest",
"display": 0,
"author": "redis",
"date": "2017-06-21",
"home": "https://redis.io",
"type": "通用缓存器",
"id": 1
},
{
"sort": 17,
"ps": "Memcached 是一个高性能的分布式内存对象缓存系统",
"shell": "memcached_soft.sh",
"name": "memcached",
"title": "Memcached",
"default": false,
"pid": 16,
"versions": "1.5",
"update": "1.5.0",
"tip": "soft",
"checks": "/usr/local/memcached/bin/memcached",
"display": 1,
"author": "Memcached",
"date": "2017-06-21",
"home": "http://memcached.org/",
"type": "通用缓存器",
"id": 1
},
{
"sort": 18,
"ps": "WebHook,可设置回调脚本,通常用于第三方回调通知!",
"shell": "webhook.sh",
"name": "webhook",
"title": "宝塔WebHook",
"default": false,
"pid": 17,
"versions": "1.0",
"tip": "lib",
"checks": "/www/server/panel/plugin/webhook",
"display": 0,
"author": "宝塔",
"date": "2017-07-12",
"home": "https://www.bt.cn/bbs",
"type": "扩展",
"id": 3
},
{
"sort": 19,
"ps": "GitLab中文社区版,当前只支持Centos6/7 64位系统,内存小于2GB的机器请勿安装!",
"shell": "gitlab.sh",
"name": "gitlab",
"title": "GitLab",
"default": false,
"pid": 19,
"versions": "8.8.5",
"tip": "soft",
"checks": "/opt/gitlab/embedded/service/gitlab-rails/Gemfile",
"display": 0,
"author": "宝塔",
"date": "2017-08-07",
"home": "http://www.bt.cn/bbs",
"type": "通用软件",
"id": 1
},
{
"sort": 20,
"ps": "快速迁移面板数据!",
"shell": "psync.sh",
"name": "psync",
"title": "宝塔一键迁移",
"default": false,
"pid": 20,
"versions": "1.1",
"tip": "lib",
"checks": "/www/server/panel/plugin/psync/psync_main.py",
"display": 0,
"author": "宝塔",
"date": "2017-08-16",
"home": "http://www.bt.cn/bbs",
"type": "系统工具",
"id": 3
},
{
"sort": 6,
"ps": "node.js管理器,内置 node.js + npm + nvm + pm2.!",
"shell": "pm2.sh",
"name": "pm2",
"title": "PM2管理器",
"default": false,
"pid": 21,
"versions": "2.6.1",
"tip": "soft",
"checks": "/www/server/panel/plugin/pm2/pm2_main.py",
"display": 0,
"author": "宝塔",
"date": "2017-09-12",
"home": "http://www.bt.cn/bbs",
"type": "集成环境",
"id": 1
},
{
"sort": 21,
"ps": "将网站或数据库打包备份到七牛对象存储空间,七牛提供10GB免费存储空间, <a class='link' href='https://portal.qiniu.com/signup?code=3liz7nbopjd5e' target='_blank'>点击申请</a>",
"shell": "qiniu.sh",
"name": "qiniu",
"title": "七牛云存储",
"default": false,
"pid": 22,
"versions": "1.5",
"tip": "lib",
"checks": "/usr/lib/python2.6/site-packages/qiniu/auth.py,/usr/local/lib/python2.6/dist-packages/qiniu/auth.py,/usr/lib/python2.7/site-packages/qiniu/auth.py,/usr/local/lib/python2.7/dist-packages/qiniu/auth.py",
"display": 0,
"author": "宝塔",
"date": "2017-02-01",
"home": "http://www.bt.cn/bbs/thread-839-1-1.html",
"type": "计划任务",
"id": 2
},
{
"sort": 22,
"ps": "将网站或数据库打包备份到阿里云OSS对象存储空间, <a class='link' href='https://www.aliyun.com/product/oss?spm=5176.8142029.388261.46.psCRgl' target='_blank'>点击申请</a>",
"shell": "alioss.sh",
"name": "alioss",
"title": "阿里云OSS",
"default": false,
"pid": 23,
"versions": "1.2",
"tip": "lib",
"checks": "/usr/lib/python2.6/site-packages/oss2/auth.py,/usr/local/lib/python2.6/dist-packages/oss2/auth.py,/usr/lib/python2.7/site-packages/oss2/auth.py,/usr/local/lib/python2.7/dist-packages/oss2/auth.py",
"display": 0,
"author": "宝塔",
"date": "2017-02-02",
"home": "http://www.bt.cn/bbs/thread-1061-1-1.html",
"type": "计划任务",
"id": 2
}
]

@ -13,5 +13,10 @@
"title":"系统工具",
"type":2,
"ps":""
},
{
"title":"其他插件",
"type":3,
"ps":""
}
]

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

@ -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":"VPN",
"tip":"lib",
"name":"VPN",
"type":"其他插件",
"ps":"科学上网",
"versions":"1.3",
"shell":"install.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

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

@ -1741,49 +1741,6 @@ function SetPluginConfig(name, param, def) {
}
//取七牛文件列表
function GetFileList(name) {
var loadT = layer.msg(lan.soft.qiniu_lise, { icon: 16, time: 0, shade: [0.3, '#000'] });
$.get('/ajax?action=GetQiniuFileList&name=' + name, function(rdata) {
layer.close(loadT);
if (rdata.status === false) {
layer.msg(rdata.msg, { icon: 2 });
return;
}
var tBody = ''
for (var i = 0; i < rdata.length; i++) {
tBody += "<tr>\
<td>" + rdata[i].key + "</td>\
<td>" + rdata[i].mimeType + "</td>\
<td>" + ToSize(rdata[i].fsize) + "</td>\
<td>" + getLocalTime(rdata[i].putTime) + "</td>\
</tr>"
}
layer.open({
type: 1,
skin: 'demo-class',
area: '700px',
title: lan.soft.qiniu_file_title,
closeBtn: 2,
shift: 0,
content: "<div class='divtable' style='margin:17px'>\
<table width='100%' class='table table-hover'>\
<thead>\
<tr>\
<th>" + lan.soft.qiniu_th1 + "</th>\
<th>" + lan.soft.qiniu_th2 + "</th>\
<th>" + lan.soft.qiniu_th3 + "</th>\
<th>" + lan.soft.qiniu_th4 + "</th>\
</tr>\
</thead>\
<tbody class='list-list'>" + tBody + "</tbody>\
</table>\
</div>"
});
});
}
//取软件列表
function GetSList(isdisplay) {
@ -1810,9 +1767,7 @@ function GetSList(isdisplay) {
setCookie('p' + getCookie('softType'), isdisplay);
}
console.log("1212");
$.post('/plugins/list&tojs=GetSList' + search + type + page, '', function(rdata) {
$.post('/plugins/list?' + search + type + page, '', function(rdata) {
layer.close(loadT);
var tBody = '';
var sBody = '';
@ -1882,37 +1837,10 @@ function GetSList(isdisplay) {
handle = '<a style="color:#C0C0C0;" href="javascript:task();">' + lan.soft.sleep_install + '</a>'
}
}
var enddate = '<td class="c9 text-center">' + rdata.data[i].end + '</td>';
if (rdata.data[i].price > 0) {
var price = '<td class="text-center" style="color:#fc6d26">¥' + rdata.data[i].price + '</td>';
var uninstall = ''
if (isSetup) {
uninstall = ' | <a class="btlink" onclick="UninstallVersion(\'' + rdata.data[i].name + '\',\'1.0\',\'' + rdata.data[i].title + '\')">' + lan.soft.uninstall + '</a>'
}
if (rdata.data[i].end == '未开通' || rdata.data[i].end == '已到期' || rdata.data[i].end == '待支付') {
handle = '<a class="btlink" onclick="Renewinstall(\'' + rdata.data[i].title + '\',\'' + rdata.data[i].product_id + '\')">立即购买</a>' + uninstall
titleClick = 'onclick="Renewinstall(\'' + rdata.data[i].title + '\',\'' + rdata.data[i].product_id + '\')" style="cursor:pointer"';
if (rdata.data[i].end == '已到期') {
handle = '<a class="btlink" onclick="Renewinstall(\'' + rdata.data[i].title + '\',\'' + rdata.data[i].product_id + '\',1)">立即续费</a>' + uninstall
}
enddate = '<td class="c9 text-center">' + rdata.data[i].end + '&nbsp;&nbsp;<span class="glyphicon glyphicon-repeat cursor" onclick="FPStatus()" title="刷新状态"></span></td>';
}
if (rdata.data[i].end.indexOf('20') != -1 || rdata.data[i].end == '已到期') enddate = '<td class="c9 text-center">' + rdata.data[i].end + '<a class="btlink" onclick="Renewinstall(\'' + rdata.data[i].title + '\',\'' + rdata.data[i].product_id + '\',1)"> (续费)</a></td>';
} else {
var price = '<td class="c9 text-center">免费</td>';
}
sBody += '<tr>' +
'<td><span ' + titleClick + '><img src="/static/img/soft_ico/ico-' + rdata.data[i].name + '.png">' + rdata.data[i].title + ' ' + version + '</span></td>'
//+'<td>'+rdata.data[i].versions[0].no+'</td>'
//+'<td>'+rdata.data[i].type+'</td>'
+
'<td><span ' + titleClick + '><img src="/static/img/soft_ico/ico-' + rdata.data[i].name + '.png">' + rdata.data[i].title + ' ' + version + '</span></td>' +
'<td>' + rdata.data[i].ps + '</td>' +
price +
enddate +
'<td>' + softPath + '</td>' +
'<td>' + state + '</td>' +
'<td>' + indexshow + '</td>' +

@ -7,9 +7,10 @@
<meta name="renderer" content="webkit">
<title>MDWEB-Linux面板</title>
<link rel="shortcut icon" href="/static/favicon.ico" type="image/x-icon" />
<link href="/static/bootstrap-3.3.5/css/bootstrap.min.css" rel="stylesheet">
<link href="/static/css/site.css?date=20180912" rel="stylesheet">
<link href="/static/codemirror/lib/codemirror.css" rel="stylesheet">
<link href="/static/bootstrap-3.3.5/css/bootstrap.min.css?v={{config.version}}" rel="stylesheet">
<link href="/static/css/site.css?v={{config.version}}" rel="stylesheet">
<link href="/static/codemirror/lib/codemirror.css?v={{config.version}}" rel="stylesheet">
<script src="/static/language/Simplified_Chinese/lan.js?v={{config.version}}"></script>
<!--[if lte IE 9]>
<script src="/static/js/requestAnimationFrame.js"></script>
<![endif]-->
@ -41,35 +42,35 @@
</div>
<button style="display: none;" id="bt_copys" class="bt_copy" data-clipboard-text=""></button>
<a style="display: none;" id="defaultPath">$web.ctx.session.config['sites_path']</a>
<script src="/static/js/jquery-1.10.2.min.js"></script>
<script src="/static/js/bootstrap.min.js"></script>
<script src="/static/layer/layer.js?date=20180301"></script>
<script src="/static/js/jquery.fly.min.js"></script>
<script src="/static/js/clipboard.min.js"></script>
<script src="/static/js/public.js?date=20180620"></script>
<script src="/static/js/jquery-1.10.2.min.js?v={{config.version}}"></script>
<script src="/static/js/bootstrap.min.js?v={{config.version}}"></script>
<script src="/static/layer/layer.js?v={{config.version}}"></script>
<script src="/static/js/jquery.fly.min.js?v={{config.version}}"></script>
<script src="/static/js/clipboard.min.js?v={{config.version}}"></script>
<script src="/static/js/public.js?v={{config.version}}"></script>
{% block content %}{% endblock %}
<div class="footer bgw">mdweb &copy;2014-2018 面板 (github.com/midoks/mdweb)<a style="margin-left:20px;color:#20a53a;" href="//github.com/midoks/mdweb" target="_blank">HELP</a><a style="margin-left:20px;color:#20a53a;" href="//github.com/midoks/mdweb" target="_blank">《使用手册》</a></div>
</div>
</div>
</div>
</body>
<script src="/static/codemirror/lib/codemirror.js"></script>
<script src="/static/codemirror/addon/edit/editAll.js"></script>
<script src="/static/codemirror/mode/modeAll.js"></script>
<script src="/static/codemirror/addon/dialog/dialog.js"></script>
<script src="/static/codemirror/addon/search/search.js"></script>
<script src="/static/codemirror/addon/scroll/annotatescrollbar.js"></script>
<script src="/static/js/jquery.qrcode.min.js"></script>
<script src="/static/laydate/laydate.js?date=20180301"></script>
<script src="/static/codemirror/lib/codemirror.js?v={{config.version}}"></script>
<script src="/static/codemirror/addon/edit/editAll.js?v={{config.version}}"></script>
<script src="/static/codemirror/mode/modeAll.js?v={{config.version}}"></script>
<script src="/static/codemirror/addon/dialog/dialog.js?v={{config.version}}"></script>
<script src="/static/codemirror/addon/search/search.js?v={{config.version}}"></script>
<script src="/static/codemirror/addon/scroll/annotatescrollbar.js?v={{config.version}}"></script>
<script src="/static/js/jquery.qrcode.min.js?v={{config.version}}"></script>
<script src="/static/laydate/laydate.js?v={{config.version}}"></script>
<script type="text/javascript">
$$("#setBox").click(function() {
if ($$(this).prop("checked")) {
$$("input[name=id]").prop("checked", true)
} else {
$$("input[name=id]").prop("checked", false)
}
});
setCookie('order', 'id desc');
// $$("#setBox").click(function() {
// if ($$(this).prop("checked")) {
// $$("input[name=id]").prop("checked", true)
// } else {
// $$("input[name=id]").prop("checked", false)
// }
// });
// setCookie('order', 'id desc');
</script>
</html>

@ -20,12 +20,7 @@
<div class="softlist">
<div class="divtable pd15 relative">
<div class="menu-sub softtype">
<!-- <span typeid="0">全部</span>
<span typeid="1" class="on">运行环境</span>
<span typeid="2">系统工具</span>
<span typeid="3">插件</span> -->
</div>
<div class="menu-sub softtype"></div>
<button class="btn btn-default btn-sm" onclick="flush_cache()" title="从云端更新列表" style="position:absolute;top:12px;right:15px">添加插件</button>
<div id="updata_pro_info"></div>
@ -36,7 +31,7 @@
<th>说明</th>
<th width="40">状态</th>
<th width="40">位置</th>
<th width="64">状态</th>
<th width="64">首页显示</th>
<th style="text-align: right;" width="120">操作</th>
</tr>
</thead>
@ -51,9 +46,9 @@
</div>
</div>
</div>
<script type="text/javascript" src="/static/js/jquery.dragsort-0.5.2.min.js"></script>
<script type="text/javascript" src="/static/js/soft.js?date=20180815"></script>
<script type="text/javascript" src="/static/laydate/laydate.js?date=20180301"></script>
<script type="text/javascript" src="/static/js/jquery.dragsort-0.5.2.min.js?v={{config.version}}"></script>
<script type="text/javascript" src="/static/js/soft.js?v={{config.version}}"></script>
<script type="text/javascript" src="/static/laydate/laydate.js?v={{config.version}}"></script>
<script>
setCookie('serverType','$web.ctx.session.webserver');
//取软件列表

@ -2,6 +2,7 @@
from flask import Blueprint, render_template
from flask import jsonify
from flask import request
import psutil
import time
@ -24,13 +25,17 @@ def index():
return render_template('default/ftp.html')
@plugins.route("/list")
@plugins.route("/list", methods=['GET', 'POST'])
def list():
data = json.loads(public.readFile("data/type.json"))
ret = {}
ret["type"] = data
plugins_info = []
print request.args['type']
for dirinfo in os.listdir(__plugin_name):
path = __plugin_name + "/" + dirinfo
if os.path.isdir(path):
@ -38,9 +43,10 @@ def list():
if os.path.exists(jsonFile):
try:
tmp = json.loads(public.readFile(jsonFile))
print tmp
plugins_info.append(tmp)
# print tmp
except:
pass
print dirinfo
# print dirinfo
ret['data'] = plugins_info
return jsonify(ret)

Loading…
Cancel
Save