Compare commits

...

9 Commits
2.1 ... 2.3.2

Author SHA1 Message Date
flucout
7d32833431 update 2024-02-12 21:05:46 +08:00
flucout
6c6ad40836 update 2024-01-30 21:40:39 +08:00
flucout
11961b8f0b update 2024-01-20 21:42:10 +08:00
flucout
71db6b0a3e update 2024-01-17 18:13:08 +08:00
flucout
79fddbb943 update 2023-12-30 10:20:44 +08:00
flucout
f81cd68e80 update 2023-12-18 16:11:14 +08:00
flucout
4c76ec2056 update 2023-12-07 14:45:15 +08:00
flucout
ef99d79f1a update 2023-12-06 21:28:51 +08:00
flucout
06bf42de98 update 2023-11-24 22:30:32 +08:00
35 changed files with 2152 additions and 1926 deletions

View File

@@ -185,3 +185,43 @@ function errorlog($msg){
fwrite($handle, date('Y-m-d H:i:s')."\t".$msg."\r\n");
fclose($handle);
}
function licenseEncrypt($data, $key){
$iv = substr($key, 0, 16);
return openssl_encrypt($data, 'AES-256-CBC', $key, 0, $iv);
}
function licenseDecrypt($data, $key){
$iv = substr($key, 0, 16);
return openssl_decrypt($data, 'AES-256-CBC', $key, 0, $iv);
}
function generateKeyPairs(){
$pkey_dir = app()->getRootPath().'data/config/';
$public_key_path = $pkey_dir.'public_key.pem';
$private_key_path = $pkey_dir.'private_key.pem';
if(file_exists($public_key_path) && file_exists($private_key_path)){
return [file_get_contents($public_key_path), file_get_contents($private_key_path)];
}
$pkey_config = ['private_key_bits'=>4096];
$pkey_res = openssl_pkey_new($pkey_config);
$private_key = '';
openssl_pkey_export($pkey_res, $private_key, null, $pkey_config);
$pkey_details = openssl_pkey_get_details($pkey_res);
if(!$pkey_details) return false;
$public_key = $pkey_details['key'];
file_put_contents($public_key_path, $public_key);
file_put_contents($private_key_path, $private_key);
return [$public_key, $private_key];
}
function pemToBase64($pem){
$lines = explode("\n", $pem);
$encoded = '';
foreach ($lines as $line) {
if (trim($line) != '' && strpos($line, '-----BEGIN') === false && strpos($line, '-----END') === false) {
$encoded .= trim($line);
}
}
return $encoded;
}

View File

@@ -213,6 +213,26 @@ class Api extends BaseController
return json($data);
}
//宝塔云WAF最新版本
public function btwaf_latest_version(){
$type = input('?post.type') ? input('post.type') : 0;
if($type == 1){
$data = [
'version' => '1.1',
'description' => '暂无更新日志',
'create_time' => 1705315163,
];
}else{
$data = [
'version' => '3.0',
'description' => '暂无更新日志',
'create_time' => 1705315163,
];
}
$data = bin2hex(json_encode($data));
return json(['status'=>true,'err_no'=>0,'msg'=>'获取成功','data'=>$data]);
}
//获取内测版更新日志
public function get_beta_logs(){
return json(['beta_ps'=>'当前暂无内测版', 'list'=>[]]);
@@ -275,35 +295,67 @@ class Api extends BaseController
//绑定账号
public function get_auth_token(){
if(!$_POST['data']) return json(['status'=>false, 'msg'=>'参数不能为空']);
$reqData = hex2bin($_POST['data']);
if(!input('?post.data')) return json(['status'=>false, 'msg'=>'参数不能为空']);
$reqData = hex2bin(input('post.data'));
parse_str($reqData, $arr);
$serverid = $arr['serverid'];
$userinfo = ['uid'=>1, 'username'=>'Administrator', 'address'=>'127.0.0.1', 'serverid'=>$serverid, 'access_key'=>random(32), 'secret_key'=>random(48), 'ukey'=>md5(time()), 'state'=>1];
$data = bin2hex(urlencode(json_encode($userinfo)));
$userinfo = ['uid'=>1, 'username'=>'Administrator', 'address'=>'127.0.0.1', 'serverid'=>$serverid, 'access_key'=>random(48), 'secret_key'=>random(48), 'ukey'=>md5(time()), 'state'=>1];
$data = bin2hex(json_encode($userinfo));
return json(['status'=>true, 'msg'=>'登录成功!', 'data'=>$data]);
}
//绑定账号新
public function authorization_login(){
if(!$_POST['data']) return json(['status'=>false, 'msg'=>'参数不能为空']);
$reqData = hex2bin($_POST['data']);
if(!input('?post.data')) return json(['status'=>false, 'msg'=>'参数不能为空']);
$reqData = hex2bin(input('post.data'));
parse_str($reqData, $arr);
$serverid = $arr['serverid'];
$userinfo = ['uid'=>1, 'username'=>'Administrator', 'ip'=>'127.0.0.1', 'server_id'=>$serverid, 'access_key'=>random(32), 'secret_key'=>random(48)];
$data = bin2hex(urlencode(json_encode($userinfo)));
return json(['status'=>true, 'msg'=>'登录成功', 'data'=>$data]);
$userinfo = ['uid'=>1, 'username'=>'Administrator', 'ip'=>'127.0.0.1', 'server_id'=>$serverid, 'access_key'=>random(48), 'secret_key'=>random(48)];
$data = bin2hex(json_encode($userinfo));
return json(['status'=>true, 'err_no'=>0, 'msg'=>'账号绑定成功', 'data'=>$data]);
}
//刷新授权信息
public function authorization_info(){
if(!$_POST['data']) return json(['status'=>false, 'msg'=>'参数不能为空']);
$reqData = hex2bin($_POST['data']);
if(!input('?post.data')) return json(['status'=>false, 'msg'=>'参数不能为空']);
$reqData = hex2bin(input('post.data'));
parse_str($reqData, $arr);
$id = isset($arr['id'])&&$arr['id']>0?$arr['id']:1;
$userinfo = ['id'=>$id, 'product'=>$arr['product'], 'status'=>2, 'clients'=>9999, 'durations'=>0, 'end_time'=>strtotime('+10 year')];
$data = bin2hex(urlencode(json_encode($userinfo)));
return json(['status'=>true, 'data'=>$data]);
$data = bin2hex(json_encode($userinfo));
return json(['status'=>true, 'err_no'=>0, 'data'=>$data]);
}
//刷新授权信息
public function update_license(){
if(!input('?post.data')) return json(['status'=>false, 'msg'=>'参数不能为空']);
$reqData = hex2bin(input('post.data'));
parse_str($reqData, $arr);
if(!isset($arr['product']) || !isset($arr['serverid'])) return json(['status'=>false, 'msg'=>'缺少参数']);
$license_data = ['product'=>$arr['product'], 'uid'=>random(32), 'phone'=>'138****8888', 'auth_id'=>random(32), 'server_id'=>substr($arr['serverid'], 0, 32), 'auth'=>['apis'=>[], 'menu'=>[], 'extra'=>['type'=>3,'location'=>-1,'smart_cc'=>-1,'site'=>0]], 'pages'=>[], 'end_time'=>strtotime('+10 year')];
$json = json_encode($license_data);
[$public_key, $private_key] = generateKeyPairs();
$public_key = pemToBase64($public_key);
$key1 = random(32);
$key2 = substr($public_key, 0, 32);
$encrypted1 = licenseEncrypt($json, $key1);
$encrypted2 = licenseEncrypt($key1, $key2);
$sign_data = $encrypted1.'.'.$encrypted2;
openssl_sign($sign_data, $signature, $private_key, OPENSSL_ALGO_SHA256);
$signature = base64_encode($signature);
$license = base64_encode($sign_data.'.'.$signature);
$data = bin2hex(json_encode(['public_key'=>$public_key, 'license'=>$license]));
return json(['status'=>true, 'err_no'=>0, 'msg'=>'授权获取成功', 'data'=>$data]);
}
public function is_obtained_btw_trial(){
$data = ['is_obtained'=>0];
$data = bin2hex(json_encode($data));
return json(['status'=>true, 'err_no'=>0, 'data'=>$data, 'msg'=>'检测成功']);
}
//一键部署列表
@@ -344,6 +396,7 @@ class Api extends BaseController
return json(['page'=>"<div><span class='Pcurrent'>1</span><span class='Pnumber'>1/0</span><span class='Pline'>从1-1000条</span><span class='Pcount'>共计0条数据</span></div>", 'data'=>[]]);
}
//获取所有蜘蛛IP列表
public function btwaf_getspiders(){
try{
$result = Plugins::btwaf_getspiders();
@@ -353,6 +406,14 @@ class Api extends BaseController
}
}
//分类获取蜘蛛IP列表
public function get_spider(){
$type = input('get.spider/d');
if(!$type) return json([]);
$result = Plugins::get_spider($type);
return json($result);
}
//检查黑白名单
private function checklist(){
if(config_get('whitelist') == 1){
@@ -391,4 +452,16 @@ class Api extends BaseController
fclose($handle);
exit;
}
public function logerror(){
$content = date('Y-m-d H:i:s')."\r\n";
$content.=$_SERVER['REQUEST_METHOD'].' '.$_SERVER['REQUEST_URI']."\r\n";
if($_SERVER['REQUEST_METHOD'] == 'POST'){
$content.=file_get_contents('php://input')."\r\n";
}
$handle = fopen(app()->getRootPath()."record.txt", 'a');
fwrite($handle, $content."\r\n");
fclose($handle);
return json(['status'=>false, 'msg'=>'不支持当前操作']);
}
}

View File

@@ -151,4 +151,18 @@ class Plugins
return $result;
}
//分类获取蜘蛛IP列表
public static function get_spider($type){
$result = cache('get_spider_'.$type);
if($result){
return $result;
}
$url = 'https://www.bt.cn/api/panel/get_spider?spider='.$type;
$data = get_curl($url);
$result = json_decode($data, true);
if(!$result) return [];
cache('get_spider_'.$type, $result, 3600 * 24);
return $result;
}
}

View File

@@ -1,6 +1,6 @@
#!/bin/bash
Linux_Version="8.0.3"
Linux_Version="8.0.5"
Windows_Version="7.9.0"
Btm_Version="2.2.9"

View File

@@ -16,7 +16,7 @@
</div>
</div>
</div>
<script src="//cdn.staticfile.org/layer/3.5.1/layer.js"></script>
<script src="//lf6-cdn-tos.bytecdntp.com/cdn/expire-1-M/layer/3.5.1/layer.js"></script>
<script>
function refresh_deplist(os){
var confirm = layer.confirm('是否确定从宝塔官方获取最新一键部署列表?', {

View File

@@ -5,15 +5,15 @@
<meta name="renderer" content="webkit">
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<title>{block name="title"}标题{/block}</title>
<link href="//cdn.staticfile.org/twitter-bootstrap/3.4.1/css/bootstrap.min.css" rel="stylesheet" />
<link href="//cdn.staticfile.org/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet" />
<link href="//lf6-cdn-tos.bytecdntp.com/cdn/expire-1-M/twitter-bootstrap/3.4.1/css/bootstrap.min.css" rel="stylesheet" />
<link href="//lf6-cdn-tos.bytecdntp.com/cdn/expire-1-M/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet" />
<link href="/static/css/bootstrap-table.css" rel="stylesheet" />
<script src="//cdn.staticfile.org/modernizr/2.8.3/modernizr.min.js"></script>
<script src="//cdn.staticfile.org/jquery/2.1.4/jquery.min.js"></script>
<script src="//cdn.staticfile.org/twitter-bootstrap/3.4.1/js/bootstrap.min.js"></script>
<script src="//lf6-cdn-tos.bytecdntp.com/cdn/expire-1-M/modernizr/2.8.3/modernizr.min.js"></script>
<script src="//lf6-cdn-tos.bytecdntp.com/cdn/expire-1-M/jquery/2.1.4/jquery.min.js"></script>
<script src="//lf6-cdn-tos.bytecdntp.com/cdn/expire-1-M/twitter-bootstrap/3.4.1/js/bootstrap.min.js"></script>
<!--[if lt IE 9]>
<script src="//cdn.staticfile.org/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="//cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
<script src="//lf6-cdn-tos.bytecdntp.com/cdn/expire-1-M/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="//lf6-cdn-tos.bytecdntp.com/cdn/expire-1-M/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>

View File

@@ -42,9 +42,9 @@
</table>
</div>
</div>
<script src="//cdn.staticfile.org/layer/3.5.1/layer.js"></script>
<script src="//cdn.staticfile.org/bootstrap-table/1.20.2/bootstrap-table.min.js"></script>
<script src="//cdn.staticfile.org/bootstrap-table/1.20.2/extensions/page-jump-to/bootstrap-table-page-jump-to.min.js"></script>
<script src="//lf6-cdn-tos.bytecdntp.com/cdn/expire-1-M/layer/3.5.1/layer.js"></script>
<script src="//lf6-cdn-tos.bytecdntp.com/cdn/expire-1-M/bootstrap-table/1.19.1/bootstrap-table.min.js"></script>
<script src="//lf6-cdn-tos.bytecdntp.com/cdn/expire-1-M/bootstrap-table/1.19.1/extensions/page-jump-to/bootstrap-table-page-jump-to.min.js"></script>
<script src="/static/js/custom.js"></script>
<script>
function setEnable(id,enable) {

View File

@@ -23,9 +23,9 @@
</table>
</div>
</div>
<script src="//cdn.staticfile.org/layer/3.5.1/layer.js"></script>
<script src="//cdn.staticfile.org/bootstrap-table/1.20.2/bootstrap-table.min.js"></script>
<script src="//cdn.staticfile.org/bootstrap-table/1.20.2/extensions/page-jump-to/bootstrap-table-page-jump-to.min.js"></script>
<script src="//lf6-cdn-tos.bytecdntp.com/cdn/expire-1-M/layer/3.5.1/layer.js"></script>
<script src="//lf6-cdn-tos.bytecdntp.com/cdn/expire-1-M/bootstrap-table/1.19.1/bootstrap-table.min.js"></script>
<script src="//lf6-cdn-tos.bytecdntp.com/cdn/expire-1-M/bootstrap-table/1.19.1/extensions/page-jump-to/bootstrap-table-page-jump-to.min.js"></script>
<script src="/static/js/custom.js"></script>
<script>

View File

@@ -5,12 +5,12 @@
<meta name="renderer" content="webkit">
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>管理员登录</title>
<link href="//cdn.staticfile.org/twitter-bootstrap/3.4.1/css/bootstrap.min.css" rel="stylesheet"/>
<script src="//cdn.staticfile.org/modernizr/2.8.3/modernizr.min.js"></script>
<script src="//cdn.staticfile.org/jquery/2.1.4/jquery.min.js"></script>
<link href="//lf6-cdn-tos.bytecdntp.com/cdn/expire-1-M/twitter-bootstrap/3.4.1/css/bootstrap.min.css" rel="stylesheet"/>
<script src="//lf6-cdn-tos.bytecdntp.com/cdn/expire-1-M/modernizr/2.8.3/modernizr.min.js"></script>
<script src="//lf6-cdn-tos.bytecdntp.com/cdn/expire-1-M/jquery/2.1.4/jquery.min.js"></script>
<!--[if lt IE 9]>
<script src="//cdn.staticfile.org/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="//cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
<script src="//lf6-cdn-tos.bytecdntp.com/cdn/expire-1-M/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="//lf6-cdn-tos.bytecdntp.com/cdn/expire-1-M/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
@@ -63,7 +63,7 @@
</div>
</div>
</div>
<script src="//cdn.staticfile.org/layer/3.5.1/layer.js"></script>
<script src="//lf6-cdn-tos.bytecdntp.com/cdn/expire-1-M/layer/3.5.1/layer.js"></script>
<script>
function submitlogin(){
var user = $("input[name='user']").val();

View File

@@ -69,9 +69,9 @@ td{overflow: hidden;text-overflow: ellipsis;white-space: nowrap;max-width:340px;
</table>
</div>
</div>
<script src="//cdn.staticfile.org/layer/3.5.1/layer.js"></script>
<script src="//cdn.staticfile.org/bootstrap-table/1.20.2/bootstrap-table.min.js"></script>
<script src="//cdn.staticfile.org/bootstrap-table/1.20.2/extensions/page-jump-to/bootstrap-table-page-jump-to.min.js"></script>
<script src="//lf6-cdn-tos.bytecdntp.com/cdn/expire-1-M/layer/3.5.1/layer.js"></script>
<script src="//lf6-cdn-tos.bytecdntp.com/cdn/expire-1-M/bootstrap-table/1.19.1/bootstrap-table.min.js"></script>
<script src="//lf6-cdn-tos.bytecdntp.com/cdn/expire-1-M/bootstrap-table/1.19.1/extensions/page-jump-to/bootstrap-table-page-jump-to.min.js"></script>
<script src="/static/js/custom.js"></script>
<script>

View File

@@ -69,9 +69,9 @@ td{overflow: hidden;text-overflow: ellipsis;white-space: nowrap;max-width:340px;
</table>
</div>
</div>
<script src="//cdn.staticfile.org/layer/3.5.1/layer.js"></script>
<script src="//cdn.staticfile.org/bootstrap-table/1.20.2/bootstrap-table.min.js"></script>
<script src="//cdn.staticfile.org/bootstrap-table/1.20.2/extensions/page-jump-to/bootstrap-table-page-jump-to.min.js"></script>
<script src="//lf6-cdn-tos.bytecdntp.com/cdn/expire-1-M/layer/3.5.1/layer.js"></script>
<script src="//lf6-cdn-tos.bytecdntp.com/cdn/expire-1-M/bootstrap-table/1.19.1/bootstrap-table.min.js"></script>
<script src="//lf6-cdn-tos.bytecdntp.com/cdn/expire-1-M/bootstrap-table/1.19.1/extensions/page-jump-to/bootstrap-table-page-jump-to.min.js"></script>
<script src="/static/js/custom.js"></script>
<script>

View File

@@ -23,9 +23,9 @@
</table>
</div>
</div>
<script src="//cdn.staticfile.org/layer/3.5.1/layer.js"></script>
<script src="//cdn.staticfile.org/bootstrap-table/1.20.2/bootstrap-table.min.js"></script>
<script src="//cdn.staticfile.org/bootstrap-table/1.20.2/extensions/page-jump-to/bootstrap-table-page-jump-to.min.js"></script>
<script src="//lf6-cdn-tos.bytecdntp.com/cdn/expire-1-M/layer/3.5.1/layer.js"></script>
<script src="//lf6-cdn-tos.bytecdntp.com/cdn/expire-1-M/bootstrap-table/1.19.1/bootstrap-table.min.js"></script>
<script src="//lf6-cdn-tos.bytecdntp.com/cdn/expire-1-M/bootstrap-table/1.19.1/extensions/page-jump-to/bootstrap-table-page-jump-to.min.js"></script>
<script src="/static/js/custom.js"></script>
<script>

View File

@@ -279,7 +279,7 @@ $("select[name='wbt_type']").change(function(){
</div>
</div>
{/if}
<script src="//cdn.staticfile.org/layer/3.5.1/layer.js"></script>
<script src="//lf6-cdn-tos.bytecdntp.com/cdn/expire-1-M/layer/3.5.1/layer.js"></script>
<script>
$(document).ready(function(){
var items = $("select[default]");

View File

@@ -65,12 +65,12 @@
{if config_get('new_version_btm')}<div class="disflex flex_lrcenter mt_30 install-list">
<div class="install-box monitor">
<div class="img">
<img src="/static/images/bt_monitor.png" />
<img src="/static/images/bt_monitor.png" style="height: 96px;"/>
</div>
<div class="cont">
<div class="top">
<div class="title">堡塔云监控</div>
<div class="desc">服务监控和异常告警通知</div>
<div class="title">安全监控</div>
<div class="desc">机跨平台安全管理和监控</div>
</div>
<div class="bottom">
<a class="btn" href="javascript:;" id="goInstallMonitor">查看安装脚本</a>
@@ -145,7 +145,7 @@
<div class="d4" id="instal-monitor">
<div class="wrap">
<div class="wrap-title">
<div class="text" style="margin-right: 12px;">堡塔云监控{:config_get('new_version_btm')}安装脚本</div>
<div class="text" style="margin-right: 12px;">安全监控{:config_get('new_version_btm')}安装脚本</div>
</div>
<div class="desc">
使用 SSH 连接工具,如
@@ -153,21 +153,21 @@
连接到您的 Linux 服务器后,根据系统执行相应命令开始安装:
</div>
<div class="install-code">
<span class="osname">堡塔云监控安装脚本</span>
<span class="osname">安全监控安装脚本</span>
<div class="code-cont">
<div class="command" title="点击复制安装脚本">curl -sS {$siteurl}/install/install_btmonitor.sh -o /tmp/install_btmonitor.sh && bash /tmp/install_btmonitor.sh</div>
<span class="ico-copy" title="点击复制安装脚本" data-clipboard-text="curl -sS {$siteurl}/install/install_btmonitor.sh -o /tmp/install_btmonitor.sh && bash /tmp/install_btmonitor.sh">复制</span>
</div>
</div>
<div class="install-code">
<span class="osname">堡塔云监控更新脚本</span>
<span class="osname">安全监控更新脚本</span>
<div class="code-cont">
<div class="command" title="点击复制更新脚本">curl {$siteurl}/install/update_btmonitor.sh|bash</div>
<span class="ico-copy" title="点击复制更新脚本" data-clipboard-text="curl {$siteurl}/install/update_btmonitor.sh|bash">复制</span>
</div>
</div>
<div class="tips" style="color: orangered; font-weight: 700">
<p>注意推荐使用Chrome、火狐、edge浏览器国产浏览器极速模式</p>
<p>注意:安装完成后推荐使用Chrome、火狐、edge浏览器国产浏览器极速模式访问登录系统</p>
</div>
</div>
</div>{/if}
@@ -193,10 +193,10 @@
</div>
</div>
<script src="//cdn.staticfile.org/jquery/3.6.0/jquery.min.js" type="text/javascript" charset="utf-8"></script>
<script src="//cdn.staticfile.org/layer/3.5.1/layer.js" type="text/javascript" charset="utf-8"></script>
<script src="//lf6-cdn-tos.bytecdntp.com/cdn/expire-1-M/jquery/3.6.0/jquery.min.js" type="text/javascript" charset="utf-8"></script>
<script src="//lf6-cdn-tos.bytecdntp.com/cdn/expire-1-M/layer/3.5.1/layer.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript" src="//cdn.staticfile.org/clipboard.js/1.7.1/clipboard.min.js"></script>
<script type="text/javascript" src="//lf6-cdn-tos.bytecdntp.com/cdn/expire-1-M/clipboard.js/1.7.1/clipboard.min.js"></script>
<script type="text/javascript" src="/static/js/dx.js"></script>
<script>
$(function () {

View File

@@ -217,7 +217,7 @@
</form>
</div>
</div>
<script src="//cdn.staticfile.org/jquery/2.1.4/jquery.min.js"></script>
<script src="//lf6-cdn-tos.bytecdntp.com/cdn/expire-1-M/jquery/2.1.4/jquery.min.js"></script>
<script>
$(function () {
$('form').on('submit', function (e) {

0
data/config/.gitkeep Normal file
View File

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

0
data/win/config/.gitkeep Normal file
View File

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -12,9 +12,9 @@ INSERT INTO `cloud_config` (`key`, `value`) VALUES
('bt_key', ''),
('whitelist', '0'),
('download_page', '1'),
('new_version', '8.0.3'),
('new_version', '8.0.5'),
('update_msg', '暂无更新日志'),
('update_date', '2023-10-08'),
('update_date', '2024-01-12'),
('new_version_win', '7.9.0'),
('update_msg_win', '暂无更新日志'),
('update_date_win', '2023-07-20'),

View File

@@ -30,12 +30,17 @@ if [ "${UbuntuCheck}" ] && [ "${UbuntuCheck}" -lt "16" ];then
echo "Ubuntu ${UbuntuCheck}不支持安装宝塔面板建议更换Ubuntu18/20安装宝塔面板"
exit 1
fi
HOSTNAME_CHECK=$(cat /etc/hostname)
if [ -z "${HOSTNAME_CHECK}" ];then
echo "当前主机名hostname为空无法安装宝塔面板请咨询服务器运营商设置好hostname后再重新安装"
exit 1
fi
cd ~
setup_path="/www"
python_bin=$setup_path/server/panel/pyenv/bin/python
cpu_cpunt=$(cat /proc/cpuinfo|grep processor|wc -l)
panelPort=$(expr $RANDOM % 55535 + 10000)
# if [ "$1" ];then
# IDC_CODE=$1
# fi
@@ -503,7 +508,7 @@ Install_Python_Lib(){
chmod -R 700 $pyenv_path/pyenv/bin
is_package=$($python_bin -m psutil 2>&1|grep package)
if [ "$is_package" = "" ];then
wget -O $pyenv_path/pyenv/pip.txt $download_Url/install/pyenv/pip.txt -T 5
wget -O $pyenv_path/pyenv/pip.txt $download_Url/install/pyenv/pip.txt -T 15
$pyenv_path/pyenv/bin/pip install -U pip
$pyenv_path/pyenv/bin/pip install -U setuptools==65.5.0
$pyenv_path/pyenv/bin/pip install -r $pyenv_path/pyenv/pip.txt
@@ -579,10 +584,10 @@ Install_Python_Lib(){
if [ "${os_version}" != "" ];then
pyenv_file="/www/pyenv.tar.gz"
wget -O $pyenv_file $download_Url/install/pyenv/pyenv-${os_type}${os_version}-x${is64bit}.tar.gz -T 10
wget -O $pyenv_file $download_Url/install/pyenv/pyenv-${os_type}${os_version}-x${is64bit}.tar.gz -T 15
if [ "$?" != "0" ];then
get_node_url $download_Url
wget -O $pyenv_file $download_Url/install/pyenv/pyenv-${os_type}${os_version}-x${is64bit}.tar.gz -T 10
wget -O $pyenv_file $download_Url/install/pyenv/pyenv-${os_type}${os_version}-x${is64bit}.tar.gz -T 15
fi
tmp_size=$(du -b $pyenv_file|awk '{print $1}')
if [ $tmp_size -lt 703460 ];then
@@ -613,7 +618,7 @@ Install_Python_Lib(){
cd /www
python_src='/www/python_src.tar.xz'
python_src_path="/www/Python-${py_version}"
wget -O $python_src $download_Url/src/Python-${py_version}.tar.xz -T 5
wget -O $python_src $download_Url/src/Python-${py_version}.tar.xz -T 15
tmp_size=$(du -b $python_src|awk '{print $1}')
if [ $tmp_size -lt 10703460 ];then
rm -f $python_src
@@ -667,11 +672,8 @@ Install_Python_Lib(){
fi
}
Install_Bt(){
panelPort="8888"
if [ -f ${setup_path}/server/panel/data/port.pl ];then
panelPort=$(cat ${setup_path}/server/panel/data/port.pl)
else
panelPort=$(expr $RANDOM % 55535 + 10000)
fi
if [ "${PANEL_PORT}" ];then
panelPort=$PANEL_PORT
@@ -696,9 +698,9 @@ Install_Bt(){
sleep 1
fi
wget -O /etc/init.d/bt ${download_Url}/install/src/bt6.init -T 10
wget -O /www/server/panel/install/public.sh ${Btapi_Url}/install/public.sh -T 10
wget -O panel.zip ${Btapi_Url}/install/src/panel6.zip -T 10
wget -O /etc/init.d/bt ${download_Url}/install/src/bt6.init -T 15
wget -O /www/server/panel/install/public.sh ${Btapi_Url}/install/public.sh -T 15
wget -O panel.zip ${Btapi_Url}/install/src/panel6.zip -T 15
if [ -f "${setup_path}/server/panel/data/default.db" ];then
if [ -d "/${setup_path}/server/panel/old_data" ];then
@@ -711,6 +713,11 @@ Install_Bt(){
mv -f ${setup_path}/server/panel/data/system.db ${setup_path}/server/panel/old_data/system.db
mv -f ${setup_path}/server/panel/data/port.pl ${setup_path}/server/panel/old_data/port.pl
mv -f ${setup_path}/server/panel/data/admin_path.pl ${setup_path}/server/panel/old_data/admin_path.pl
if [ -f "${setup_path}/server/panel/data/db/default.db" ];then
mv -f ${setup_path}/server/panel/data/db/ ${setup_path}/server/panel/old_data/
fi
fi
if [ ! -f "/usr/bin/unzip" ]; then
@@ -729,6 +736,11 @@ Install_Bt(){
mv -f ${setup_path}/server/panel/old_data/system.db ${setup_path}/server/panel/data/system.db
mv -f ${setup_path}/server/panel/old_data/port.pl ${setup_path}/server/panel/data/port.pl
mv -f ${setup_path}/server/panel/old_data/admin_path.pl ${setup_path}/server/panel/data/admin_path.pl
if [ -f "${setup_path}/server/panel/old_data/db/default.db" ];then
mv -f ${setup_path}/server/panel/old_data/db/ ${setup_path}/server/panel/data/db
fi
if [ -d "/${setup_path}/server/panel/old_data" ];then
rm -rf ${setup_path}/server/panel/old_data
fi
@@ -739,6 +751,11 @@ Install_Bt(){
Red_Error "ERROR: Failed to download, please try install again!" "ERROR: 下载宝塔失败,请尝试重新安装!"
fi
SYS_LOG_CHECK=$(grep ^weekly /etc/logrotate.conf)
if [ "${SYS_LOG_CHECK}" ];then
sed -i 's/rotate [0-9]*/rotate 8/g' /etc/logrotate.conf
fi
rm -f panel.zip
rm -f ${setup_path}/server/panel/class/*.pyc
rm -f ${setup_path}/server/panel/*.pyc
@@ -748,8 +765,8 @@ Install_Bt(){
chmod -R +x ${setup_path}/server/panel/script
ln -sf /etc/init.d/bt /usr/bin/bt
echo "${panelPort}" > ${setup_path}/server/panel/data/port.pl
wget -O /etc/init.d/bt ${download_Url}/install/src/bt7.init -T 10
wget -O /www/server/panel/init.sh ${download_Url}/install/src/bt7.init -T 10
wget -O /etc/init.d/bt ${download_Url}/install/src/bt7.init -T 15
wget -O /www/server/panel/init.sh ${download_Url}/install/src/bt7.init -T 15
wget -O /www/server/panel/data/softList.conf ${download_Url}/install/conf/softList.conf
rm -f /www/server/panel/class/*.so
@@ -800,13 +817,13 @@ Set_Bt_Panel(){
/www/server/panel/pyenv/bin/pip3 install psycopg2-binary
/www/server/panel/pyenv/bin/pip3 install flask -U
/www/server/panel/pyenv/bin/pip3 install flask-sock
/www/server/panel/pyenv/bin/pip3 install -I gevent
btpip install simple-websocket==0.10.0
btpip install natsort
btpip uninstall enum34 -y
btpip install geoip2==4.7.0
auth_path=$(cat ${admin_auth})
cd ${setup_path}/server/panel/
if [ "$SET_SSL" == true ]; then
btpip install -I pyOpenSSl 2>/dev/null
btpython /www/server/panel/tools.py ssl
fi
/etc/init.d/bt start
$python_bin -m py_compile tools.py
$python_bin tools.py username
@@ -818,6 +835,10 @@ Set_Bt_Panel(){
echo "${password}" > ${setup_path}/server/panel/default.pl
chmod 600 ${setup_path}/server/panel/default.pl
sleep 3
if [ "$SET_SSL" == true ]; then
btpip install -I pyOpenSSl 2>/dev/null
btpython /www/server/panel/tools.py ssl
fi
/etc/init.d/bt restart
sleep 3
isStart=$(ps aux |grep 'BT-Panel'|grep -v grep|awk '{print $2}')
@@ -976,7 +997,7 @@ echo "
+----------------------------------------------------------------------
| Copyright © 2015-2099 BT-SOFT(http://www.bt.cn) All rights reserved.
+----------------------------------------------------------------------
| The WebPanel URL will be http://SERVER_IP:8888 when installed.
| The WebPanel URL will be http://SERVER_IP:${panelPort} when installed.
+----------------------------------------------------------------------
| 为了您的正常使用,请确保使用全新或纯净的系统安装宝塔面板,不支持已部署项目/环境的系统安装
+----------------------------------------------------------------------

View File

@@ -9,8 +9,13 @@ export PATH
export LANG=en_US.UTF-8
export LANGUAGE=en_US:en
NODE_FILE_CHECK=$(cat /www/server/panel/data/node.json |grep 125.88.182.172)
if [ "${NODE_FILE_CHECK}" ];then
rm -f /www/server/panel/data/node.json
fi
get_node_url(){
nodes=(https://dg2.bt.cn https://download.bt.cn https://ctcc1-node.bt.cn https://cmcc1-node.bt.cn https://ctcc2-node.bt.cn https://hk1-node.bt.cn https://na1-node.bt.cn https://jp1-node.bt.cn);
nodes=(https://dg2.bt.cn https://download.bt.cn https://ctcc1-node.bt.cn https://cmcc1-node.bt.cn https://ctcc2-node.bt.cn https://hk1-node.bt.cn https://na1-node.bt.cn https://jp1-node.bt.cn https://cf1-node.aapanel.com);
if [ "$1" ];then
nodes=($(echo ${nodes[*]}|sed "s#${1}##"))
@@ -40,8 +45,8 @@ get_node_url(){
fi
i=$(($i+1))
if [ $TIME_TOTAL -lt 200 ];then
if [ $RES -ge 3000 ];then
if [ $TIME_TOTAL -lt 300 ];then
if [ $RES -ge 2390 ];then
break;
fi
fi

Binary file not shown.

View File

@@ -18,6 +18,11 @@ if [ ! -f "/www/server/panel/pyenv/bin/python3" ];then
echo "请截图发帖至论坛www.bt.cn/bbs求助"
exit 0;
fi
Centos6Check=$(cat /etc/redhat-release | grep ' 6.' | grep -iE 'centos|Red Hat')
if [ "${Centos6Check}" ];then
echo "Centos6不支持升级宝塔面板建议备份数据重装更换Centos7/8安装宝塔面板"
exit 1
fi
public_file=/www/server/panel/install/public.sh
if [ ! -f $public_file ];then
@@ -42,7 +47,7 @@ download_Url=$NODE_URL
setup_path=/www
version=$(curl -Ss --connect-timeout 5 -m 2 $Btapi_Url/api/panel/get_version)
if [ "$version" = '' ];then
version='8.0.1'
version='8.0.5'
fi
armCheck=$(uname -m|grep arm)
if [ "${armCheck}" ];then
@@ -58,6 +63,7 @@ if [ $dsize -lt 10240 ];then
echo "获取更新包失败,请稍后更新或联系宝塔运维"
exit;
fi
unzip -o /tmp/panel.zip -d $setup_path/server/ > /dev/null
rm -f /tmp/panel.zip
cd $setup_path/server/panel/
@@ -67,11 +73,13 @@ if [ "${check_bt}" = "" ];then
wget -O /etc/init.d/bt $download_Url/install/src/bt7.init -T 20
chmod +x /etc/init.d/bt
fi
echo "=============================================================="
echo "正在修复面板依赖问题"
rm -f /www/server/panel/*.pyc
rm -f /www/server/panel/class/*.pyc
#pip install flask_sqlalchemy
#pip install itsdangerous==0.24
btpip install natsort
pip_list=$($mypip list)
request_v=$(btpip list 2>/dev/null|grep "requests "|awk '{print $2}'|cut -d '.' -f 2)
if [ "$request_v" = "" ] || [ "${request_v}" -gt "28" ];then
@@ -92,12 +100,23 @@ pymysql=$(echo "$pip_list"|grep pymysql)
if [ "$pymysql" = "" ];then
$mypip install pymysql
fi
GEVENT_V=$(btpip list 2> /dev/null|grep "gevent "|awk '{print $2}'|cut -f 1 -d '.')
if [ "${GEVENT_V}" -le "1" ];then
/www/server/panel/pyenv/bin/pip3 install -I gevent
fi
btpip uninstall enum34 -y
btpip install geoip2==4.7.0
btpip install pandas
pymysql=$(echo "$pip_list"|grep pycryptodome)
if [ "$pymysql" = "" ];then
$mypip install pycryptodome
fi
echo "修复面板依赖完成!"
echo "==========================================="
#psutil=$(echo "$pip_list"|grep psutil|awk '{print $2}'|grep '5.7.')
#if [ "$psutil" = "" ];then
# $mypip install -U psutil

View File

@@ -14,10 +14,14 @@ if [ "${is64bit}" != '64' ];then
echo "退出、不做任何操作"
exit 1
fi
Centos6Check=$(cat /etc/redhat-release | grep ' 6.' | grep -iE 'centos|Red Hat')
if [ "${Centos6Check}" ];then
echo "Centos6不支持升级宝塔面板建议备份数据重装更换Centos7/8安装宝塔面板"
exit 1
fi
Btapi_Url='http://www.example.com'
up_plugin=0
download_file(){

View File

@@ -66,7 +66,7 @@ canvas {
top: 0;
display: flex;
align-items: center;
width: 24%;
width: 30%;
padding: 30px 10px 16px 20px;
border-radius: 8px;
background-color: #fff;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 194 KiB

After

Width:  |  Height:  |  Size: 206 KiB

View File

@@ -17,11 +17,17 @@ Route::post('/Auth/GetAuthToken', 'api/get_auth_token');
Route::post('/Auth/GetBindCode', 'api/return_error');
Route::any('/bt_monitor/update_history', 'api/btm_update_history');
Route::any('/bt_monitor/latest_version', 'api/btm_latest_version');
Route::any('/bt_waf/get_malicious_ip', 'api/get_ssl_list');
Route::any('/bt_waf/daily_count_v2', 'api/get_ssl_list');
Route::any('/bt_waf/latest_version', 'api/btwaf_latest_version');
Route::group('authorization', function () {
Route::post('/login', 'api/authorization_login');
Route::post('/info', 'api/authorization_info');
Route::post('/info_v2', 'api/authorization_info');
Route::post('/update_license', 'api/update_license');
Route::post('/get_unactivated_licenses', 'api/get_ssl_list');
Route::post('/is_obtained_btw_trial', 'api/is_obtained_btw_trial');
Route::miss('api/return_error');
});
@@ -43,6 +49,7 @@ Route::group('api', function () {
Route::get('/index/get_win_date', 'api/get_win_date');
Route::get('/panel/is_pro', 'api/is_pro');
Route::get('/getIpAddress', 'api/get_ip_address');
Route::get('/GetAD', 'api/return_empty');
Route::post('/Auth/GetAuthToken', 'api/get_auth_token');
Route::post('/Auth/GetBindCode', 'api/return_error');
Route::post('/Auth/GetSSLList', 'api/get_ssl_list');
@@ -91,6 +98,7 @@ Route::group('api', function () {
Route::get('/panel/notpro', 'api/return_empty');
Route::post('/Btdeployment/get_deplist', 'api/get_deplist');
Route::post('/panel/get_deplist', 'api/get_deplist');
Route::get('/ip/info_json', 'api/return_empty_array');
Route::post('/LinuxBeta', 'api/return_error');
Route::post('/panel/apple_beta', 'api/return_error');
@@ -103,11 +111,13 @@ Route::group('api', function () {
Route::get('/wpanel/get_beta_logs', 'api/get_beta_logs');
Route::post('/v2/common_v1_authorization/get_pricing', 'api/return_error2');
Route::post('/v2/common_v2_authorization/get_pricing', 'api/return_error2');
Route::any('/bt_waf/getSpiders', 'api/btwaf_getspiders');
Route::post('/bt_waf/addSpider', 'api/return_empty');
Route::post('/bt_waf/getVulScanInfoList', 'api/return_empty');
Route::post('/bt_waf/reportInterceptFail', 'api/return_empty');
Route::any('/panel/get_spider', 'api/get_spider');
Route::miss('api/return_error');
});

View File

@@ -16,7 +16,11 @@ def get_plugin_list(force = 0):
except Exception as ex:
raise public.error_conn_cloud(str(ex))
softList = json.loads(jsonData)
if type(softList)!=dict or 'list' not in softList: raise Exception('云端插件列表获取失败')
if type(softList)!=dict or 'list' not in softList:
if type(softList)==str:
raise Exception(softList)
else:
raise Exception('云端插件列表获取失败')
public.writeFile(cache_file, jsonData)
return softList

View File

@@ -63,6 +63,31 @@ if("undefined" != typeof bt && bt.hasOwnProperty("compute_confirm")){
});
}
}
if("undefined" != typeof bt && bt.hasOwnProperty("input_confirm")){
bt.input_confirm = function (config, callback) {
layer.open({
type: 1,
title: config.title,
area: '430px',
closeBtn: 2,
shadeClose: true,
btn: [lan['public'].ok, lan['public'].cancel],
content:
'<div class="bt-form hint_confirm pd30">\
<div class="hint_title">\
<i class="hint-confirm-icon"></i>\
<div class="hint_con">' +
config.msg +
'</div>\
</div>\
</div>',
yes: function (layers, index) {
layer.close(layers);
if (callback) callback();
},
});
}
}
if("undefined" != typeof database && database.hasOwnProperty("del_database")){
database.del_database = function (wid, dbname, obj, callback) {
var is_db_type = false, del_data = []

View File

@@ -16,7 +16,11 @@ def get_plugin_list(force = 0):
except Exception as ex:
raise public.error_conn_cloud(str(ex))
softList = json.loads(jsonData)
if type(softList)!=dict or 'list' not in softList: raise Exception('云端插件列表获取失败')
if type(softList)!=dict or 'list' not in softList:
if type(softList)==str:
raise Exception(softList)
else:
raise Exception('云端插件列表获取失败')
public.writeFile(cache_file, jsonData)
return softList

View File

@@ -16,6 +16,8 @@
- 全局搜索替换 https://www.bt.cn/api/ => http://www.example.com/api/需排除clearModel.py、scanningModel.py、ipsModel.py
- 全局搜索替换 http://www.bt.cn/api/ => http://www.example.com/api/需排除js文件
- 全局搜索替换 https://download.bt.cn/install/update6.sh => http://www.example.com/install/update6.sh
- class/ajax.py 文件 \# 是否执行升级程序 下面的 public.get_url() 改成 public.GetConfigValue('home')
@@ -55,20 +57,27 @@
__set_pyenv方法内temp_file = public.readFile(filename)这行代码下面加上
```python
temp_file = temp_file.replace('wget -O Tpublic.sh', '#wget -O Tpublic.sh')
temp_file = temp_file.replace('\cp -rpa Tpublic.sh', '#\cp -rpa Tpublic.sh')
temp_file = temp_file.replace('http://download.bt.cn/install/public.sh', 'http://www.example.com/install/public.sh')
temp_file = temp_file.replace('https://download.bt.cn/install/public.sh', 'http://www.example.com/install/public.sh')
```
- class/plugin_deployment.py 文件SetupPackage方法内替换 public.GetConfigValue('home') => 'https://www.bt.cn'
- install/install_soft.sh 在bash执行之前加入以下代码
- class/config.py 文件get_nps方法内data['nps'] = False改成Trueget_nps_new方法下面加上 return public.returnMsg(False, "获取问卷失败")
- script/flush_plugin.py 文件删除clear_hosts()一行
- script/reload_check.py 文件在第2行插入sys.exit()
- script/local_fix.sh 文件,${D_NODE_URL}替换成www.example.com
- tools.py 文件u_input == 16下面的public.get_url()替换成'http://www.example.com'
- install/install_soft.sh 在. 执行之前加入以下代码
```shell
sed -i "s/http:\/\/download.bt.cn\/install\/public.sh/http:\/\/www.example.com\/install\/public.sh/" lib.sh
sed -i "s/https:\/\/download.bt.cn\/install\/public.sh/http:\/\/www.example.com\/install\/public.sh/" lib.sh
sed -i "/wget -O Tpublic.sh/d" $name.sh
```
- install/public.sh 用官网最新版的[public.sh](http://download.bt.cn/install/public.sh)替换并去除最下面bt_check一行
@@ -79,6 +88,8 @@
PluginLoader.daemon_panel()
check_node_status()
- 去除WebRTC连接BTPanel/static/js/public.js 删除stun.start();这一行
- 去除首页广告BTPanel/static/js/index.js 文件删除两处index.recommend_paid_version()
@@ -114,7 +125,7 @@
- [可选]上传文件默认选中覆盖在BTPanel/static/js/upload-drog.jsid="all_operation"加checked属性
解压安装包panel6.zip将更新包改好的文件覆盖到里面然后重新打包即可更新安装包。
解压安装包[panel6.zip](http://download.bt.cn/install/src/panel6.zip),将更新包改好的文件覆盖到里面,然后重新打包,即可更新安装包。(
别忘了删除class文件夹里面所有的.so文件