Browse Source

update

tags/2.0 2.0
flucout 1 year ago
parent
commit
22ca21ea77
  1. 16
      app/command/UpdateAll.php
  2. 37
      app/controller/Admin.php
  3. 28
      app/controller/Api.php
  4. 282
      app/lib/BtPlugins.php
  5. 254
      app/lib/Plugins.php
  6. 203
      app/lib/ThirdPlugins.php
  7. 4
      app/script/convert.sh
  8. 7
      app/view/admin/layout.html
  9. 6
      app/view/admin/list.html
  10. 4
      app/view/admin/log.html
  11. 72
      app/view/admin/plugins.html
  12. 72
      app/view/admin/pluginswin.html
  13. 4
      app/view/admin/record.html
  14. 169
      app/view/admin/set.html
  15. 8
      install.sql
  16. 13
      public/install/install_6.0.sh
  17. 3
      public/install/install_btmonitor.sh
  18. BIN
      public/install/src/bt-monitor-2.2.9.zip
  19. BIN
      public/install/src/panel6.zip
  20. BIN
      public/install/update/LinuxPanel-8.0.2.zip
  21. 12
      public/install/update6.sh
  22. 3
      public/install/update_btmonitor.sh
  23. BIN
      public/win/panel/panel_7.9.0.zip
  24. 3
      route/app.php
  25. 2
      wiki/update.md

16
app/command/UpdateAll.php

@ -25,10 +25,10 @@ class UpdateAll extends Command
$res = Db::name('config')->cache('configs',0)->column('value','key'); $res = Db::name('config')->cache('configs',0)->column('value','key');
Config::set($res, 'sys'); Config::set($res, 'sys');
if(config_get('bt_url')){
if(!config_get('bt_type') && config_get('bt_url') || config_get('bt_type')==1 && config_get('bt_surl')){
$this->process_plugins($input, $output, 'Linux'); $this->process_plugins($input, $output, 'Linux');
} }
if(config_get('wbt_url')){
if(!config_get('wbt_type') && config_get('wbt_url') || config_get('wbt_type')==1 && config_get('wbt_surl')){
$this->process_plugins($input, $output, 'Windows'); $this->process_plugins($input, $output, 'Windows');
} }
@ -103,16 +103,4 @@ class UpdateAll extends Command
return false; return false;
} }
} }
private function download_plugin_image(Input $input, Output $output, $fname){
try{
Plugins::download_plugin_other($fname);
$output->writeln('下载图片: '.$fname.' 成功');
return true;
}catch(\Exception $e){
$output->writeln($fname.' '.$e->getMessage());
errorlog($fname.' '.$e->getMessage());
return false;
}
}
} }

37
app/controller/Admin.php

@ -129,20 +129,33 @@ class Admin extends BaseController
} }
public function testbturl(){ public function testbturl(){
$bt_url = input('post.bt_url');
$bt_key = input('post.bt_key');
if(!$bt_url || !$bt_key)return json(['code'=>-1, 'msg'=>'参数不能为空']);
$btapi = new Btapi($bt_url, $bt_key);
$result = $btapi->get_config();
if($result && isset($result['status']) && ($result['status']==1 || isset($result['sites_path']))){
$result = $btapi->get_user_info();
if($result && isset($result['username'])){
return json(['code'=>0, 'msg'=>'面板连接测试成功!']);
$bt_type = input('post.bt_type/d');
if($bt_type == 1){
$bt_surl = input('post.bt_surl');
if(!$bt_surl)return json(['code'=>-1, 'msg'=>'参数不能为空']);
$res = get_curl($bt_surl . 'api/SetupCount');
if(strpos($res, 'ok')!==false){
return json(['code'=>0, 'msg'=>'第三方云端连接测试成功!']);
}else{ }else{
return json(['code'=>-1, 'msg'=>'面板连接测试成功,但未安装专用插件']);
return json(['code'=>-1, 'msg'=>'第三方云端连接测试失败']);
} }
}else{ }else{
return json(['code'=>-1, 'msg'=>isset($result['msg'])?$result['msg']:'面板地址无法连接']);
$bt_url = input('post.bt_url');
$bt_key = input('post.bt_key');
if(!$bt_url || !$bt_key)return json(['code'=>-1, 'msg'=>'参数不能为空']);
$btapi = new Btapi($bt_url, $bt_key);
$result = $btapi->get_config();
if($result && isset($result['status']) && ($result['status']==1 || isset($result['sites_path']))){
$result = $btapi->get_user_info();
if($result && isset($result['username'])){
return json(['code'=>0, 'msg'=>'面板连接测试成功!']);
}else{
return json(['code'=>-1, 'msg'=>'面板连接测试成功,但未安装专用插件']);
}
}else{
return json(['code'=>-1, 'msg'=>isset($result['msg'])?$result['msg']:'面板地址无法连接']);
}
} }
} }
@ -151,6 +164,7 @@ class Admin extends BaseController
$json_arr = Plugins::get_plugin_list(); $json_arr = Plugins::get_plugin_list();
if($json_arr){ if($json_arr){
foreach($json_arr['type'] as $type){ foreach($json_arr['type'] as $type){
if($type['title'] == '一键部署') continue;
$typelist[$type['id']] = $type['title']; $typelist[$type['id']] = $type['title'];
} }
} }
@ -163,6 +177,7 @@ class Admin extends BaseController
$json_arr = Plugins::get_plugin_list('Windows'); $json_arr = Plugins::get_plugin_list('Windows');
if($json_arr){ if($json_arr){
foreach($json_arr['type'] as $type){ foreach($json_arr['type'] as $type){
if($type['title'] == '一键部署') continue;
$typelist[$type['id']] = $type['title']; $typelist[$type['id']] = $type['title'];
} }
} }

28
app/controller/Api.php

@ -31,15 +31,9 @@ class Api extends BaseController
}else{ }else{
Db::name('record')->insert(['ip'=>$this->clientip, 'addtime'=>date("Y-m-d H:i:s"), 'usetime'=>date("Y-m-d H:i:s")]); Db::name('record')->insert(['ip'=>$this->clientip, 'addtime'=>date("Y-m-d H:i:s"), 'usetime'=>date("Y-m-d H:i:s")]);
} }
$json_file = get_data_dir('Windows').'config/plugin_list.json';
if(file_exists($json_file)){
$data = file_get_contents($json_file);
$json_arr = json_decode($data, true);
if($json_arr){
return json($json_arr);
}
}
return json((object)[]);
$json_arr = Plugins::get_plugin_list('Windows');
if(!$json_arr) return json((object)[]);
return json($json_arr);
} }
//下载插件包 //下载插件包
@ -351,20 +345,12 @@ class Api extends BaseController
} }
public function btwaf_getspiders(){ public function btwaf_getspiders(){
$result = cache('btwaf_getspiders');
if($result){
try{
$result = Plugins::btwaf_getspiders();
return json($result); return json($result);
}catch(\Exception $e){
return json(['status'=>false, 'msg'=>$e->getMessage()]);
} }
$bt_url = config_get('bt_url');
$bt_key = config_get('bt_key');
if(!$bt_url || !$bt_key) return json([]);
$btapi = new \app\lib\Btapi($bt_url, $bt_key);
$result = $btapi->btwaf_getspiders();
if(isset($result['status']) && $result['status']){
cache('btwaf_getspiders', $result['data'], 3600 * 24 * 3);
return json($result['data']);
}
return json($result);
} }
//检查黑白名单 //检查黑白名单

282
app/lib/BtPlugins.php

@ -0,0 +1,282 @@
<?php
namespace app\lib;
use Exception;
use ZipArchive;
class BtPlugins
{
private $btapi;
private $os;
//需屏蔽的插件名称列表
private static $block_plugins = ['dns'];
public function __construct($os){
$this->os = $os;
if($os == 'Windows'){
$bt_url = config_get('wbt_url');
$bt_key = config_get('wbt_key');
}else{
$bt_url = config_get('bt_url');
$bt_key = config_get('bt_key');
}
if(!$bt_url || !$bt_key) throw new Exception('请先配置好宝塔面板接口信息');
$this->btapi = new Btapi($bt_url, $bt_key);
}
//获取插件列表
public function get_plugin_list(){
$result = $this->btapi->get_plugin_list();
if($result && isset($result['list']) && isset($result['type'])){
if(empty($result['list']) || empty($result['type'])){
throw new Exception('获取插件列表失败:插件列表为空');
}
foreach($result['list'] as $k=>$v){
if(in_array($v['name'], self::$block_plugins)) unset($result['list'][$k]);
}
return $result;
}else{
throw new Exception('获取插件列表失败:'.(isset($result['msg'])?$result['msg']:'面板连接失败'));
}
}
//下载插件(自动判断是否第三方)
public function download_plugin($plugin_name, $version, $plugin_info){
if($plugin_info['type'] == 10 && isset($plugin_info['versions'][0]['download'])){
if($plugin_info['price'] == 0){
$this->btapi->create_plugin_other_order($plugin_info['id']);
}
$fname = $plugin_info['versions'][0]['download'];
$filemd5 = $plugin_info['versions'][0]['md5'];
$this->download_plugin_other($fname, $filemd5);
if(isset($plugin_info['min_image']) && strpos($plugin_info['min_image'], 'fname=')){
$fname = substr($plugin_info['min_image'], strpos($plugin_info['min_image'], '?fname=')+7);
$this->download_plugin_other($fname);
}
}else{
$this->download_plugin_package($plugin_name, $version);
}
}
//下载插件包
private function download_plugin_package($plugin_name, $version){
$filepath = get_data_dir($this->os).'plugins/package/'.$plugin_name.'-'.$version.'.zip';
$result = $this->btapi->get_plugin_filename($plugin_name, $version);
if($result && isset($result['status'])){
if($result['status'] == true){
$filename = $result['filename'];
$this->download_file($filename, $filepath);
if(file_exists($filepath)){
$zip = new ZipArchive;
if ($zip->open($filepath) === true)
{
$zip->extractTo(get_data_dir($this->os).'plugins/folder/'.$plugin_name.'-'.$version);
$zip->close();
$main_filepath = get_data_dir($this->os).'plugins/folder/'.$plugin_name.'-'.$version.'/'.$plugin_name.'/'.$plugin_name.'_main.py';
if(file_exists($main_filepath) && filesize($main_filepath)>10){
if(!strpos(file_get_contents($main_filepath), 'import ')){ //加密py文件,需要解密
$this->decode_plugin_main($plugin_name, $version, $main_filepath);
$this->noauth_plugin_main($main_filepath);
$zip->open($filepath, ZipArchive::CREATE);
$zip->addFile($main_filepath, $plugin_name.'/'.$plugin_name.'_main.py');
$zip->close();
}
}
}else{
unlink($filepath);
throw new Exception('插件包解压缩失败');
}
return true;
}else{
throw new Exception('下载插件包失败,本地文件不存在');
}
}else{
throw new Exception('下载插件包失败:'.($result['msg']?$result['msg']:'未知错误'));
}
}else{
throw new Exception('下载插件包失败,接口返回错误');
}
}
//下载插件主程序文件
public function download_plugin_main($plugin_name, $version){
$filepath = get_data_dir($this->os).'plugins/main/'.$plugin_name.'-'.$version.'.dat';
$result = $this->btapi->get_plugin_main_filename($plugin_name, $version);
if($result && isset($result['status'])){
if($result['status'] == true){
$filename = $result['filename'];
$this->download_file($filename, $filepath);
if(file_exists($filepath)){
return true;
}else{
throw new Exception('下载插件主程序文件失败,本地文件不存在');
}
}else{
throw new Exception('下载插件主程序文件失败:'.($result['msg']?$result['msg']:'未知错误'));
}
}else{
throw new Exception('下载插件主程序文件失败,接口返回错误');
}
}
//解密并下载插件主程序文件
private function decode_plugin_main($plugin_name, $version, $main_filepath){
if($this->decode_plugin_main_local($main_filepath)) return true;
$result = $this->btapi->get_decode_plugin_main($plugin_name, $version);
if($result && isset($result['status'])){
if($result['status'] == true){
$filename = $result['filename'];
$this->download_file($filename, $main_filepath);
return true;
}else{
throw new Exception('解密插件主程序文件失败:'.($result['msg']?$result['msg']:'未知错误'));
}
}else{
throw new Exception('解密插件主程序文件失败,接口返回错误');
}
}
//本地解密插件主程序文件
public function decode_plugin_main_local($main_filepath){
$userinfo = $this->btapi->get_user_info();
if(isset($userinfo['uid'])){
$src = file_get_contents($main_filepath);
if($src===false)throw new Exception('文件打开失败');
if(!$src || strpos($src, 'import ')!==false)return true;
$uid = $userinfo['uid'];
$serverid = $userinfo['serverid'];
$key = md5(substr($serverid, 10, 16).$uid.$serverid);
$iv = md5($key.$serverid);
$key = substr($key, 8, 16);
$iv = substr($iv, 8, 16);
$data_arr = explode("\n", $src);
$de_text = '';
foreach($data_arr as $data){
$data = trim($data);
if(!empty($data) && strlen($data)!=24){
$tmp = openssl_decrypt($data, 'aes-128-cbc', $key, 0, $iv);
if($tmp) $de_text .= $tmp;
}
}
if(!empty($de_text) && strpos($de_text, 'import ')!==false){
file_put_contents($main_filepath, $de_text);
return true;
}
return false;
}else{
throw new Exception('解密插件主程序文件失败,获取用户信息失败');
}
}
//去除插件主程序文件授权校验
private function noauth_plugin_main($main_filepath){
$data = file_get_contents($main_filepath);
if(!$data) return false;
$data = str_replace('\'http://www.bt.cn/api/panel/get_soft_list_test', 'public.GetConfigValue(\'home\')+\'/api/panel/get_soft_list_test', $data);
$data = str_replace('\'https://www.bt.cn/api/panel/get_soft_list_test', 'public.GetConfigValue(\'home\')+\'/api/panel/get_soft_list_test', $data);
$data = str_replace('\'http://www.bt.cn/api/panel/get_soft_list', 'public.GetConfigValue(\'home\')+\'/api/panel/get_soft_list', $data);
$data = str_replace('\'https://www.bt.cn/api/panel/get_soft_list', 'public.GetConfigValue(\'home\')+\'/api/panel/get_soft_list', $data);
$data = str_replace('\'http://www.bt.cn/api/panel/notpro', 'public.GetConfigValue(\'home\')+\'/api/panel/notpro', $data);
$data = str_replace('\'https://www.bt.cn/api/panel/notpro', 'public.GetConfigValue(\'home\')+\'/api/panel/notpro', $data);
$data = str_replace('\'http://www.bt.cn/api/wpanel/get_soft_list_test', 'public.GetConfigValue(\'home\')+\'/api/wpanel/get_soft_list_test', $data);
$data = str_replace('\'https://www.bt.cn/api/wpanel/get_soft_list_test', 'public.GetConfigValue(\'home\')+\'/api/wpanel/get_soft_list_test', $data);
$data = str_replace('\'http://www.bt.cn/api/wpanel/get_soft_list', 'public.GetConfigValue(\'home\')+\'/api/wpanel/get_soft_list', $data);
$data = str_replace('\'https://www.bt.cn/api/wpanel/get_soft_list', 'public.GetConfigValue(\'home\')+\'/api/wpanel/get_soft_list', $data);
$data = str_replace('\'http://www.bt.cn/api/wpanel/notpro', 'public.GetConfigValue(\'home\')+\'/api/wpanel/notpro', $data);
$data = str_replace('\'https://www.bt.cn/api/wpanel/notpro', 'public.GetConfigValue(\'home\')+\'/api/wpanel/notpro', $data);
$data = str_replace('\'http://www.bt.cn/api/bt_waf/getSpiders', 'public.GetConfigValue(\'home\')+\'/api/bt_waf/getSpiders', $data);
$data = str_replace('\'https://www.bt.cn/api/bt_waf/getSpiders', 'public.GetConfigValue(\'home\')+\'/api/bt_waf/getSpiders', $data);
$data = str_replace('\'http://www.bt.cn/api/bt_waf/addSpider', 'public.GetConfigValue(\'home\')+\'/api/bt_waf/addSpider', $data);
$data = str_replace('\'https://www.bt.cn/api/bt_waf/addSpider', 'public.GetConfigValue(\'home\')+\'/api/bt_waf/addSpider', $data);
$data = str_replace('\'https://www.bt.cn/api/bt_waf/getVulScanInfoList', 'public.GetConfigValue(\'home\')+\'/api/bt_waf/getVulScanInfoList', $data);
$data = str_replace('\'https://www.bt.cn/api/bt_waf/reportInterceptFail', 'public.GetConfigValue(\'home\')+\'/api/bt_waf/reportInterceptFail', $data);
$data = str_replace('\'https://www.bt.cn/api/v2/contact/nps/questions', 'public.GetConfigValue(\'home\')+\'/panel/notpro', $data);
$data = str_replace('\'https://www.bt.cn/api/v2/contact/nps/submit', 'public.GetConfigValue(\'home\')+\'/panel/notpro', $data);
file_put_contents($main_filepath, $data);
}
//下载插件其他文件
private function download_plugin_other($fname, $filemd5 = null){
$filepath = get_data_dir().'plugins/other/'.$fname;
@mkdir(dirname($filepath), 0777, true);
$result = $this->btapi->get_plugin_other_filename($fname);
if($result && isset($result['status'])){
if($result['status'] == true){
$filename = $result['filename'];
$this->download_file($filename, $filepath);
if(file_exists($filepath)){
if($filemd5 && md5_file($filepath) != $filemd5){
$msg = filesize($filepath) < 300 ? file_get_contents($filepath) : '插件文件MD5校验失败';
@unlink($filepath);
throw new Exception($msg);
}
return true;
}else{
throw new Exception('下载插件文件失败,本地文件不存在');
}
}else{
throw new Exception('下载插件文件失败:'.($result['msg']?$result['msg']:'未知错误'));
}
}else{
throw new Exception('下载插件文件失败,接口返回错误');
}
}
//下载文件
private function download_file($filename, $filepath){
try{
$this->btapi->download($filename, $filepath);
}catch(Exception $e){
@unlink($filepath);
//宝塔bug小文件下载失败,改用base64下载
$result = $this->btapi->get_file($filename);
if($result && isset($result['status']) && $result['status']==true){
$filedata = base64_decode($result['data']);
if(strlen($filedata) < 4096 && substr($filedata,0,1)=='{' && substr($filedata,-1,1)=='}'){
$arr = json_decode($filedata, true);
if($arr){
throw new Exception('获取文件失败:'.($arr['msg']?$arr['msg']:'未知错误'));
}
}
if(!$filedata){
throw new Exception('获取文件失败:文件内容为空');
}
file_put_contents($filepath, $filedata);
}elseif($result){
throw new Exception('获取文件失败:'.($result['msg']?$result['msg']:'未知错误'));
}else{
throw new Exception('获取文件失败:未知错误');
}
}
}
//获取一键部署列表
public function get_deplist(){
$result = $this->btapi->get_deplist();
if($result && isset($result['list']) && isset($result['type'])){
if(empty($result['list']) || empty($result['type'])){
throw new Exception('获取一键部署列表失败:一键部署列表为空');
}
return $result;
}else{
throw new Exception('获取一键部署列表失败:'.(isset($result['msg'])?$result['msg']:'面板连接失败'));
}
}
//获取蜘蛛IP列表
public function btwaf_getspiders(){
$result = $this->btapi->btwaf_getspiders();
if(isset($result['status']) && $result['status']){
return $result['data'];
}else{
throw new Exception(isset($result['msg'])?$result['msg']:'获取失败');
}
}
}

254
app/lib/Plugins.php

@ -9,30 +9,23 @@ class Plugins
{ {
private static function get_btapi($os){ private static function get_btapi($os){
if($os == 'Windows'){
$bt_url = config_get('wbt_url');
$bt_key = config_get('wbt_key');
if(self::is_third($os)){
return new ThirdPlugins($os);
}else{ }else{
$bt_url = config_get('bt_url');
$bt_key = config_get('bt_key');
return new BtPlugins($os);
} }
if(!$bt_url || !$bt_key) throw new Exception('请先配置好宝塔面板接口信息');
$btapi = new Btapi($bt_url, $bt_key);
return $btapi;
}
private static function is_third($os){
$type = $os == 'Windows' ? config_get('wbt_type') : config_get('bt_type');
return $type == 1;
} }
//刷新插件列表 //刷新插件列表
public static function refresh_plugin_list($os = 'Linux'){ public static function refresh_plugin_list($os = 'Linux'){
$btapi = self::get_btapi($os); $btapi = self::get_btapi($os);
$result = $btapi->get_plugin_list(); $result = $btapi->get_plugin_list();
if($result && isset($result['list']) && isset($result['type'])){
if(empty($result['list']) || empty($result['type'])){
throw new Exception('获取插件列表失败:插件列表为空');
}
self::save_plugin_list($result, $os);
}else{
throw new Exception('获取插件列表失败:'.(isset($result['msg'])?$result['msg']:'面板连接失败'));
}
self::save_plugin_list($result, $os);
} }
//保存插件列表 //保存插件列表
@ -84,136 +77,23 @@ class Plugins
public static function download_plugin($plugin_name, $version, $os = 'Linux'){ public static function download_plugin($plugin_name, $version, $os = 'Linux'){
$plugin_info = Plugins::get_plugin_info($plugin_name, $os); $plugin_info = Plugins::get_plugin_info($plugin_name, $os);
if(!$plugin_info) throw new Exception('未找到该插件信息'); if(!$plugin_info) throw new Exception('未找到该插件信息');
if($plugin_info['type'] == 10 && isset($plugin_info['versions'][0]['download'])){
if($plugin_info['price'] == 0){
$btapi = self::get_btapi($os);
$btapi->create_plugin_other_order($plugin_info['id']);
}
$fname = $plugin_info['versions'][0]['download'];
$filemd5 = $plugin_info['versions'][0]['md5'];
Plugins::download_plugin_other($fname, $filemd5, $os);
if(isset($plugin_info['min_image']) && strpos($plugin_info['min_image'], 'fname=')){
$fname = substr($plugin_info['min_image'], strpos($plugin_info['min_image'], '?fname=')+7);
Plugins::download_plugin_other($fname, null, $os);
}
}else{
Plugins::download_plugin_package($plugin_name, $version, $os);
}
}
//下载插件包
public static function download_plugin_package($plugin_name, $version, $os = 'Linux'){
$filepath = get_data_dir($os).'plugins/package/'.$plugin_name.'-'.$version.'.zip';
$btapi = self::get_btapi($os); $btapi = self::get_btapi($os);
$result = $btapi->get_plugin_filename($plugin_name, $version);
if($result && isset($result['status'])){
if($result['status'] == true){
$filename = $result['filename'];
self::download_file($btapi, $filename, $filepath);
if(file_exists($filepath)){
$zip = new ZipArchive;
if ($zip->open($filepath) === true)
{
$zip->extractTo(get_data_dir($os).'plugins/folder/'.$plugin_name.'-'.$version);
$zip->close();
$main_filepath = get_data_dir($os).'plugins/folder/'.$plugin_name.'-'.$version.'/'.$plugin_name.'/'.$plugin_name.'_main.py';
if(file_exists($main_filepath) && filesize($main_filepath)>10){
if(!strpos(file_get_contents($main_filepath), 'import ')){ //加密py文件,需要解密
self::decode_plugin_main($plugin_name, $version, $main_filepath, $os);
self::noauth_plugin_main($main_filepath);
$zip->open($filepath, ZipArchive::CREATE);
$zip->addFile($main_filepath, $plugin_name.'/'.$plugin_name.'_main.py');
$zip->close();
}
}
}else{
throw new Exception('插件包解压缩失败');
}
return true;
}else{
throw new Exception('下载插件包失败,本地文件不存在');
}
}else{
throw new Exception('下载插件包失败:'.($result['msg']?$result['msg']:'未知错误'));
}
}else{
throw new Exception('下载插件包失败,接口返回错误');
}
$btapi->download_plugin($plugin_name, $version, $plugin_info);
} }
//下载插件主程序文件 //下载插件主程序文件
public static function download_plugin_main($plugin_name, $version, $os = 'Linux'){ public static function download_plugin_main($plugin_name, $version, $os = 'Linux'){
$filepath = get_data_dir($os).'plugins/main/'.$plugin_name.'-'.$version.'.dat';
$btapi = self::get_btapi($os); $btapi = self::get_btapi($os);
$result = $btapi->get_plugin_main_filename($plugin_name, $version);
if($result && isset($result['status'])){
if($result['status'] == true){
$filename = $result['filename'];
self::download_file($btapi, $filename, $filepath);
if(file_exists($filepath)){
return true;
}else{
throw new Exception('下载插件主程序文件失败,本地文件不存在');
}
}else{
throw new Exception('下载插件主程序文件失败:'.($result['msg']?$result['msg']:'未知错误'));
}
}else{
throw new Exception('下载插件主程序文件失败,接口返回错误');
}
}
//解密并下载插件主程序文件
public static function decode_plugin_main($plugin_name, $version, $main_filepath, $os = 'Linux'){
if(self::decode_plugin_main_local($main_filepath, $os)) return true;
$btapi = self::get_btapi($os);
$result = $btapi->get_decode_plugin_main($plugin_name, $version);
if($result && isset($result['status'])){
if($result['status'] == true){
$filename = $result['filename'];
self::download_file($btapi, $filename, $main_filepath);
return true;
}else{
throw new Exception('解密插件主程序文件失败:'.($result['msg']?$result['msg']:'未知错误'));
}
}else{
throw new Exception('解密插件主程序文件失败,接口返回错误');
}
$btapi->download_plugin_main($plugin_name, $version);
} }
//本地解密插件主程序文件 //本地解密插件主程序文件
public static function decode_plugin_main_local($main_filepath, $os = 'Linux'){ public static function decode_plugin_main_local($main_filepath, $os = 'Linux'){
$btapi = self::get_btapi($os);
$userinfo = $btapi->get_user_info();
if(isset($userinfo['uid'])){
$src = file_get_contents($main_filepath);
if($src===false)throw new Exception('文件打开失败');
if(!$src || strpos($src, 'import ')!==false)return true;
$uid = $userinfo['uid'];
$serverid = $userinfo['serverid'];
$key = md5(substr($serverid, 10, 16).$uid.$serverid);
$iv = md5($key.$serverid);
$key = substr($key, 8, 16);
$iv = substr($iv, 8, 16);
$data_arr = explode("\n", $src);
$de_text = '';
foreach($data_arr as $data){
$data = trim($data);
if(!empty($data) && strlen($data)!=24){
$tmp = openssl_decrypt($data, 'aes-128-cbc', $key, 0, $iv);
if($tmp) $de_text .= $tmp;
}
}
if(!empty($de_text) && strpos($de_text, 'import ')!==false){
file_put_contents($main_filepath, $de_text);
return true;
}
return false;
}else{
throw new Exception('解密插件主程序文件失败,获取用户信息失败');
}
$btapi = new BtPlugins($os);
return $btapi->decode_plugin_main_local($main_filepath);
} }
//本地解密模块文件
public static function decode_module_file($filepath){ public static function decode_module_file($filepath){
$src = file_get_contents($filepath); $src = file_get_contents($filepath);
if($src===false)throw new Exception('文件打开失败'); if($src===false)throw new Exception('文件打开失败');
@ -236,101 +116,13 @@ class Plugins
return 2; return 2;
} }
//去除插件主程序文件授权校验
public static function noauth_plugin_main($main_filepath){
$data = file_get_contents($main_filepath);
if(!$data) return false;
$data = str_replace('\'http://www.bt.cn/api/panel/get_soft_list_test', 'public.GetConfigValue(\'home\')+\'/api/panel/get_soft_list_test', $data);
$data = str_replace('\'https://www.bt.cn/api/panel/get_soft_list_test', 'public.GetConfigValue(\'home\')+\'/api/panel/get_soft_list_test', $data);
$data = str_replace('\'http://www.bt.cn/api/panel/get_soft_list', 'public.GetConfigValue(\'home\')+\'/api/panel/get_soft_list', $data);
$data = str_replace('\'https://www.bt.cn/api/panel/get_soft_list', 'public.GetConfigValue(\'home\')+\'/api/panel/get_soft_list', $data);
$data = str_replace('\'http://www.bt.cn/api/panel/notpro', 'public.GetConfigValue(\'home\')+\'/api/panel/notpro', $data);
$data = str_replace('\'https://www.bt.cn/api/panel/notpro', 'public.GetConfigValue(\'home\')+\'/api/panel/notpro', $data);
$data = str_replace('\'http://www.bt.cn/api/wpanel/get_soft_list_test', 'public.GetConfigValue(\'home\')+\'/api/wpanel/get_soft_list_test', $data);
$data = str_replace('\'https://www.bt.cn/api/wpanel/get_soft_list_test', 'public.GetConfigValue(\'home\')+\'/api/wpanel/get_soft_list_test', $data);
$data = str_replace('\'http://www.bt.cn/api/wpanel/get_soft_list', 'public.GetConfigValue(\'home\')+\'/api/wpanel/get_soft_list', $data);
$data = str_replace('\'https://www.bt.cn/api/wpanel/get_soft_list', 'public.GetConfigValue(\'home\')+\'/api/wpanel/get_soft_list', $data);
$data = str_replace('\'http://www.bt.cn/api/wpanel/notpro', 'public.GetConfigValue(\'home\')+\'/api/wpanel/notpro', $data);
$data = str_replace('\'https://www.bt.cn/api/wpanel/notpro', 'public.GetConfigValue(\'home\')+\'/api/wpanel/notpro', $data);
$data = str_replace('\'http://www.bt.cn/api/bt_waf/getSpiders', 'public.GetConfigValue(\'home\')+\'/api/bt_waf/getSpiders', $data);
$data = str_replace('\'https://www.bt.cn/api/bt_waf/getSpiders', 'public.GetConfigValue(\'home\')+\'/api/bt_waf/getSpiders', $data);
file_put_contents($main_filepath, $data);
}
//下载插件其他文件
public static function download_plugin_other($fname, $filemd5 = null, $os = 'Linux'){
$filepath = get_data_dir().'plugins/other/'.$fname;
@mkdir(dirname($filepath), 0777, true);
$btapi = self::get_btapi($os);
$result = $btapi->get_plugin_other_filename($fname);
if($result && isset($result['status'])){
if($result['status'] == true){
$filename = $result['filename'];
self::download_file($btapi, $filename, $filepath);
if(file_exists($filepath)){
if($filemd5 && md5_file($filepath) != $filemd5){
$msg = filesize($filepath) < 300 ? file_get_contents($filepath) : '插件文件MD5校验失败';
@unlink($filepath);
throw new Exception($msg);
}
return true;
}else{
throw new Exception('下载插件文件失败,本地文件不存在');
}
}else{
throw new Exception('下载插件文件失败:'.($result['msg']?$result['msg']:'未知错误'));
}
}else{
throw new Exception('下载插件文件失败,接口返回错误');
}
}
//下载文件
private static function download_file($btapi, $filename, $filepath){
try{
$btapi->download($filename, $filepath);
}catch(Exception $e){
@unlink($filepath);
//宝塔bug小文件下载失败,改用base64下载
$result = $btapi->get_file($filename);
if($result && isset($result['status']) && $result['status']==true){
$filedata = base64_decode($result['data']);
if(strlen($filedata) < 4096 && substr($filedata,0,1)=='{' && substr($filedata,-1,1)=='}'){
$arr = json_decode($filedata, true);
if($arr){
throw new Exception('获取文件失败:'.($arr['msg']?$arr['msg']:'未知错误'));
}
}
if(!$filedata){
throw new Exception('获取文件失败:文件内容为空');
}
file_put_contents($filepath, $filedata);
}elseif($result){
throw new Exception('获取文件失败:'.($result['msg']?$result['msg']:'未知错误'));
}else{
throw new Exception('获取文件失败:未知错误');
}
}
}
//刷新一键部署列表 //刷新一键部署列表
public static function refresh_deplist($os = 'Linux'){ public static function refresh_deplist($os = 'Linux'){
$btapi = self::get_btapi($os); $btapi = self::get_btapi($os);
$result = $btapi->get_deplist(); $result = $btapi->get_deplist();
if($result && isset($result['list']) && isset($result['type'])){
if(empty($result['list']) || empty($result['type'])){
throw new Exception('获取一键部署列表失败:一键部署列表为空');
}
$json_file = get_data_dir($os).'config/deployment_list.json';
if(!file_put_contents($json_file, json_encode($result))){
throw new Exception('保存一键部署列表失败,文件无写入权限');
}
}else{
throw new Exception('获取一键部署列表失败:'.(isset($result['msg'])?$result['msg']:'面板连接失败'));
$json_file = get_data_dir($os).'config/deployment_list.json';
if(!file_put_contents($json_file, json_encode($result))){
throw new Exception('保存一键部署列表失败,文件无写入权限');
} }
} }
@ -347,4 +139,16 @@ class Plugins
return false; return false;
} }
//获取蜘蛛IP列表
public static function btwaf_getspiders(){
$result = cache('btwaf_getspiders');
if($result){
return $result;
}
$btapi = self::get_btapi('Linux');
$result = $btapi->btwaf_getspiders();
cache('btwaf_getspiders', $result, 3600 * 24 * 3);
return $result;
}
} }

203
app/lib/ThirdPlugins.php

@ -0,0 +1,203 @@
<?php
namespace app\lib;
use Exception;
use ZipArchive;
class ThirdPlugins
{
private $url;
private $os;
public function __construct($os)
{
$this->os = $os;
$url = $os == 'Windows' ? config_get('wbt_surl') : config_get('bt_surl');
if(!$url) throw new Exception('请先配置好第三方云端首页URL');
$this->url = $url;
}
//获取插件列表
public function get_plugin_list()
{
$url = $this->os == 'Windows' ? $this->url . 'api/wpanel/get_soft_list' : $this->url . 'api/panel/get_soft_list';
$res = $this->curl($url);
$result = json_decode($res, true);
if($result && isset($result['list']) && isset($result['type'])){
if(empty($result['list']) || empty($result['type'])){
throw new Exception('获取插件列表失败:插件列表为空');
}
return $result;
}else{
throw new Exception('获取插件列表失败:'.(isset($result['msg'])?$result['msg']:'第三方云端连接失败'));
}
}
//下载插件(自动判断是否第三方)
public function download_plugin($plugin_name, $version, $plugin_info){
if($plugin_info['type'] == 10 && isset($plugin_info['versions'][0]['download'])){
$fname = $plugin_info['versions'][0]['download'];
$filemd5 = $plugin_info['versions'][0]['md5'];
$this->download_plugin_other($fname, $filemd5);
if(isset($plugin_info['min_image']) && strpos($plugin_info['min_image'], 'fname=')){
$fname = substr($plugin_info['min_image'], strpos($plugin_info['min_image'], '?fname=')+7);
$this->download_plugin_other($fname);
}
}else{
$this->download_plugin_package($plugin_name, $version);
}
}
//下载插件包
private function download_plugin_package($plugin_name, $version){
$filepath = get_data_dir($this->os).'plugins/package/'.$plugin_name.'-'.$version.'.zip';
$url = $this->url . 'down/download_plugin';
$post = ['name'=>$plugin_name, 'version'=>$version, 'os'=>$this->os];
$this->curl_download($url, $post, $filepath);
if(file_exists($filepath)){
$handle = fopen($filepath, "rb");
$file_head = fread($handle, 4);
fclose($handle);
if(bin2hex($file_head) === '504b0304'){
$zip = new ZipArchive;
if ($zip->open($filepath) === true)
{
$zip->extractTo(get_data_dir($this->os).'plugins/folder/'.$plugin_name.'-'.$version);
$zip->close();
return true;
}else{
@unlink($filepath);
throw new Exception('插件包解压缩失败');
}
}else{
$handle = fopen($filepath, "rb");
$errmsg = htmlspecialchars(fgets($handle));
fclose($handle);
@unlink($filepath);
throw new Exception('下载插件包失败:'.($errmsg?$errmsg:'未知错误'));
}
}else{
throw new Exception('下载插件包失败,本地文件不存在');
}
}
//下载插件主程序文件
public function download_plugin_main($plugin_name, $version){
$filepath = get_data_dir($this->os).'plugins/main/'.$plugin_name.'-'.$version.'.dat';
$url = $this->url . 'down/download_plugin_main';
$post = ['name'=>$plugin_name, 'version'=>$version, 'os'=>$this->os];
$this->curl_download($url, $post, $filepath);
if(file_exists($filepath)){
$line = count(file($filepath));
if($line > 3) return true;
$handle = fopen($filepath, "rb");
$errmsg = htmlspecialchars(fgets($handle));
fclose($handle);
@unlink($filepath);
throw new Exception('下载插件主程序文件失败:'.($errmsg?$errmsg:'未知错误'));
}else{
throw new Exception('下载插件主程序文件失败,本地文件不存在');
}
}
//下载插件其他文件
private function download_plugin_other($fname, $filemd5 = null){
$filepath = get_data_dir().'plugins/other/'.$fname;
@mkdir(dirname($filepath), 0777, true);
$url = $this->url . 'api/Pluginother/get_file?fname='.urlencode($fname);
$this->curl_download($url, false, $filepath);
if(file_exists($filepath)){
$handle = fopen($filepath, "rb");
$file_head = fread($handle, 15);
fclose($handle);
if($file_head === '{"status":false'){
$res = file_get_contents($filepath);
$result = json_decode($res, true);
@unlink($filepath);
throw new Exception('下载插件文件失败:'.($result?$result['msg']:'未知错误'));
}
if($filemd5 && md5_file($filepath) != $filemd5){
$msg = filesize($filepath) < 300 ? file_get_contents($filepath) : '插件文件MD5校验失败';
@unlink($filepath);
throw new Exception($msg);
}
return true;
}else{
throw new Exception('下载插件文件失败,本地文件不存在');
}
}
//获取一键部署列表
public function get_deplist(){
$url = $this->url . 'api/panel/get_deplist';
$post = ['os' => $this->os];
$res = $this->curl($url, http_build_query($post));
$result = json_decode($res, true);
if($result && isset($result['list']) && isset($result['type'])){
if(empty($result['list']) || empty($result['type'])){
throw new Exception('获取一键部署列表失败:一键部署列表为空');
}
return $result;
}else{
throw new Exception('获取一键部署列表失败:'.(isset($result['msg'])?$result['msg']:'第三方云端连接失败'));
}
}
//获取蜘蛛IP列表
public function btwaf_getspiders(){
$url = $this->url . 'api/bt_waf/getSpiders';
$res = $this->curl($url);
$result = json_decode($res, true);
if(isset($result['status']) && !$result['status']){
throw new Exception(isset($result['msg'])?$result['msg']:'获取失败');
}else{
return $result;
}
}
private function curl($url, $post = 0){
$ua = "Mozilla/5.0 (BtCloud; ".request()->root(true).")";
return get_curl($url, $post, 0, 0, 0, $ua);
}
private function curl_download($url, $post, $localpath, $timeout = 300)
{
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_TIMEOUT, $timeout);
$fp = fopen($localpath, 'w+');
curl_setopt($ch, CURLOPT_FILE, $fp);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (BtCloud; ".request()->root(true).")");
if($post){
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
}
curl_exec($ch);
if (curl_errno($ch)) {
$message = curl_error($ch);
curl_close($ch);
fclose($fp);
throw new Exception('下载文件失败:'.$message);
}
$httpcode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
if($httpcode>299){
curl_close($ch);
fclose($fp);
throw new Exception('下载文件失败:HTTPCODE-'.$httpcode);
}
curl_close($ch);
fclose($fp);
return true;
}
}

4
app/script/convert.sh

@ -1,8 +1,8 @@
#!/bin/bash #!/bin/bash
Linux_Version="8.0.1"
Linux_Version="8.0.2"
Windows_Version="7.9.0" Windows_Version="7.9.0"
Btm_Version="2.2.8"
Btm_Version="2.2.9"
FILES=( FILES=(
public/install/src/panel6.zip public/install/src/panel6.zip

7
app/view/admin/layout.html

@ -55,9 +55,10 @@
<a href="#" class="dropdown-toggle" data-toggle="dropdown"><i class="fa fa-cog"></i> 系统设置<b <a href="#" class="dropdown-toggle" data-toggle="dropdown"><i class="fa fa-cog"></i> 系统设置<b
class="caret"></b></a> class="caret"></b></a>
<ul class="dropdown-menu"> <ul class="dropdown-menu">
<li><a href="/admin/set">系统基本设置</a></li>
<li><a href="/admin/set/mod/task">定时任务设置</a></li>
<li><a href="/admin/set/mod/tools">批量替换工具</a></li>
<li><a href="/admin/set">软件版本设置</a></li>
<li><a href="/admin/set/mod/api">面板接口设置</a></li>
<li><a href="/admin/set/mod/task">自动更新插件设置</a></li>
<li><a href="/admin/set/mod/tools">替换与清理工具</a></li>
<li><a href="/admin/set/mod/account">管理账号设置</a></li> <li><a href="/admin/set/mod/account">管理账号设置</a></li>
</ul> </ul>
</li> </li>

6
app/view/admin/list.html

@ -31,9 +31,9 @@
<input type="text" class="form-control" name="ip" placeholder="服务器IP"> <input type="text" class="form-control" name="ip" placeholder="服务器IP">
</div> </div>
<div class="form-group"> <div class="form-group">
<button class="btn btn-primary" type="submit"><i class="fa fa-search"></i>搜索</button>&nbsp;
<a href="javascript:searchClear()" class="btn btn-default"><i class="fa fa-repeat"></i>重置</a>&nbsp;
<a href="javascript:add_item()" class="btn btn-success"><i class="fa fa-plus"></i>添加</a>&nbsp;
<button class="btn btn-primary" type="submit"><i class="fa fa-search"></i> 搜索</button>&nbsp;
<a href="javascript:searchClear()" class="btn btn-default"><i class="fa fa-repeat"></i> 重置</a>&nbsp;
<a href="javascript:add_item()" class="btn btn-success"><i class="fa fa-plus"></i> 添加</a>&nbsp;
</div> </div>
</form> </form>
</div> </div>

4
app/view/admin/log.html

@ -13,8 +13,8 @@
<input type="text" class="form-control" name="action" placeholder="操作类型"> <input type="text" class="form-control" name="action" placeholder="操作类型">
</div> </div>
<div class="form-group"> <div class="form-group">
<button class="btn btn-primary" type="submit"><i class="fa fa-search"></i>搜索</button>&nbsp;
<a href="javascript:searchClear()" class="btn btn-default"><i class="fa fa-repeat"></i>重置</a>&nbsp;
<button class="btn btn-primary" type="submit"><i class="fa fa-search"></i> 搜索</button>&nbsp;
<a href="javascript:searchClear()" class="btn btn-default"><i class="fa fa-repeat"></i> 重置</a>&nbsp;
</div> </div>
</form> </form>
</div> </div>

72
app/view/admin/plugins.html

@ -35,7 +35,6 @@ td{overflow: hidden;text-overflow: ellipsis;white-space: nowrap;max-width:340px;
<div class="modal-body"> <div class="modal-body">
<p>“版本与状态”一列中,红色的按钮代表本地不存在该版本插件包,需要点击下载;绿色的按钮代表已存在。</p> <p>“版本与状态”一列中,红色的按钮代表本地不存在该版本插件包,需要点击下载;绿色的按钮代表已存在。</p>
<p>官方插件包本地存储路径是/data/plugins/package/软件标识-版本号.zip,第三方插件包路径是/data/plugins/other/other/,对于部分包含二次验证的插件可以自行修改。</p> <p>官方插件包本地存储路径是/data/plugins/package/软件标识-版本号.zip,第三方插件包路径是/data/plugins/other/other/,对于部分包含二次验证的插件可以自行修改。</p>
<p>点击【重新获取】按钮会从宝塔官方获取最新插件列表,但是插件包需要手动点击下载。如果需要批量下载插件包,可查看<a href="/admin/set/mod/task">定时任务设置</a></p>
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button> <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
@ -57,10 +56,11 @@ td{overflow: hidden;text-overflow: ellipsis;white-space: nowrap;max-width:340px;
{foreach $typelist as $k=>$v}<option value="{$k}">{$v}</option>{/foreach} </select> {foreach $typelist as $k=>$v}<option value="{$k}">{$v}</option>{/foreach} </select>
</div> </div>
<div class="form-group"> <div class="form-group">
<button class="btn btn-primary" type="submit"><i class="fa fa-search"></i>搜索</button>&nbsp;
<a href="javascript:searchClear()" class="btn btn-default"><i class="fa fa-repeat"></i>重置</a>&nbsp;
<a href="javascript:refresh_plugins()" class="btn btn-success"><i class="fa fa-refresh"></i>重新获取</a>&nbsp;
<button type="button" class="btn btn-default" data-toggle="modal" data-target="#help"><i class="fa fa-info-circle"></i>帮助</button>
<button class="btn btn-primary" type="submit"><i class="fa fa-search"></i> 搜索</button>&nbsp;
<a href="javascript:searchClear()" class="btn btn-default"><i class="fa fa-repeat"></i> 重置</a>&nbsp;
<a href="javascript:refresh_plugins()" class="btn btn-success"><i class="fa fa-refresh"></i> 刷新列表</a>&nbsp;
<a href="javascript:download_plugins()" class="btn btn-warning" id="batch_down" style="display:none;"><i class="fa fa-download"></i> 批量下载</a>&nbsp;
<button type="button" class="btn btn-default" data-toggle="modal" data-target="#help"><i class="fa fa-info-circle"></i> 帮助</button>
</div> </div>
</form> </form>
</div> </div>
@ -139,6 +139,48 @@ function refresh_plugins(){
}); });
} }
function download_plugins(){
var confirm = layer.confirm('批量下载当前分类下未下载的插件包', {
btn: ['确定','取消']
}, function(){
layer.close(confirm)
$.downloadCount = 0;
$.preDownloadCount = $.preDownload.length;
download_item();
}, function(){
layer.close(confirm)
});
}
function download_item(){
if($.preDownload.length == 0){
layer.alert('成功下载'+$.downloadCount+'个插件包!', {icon:1}, function(){layer.closeAll();searchSubmit();});
return;
}
$.downloadCount++;
var plugin = $.preDownload[0];
var ii = layer.msg('['+$.downloadCount+'/'+$.preDownloadCount+']正在下载'+plugin.name+'-'+plugin.version, {icon: 16, shade:0.1, time: 0});
$.ajax({
type : 'POST',
url : '/admin/download_plugin',
data: { name:plugin.name, version:plugin.version},
dataType : 'json',
success : function(data) {
layer.close(ii)
if(data.code == 0){
$.preDownload.shift();
download_item();
}else{
layer.alert(data.msg, {icon:2});
}
},
error:function(data){
layer.close(ii)
layer.msg('服务器错误', {icon:2});
}
});
}
function searchByType(type){ function searchByType(type){
$("input[name=keyword]").val(''); $("input[name=keyword]").val('');
$("select[name=type]").val(type); $("select[name=type]").val(type);
@ -208,6 +250,26 @@ $(document).ready(function(){
} }
}, },
], ],
onLoadSuccess: function(data){
$.preDownload = [];
var type = $("select[name=type] option:selected").text();
if(type != '全部插件' && type != '运行环境' && type != '第三方应用'){
$("#batch_down").show();
if(data.length > 0){
$.each(data, function(index, plugin){
if(plugin.versions.length > 0){
$.each(plugin.versions, function(index, version){
if(!version.status){
$.preDownload.push({name:plugin.name, version:version.version})
}
});
}
});
}
}else{
$("#batch_down").hide();
}
}
}) })
}) })
</script> </script>

72
app/view/admin/pluginswin.html

@ -35,7 +35,6 @@ td{overflow: hidden;text-overflow: ellipsis;white-space: nowrap;max-width:340px;
<div class="modal-body"> <div class="modal-body">
<p>“版本与状态”一列中,红色的按钮代表本地不存在该版本插件包,需要点击下载;绿色的按钮代表已存在。</p> <p>“版本与状态”一列中,红色的按钮代表本地不存在该版本插件包,需要点击下载;绿色的按钮代表已存在。</p>
<p>官方插件包本地存储路径是/data/win/plugins/package/软件标识-版本号.zip,第三方插件包路径是/data/plugins/other/other/,对于部分包含二次验证的插件可以自行修改。</p> <p>官方插件包本地存储路径是/data/win/plugins/package/软件标识-版本号.zip,第三方插件包路径是/data/plugins/other/other/,对于部分包含二次验证的插件可以自行修改。</p>
<p>点击【重新获取】按钮会从宝塔官方获取最新插件列表,但是插件包需要手动点击下载。如果需要批量下载插件包,可查看<a href="/admin/set/mod/task">定时任务设置</a></p>
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button> <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
@ -57,10 +56,11 @@ td{overflow: hidden;text-overflow: ellipsis;white-space: nowrap;max-width:340px;
{foreach $typelist as $k=>$v}<option value="{$k}">{$v}</option>{/foreach} </select> {foreach $typelist as $k=>$v}<option value="{$k}">{$v}</option>{/foreach} </select>
</div> </div>
<div class="form-group"> <div class="form-group">
<button class="btn btn-primary" type="submit"><i class="fa fa-search"></i>搜索</button>&nbsp;
<a href="javascript:searchClear()" class="btn btn-default"><i class="fa fa-repeat"></i>重置</a>&nbsp;
<a href="javascript:refresh_plugins()" class="btn btn-success"><i class="fa fa-refresh"></i>重新获取</a>&nbsp;
<button type="button" class="btn btn-default" data-toggle="modal" data-target="#help"><i class="fa fa-info-circle"></i>帮助</button>
<button class="btn btn-primary" type="submit"><i class="fa fa-search"></i> 搜索</button>&nbsp;
<a href="javascript:searchClear()" class="btn btn-default"><i class="fa fa-repeat"></i> 重置</a>&nbsp;
<a href="javascript:refresh_plugins()" class="btn btn-success"><i class="fa fa-refresh"></i> 刷新列表</a>&nbsp;
<a href="javascript:download_plugins()" class="btn btn-warning" id="batch_down" style="display:none;"><i class="fa fa-download"></i> 批量下载</a>&nbsp;
<button type="button" class="btn btn-default" data-toggle="modal" data-target="#help"><i class="fa fa-info-circle"></i> 帮助</button>
</div> </div>
</form> </form>
</div> </div>
@ -139,6 +139,48 @@ function refresh_plugins(){
}); });
} }
function download_plugins(){
var confirm = layer.confirm('批量下载当前分类下未下载的插件包', {
btn: ['确定','取消']
}, function(){
layer.close(confirm)
$.downloadCount = 0;
$.preDownloadCount = $.preDownload.length;
download_item();
}, function(){
layer.close(confirm)
});
}
function download_item(){
if($.preDownload.length == 0){
layer.alert('成功下载'+$.downloadCount+'个插件包!', {icon:1}, function(){layer.closeAll();searchSubmit();});
return;
}
$.downloadCount++;
var plugin = $.preDownload[0];
var ii = layer.msg('['+$.downloadCount+'/'+$.preDownloadCount+']正在下载'+plugin.name+'-'+plugin.version, {icon: 16, shade:0.1, time: 0});
$.ajax({
type : 'POST',
url : '/admin/download_plugin',
data: { name:plugin.name, version:plugin.version},
dataType : 'json',
success : function(data) {
layer.close(ii)
if(data.code == 0){
$.preDownload.shift();
download_item();
}else{
layer.alert(data.msg, {icon:2});
}
},
error:function(data){
layer.close(ii)
layer.msg('服务器错误', {icon:2});
}
});
}
function searchByType(type){ function searchByType(type){
$("input[name=keyword]").val(''); $("input[name=keyword]").val('');
$("select[name=type]").val(type); $("select[name=type]").val(type);
@ -208,6 +250,26 @@ $(document).ready(function(){
} }
}, },
], ],
onLoadSuccess: function(data){
$.preDownload = [];
var type = $("select[name=type] option:selected").text();
if(type != '全部插件' && type != '运行环境' && type != '第三方应用'){
$("#batch_down").show();
if(data.length > 0){
$.each(data, function(index, plugin){
if(plugin.versions.length > 0){
$.each(plugin.versions, function(index, version){
if(!version.status){
$.preDownload.push({name:plugin.name, version:version.version})
}
});
}
});
}
}else{
$("#batch_down").hide();
}
}
}) })
}) })
</script> </script>

4
app/view/admin/record.html

@ -13,8 +13,8 @@
<input type="text" class="form-control" name="ip" placeholder="服务器IP"> <input type="text" class="form-control" name="ip" placeholder="服务器IP">
</div> </div>
<div class="form-group"> <div class="form-group">
<button class="btn btn-primary" type="submit"><i class="fa fa-search"></i>搜索</button>&nbsp;
<a href="javascript:searchClear()" class="btn btn-default"><i class="fa fa-repeat"></i>重置</a>&nbsp;
<button class="btn btn-primary" type="submit"><i class="fa fa-search"></i> 搜索</button>&nbsp;
<a href="javascript:searchClear()" class="btn btn-default"><i class="fa fa-repeat"></i> 重置</a>&nbsp;
</div> </div>
</form> </form>
</div> </div>

169
app/view/admin/set.html

@ -4,7 +4,7 @@
<div class="container" style="padding-top:70px;"> <div class="container" style="padding-top:70px;">
{if $mod=='sys'} {if $mod=='sys'}
<div class="col-sm-12 col-md-6 center-block"> <div class="col-sm-12 col-md-6 center-block">
<div class="panel panel-primary">
<div class="panel panel-success">
<div class="panel-heading"><h3 class="panel-title">系统基本设置</h3></div> <div class="panel-heading"><h3 class="panel-title">系统基本设置</h3></div>
<div class="panel-body"> <div class="panel-body">
<form onsubmit="return saveSetting(this)" method="post" class="form" role="form"> <form onsubmit="return saveSetting(this)" method="post" class="form" role="form">
@ -18,6 +18,16 @@
<select class="form-control" name="download_page" default="{:config_get('download_page')}"><option value="0">关闭</option><option value="1">开启</option></select> <select class="form-control" name="download_page" default="{:config_get('download_page')}"><option value="0">关闭</option><option value="1">开启</option></select>
<font color="green">页面地址:<a href="/download" target="_blank">/download</a>,开启后可以公开访问,否则只能管理员访问</font> <font color="green">页面地址:<a href="/download" target="_blank">/download</a>,开启后可以公开访问,否则只能管理员访问</font>
</div> </div>
<div class="form-group text-center">
<input type="submit" name="submit" value="保存" class="btn btn-success btn-block"/>
</div>
</form>
</div>
</div>
<div class="panel panel-info">
<div class="panel-heading"><h3 class="panel-title">Linux面板版本设置</h3></div>
<div class="panel-body">
<form onsubmit="return saveSetting(this)" method="post" class="form" role="form">
<div class="form-group"> <div class="form-group">
<label>宝塔Linux面板最新版本号:</label> <label>宝塔Linux面板最新版本号:</label>
<input type="text" name="new_version" value="{:config_get('new_version')}" class="form-control"/> <input type="text" name="new_version" value="{:config_get('new_version')}" class="form-control"/>
@ -33,6 +43,18 @@
<input type="date" name="update_date" value="{:config_get('update_date')}" class="form-control"/> <input type="date" name="update_date" value="{:config_get('update_date')}" class="form-control"/>
<font color="green">用于检测更新接口返回</font> <font color="green">用于检测更新接口返回</font>
</div> </div>
<div class="form-group text-center">
<input type="submit" name="submit" value="保存" class="btn btn-success btn-block"/>
</div>
</form>
</div>
</div>
</div>
<div class="col-sm-12 col-md-6 center-block">
<div class="panel panel-info">
<div class="panel-heading"><h3 class="panel-title">Windows面板版本设置</h3></div>
<div class="panel-body">
<form onsubmit="return saveSetting(this)" method="post" class="form" role="form">
<div class="form-group"> <div class="form-group">
<label>宝塔Windows面板最新版本号:</label> <label>宝塔Windows面板最新版本号:</label>
<input type="text" name="new_version_win" value="{:config_get('new_version_win')}" class="form-control"/> <input type="text" name="new_version_win" value="{:config_get('new_version_win')}" class="form-control"/>
@ -48,6 +70,16 @@
<input type="date" name="update_date_win" value="{:config_get('update_date_win')}" class="form-control"/> <input type="date" name="update_date_win" value="{:config_get('update_date_win')}" class="form-control"/>
<font color="green">用于检测更新接口返回</font> <font color="green">用于检测更新接口返回</font>
</div> </div>
<div class="form-group text-center">
<input type="submit" name="submit" value="保存" class="btn btn-success btn-block"/>
</div>
</form>
</div>
</div>
<div class="panel panel-info">
<div class="panel-heading"><h3 class="panel-title">云监控版本设置</h3></div>
<div class="panel-body">
<form onsubmit="return saveSetting(this)" method="post" class="form" role="form">
<div class="form-group"> <div class="form-group">
<label>宝塔云监控最新版本号:</label> <label>宝塔云监控最新版本号:</label>
<input type="text" name="new_version_btm" value="{:config_get('new_version_btm')}" class="form-control"/> <input type="text" name="new_version_btm" value="{:config_get('new_version_btm')}" class="form-control"/>
@ -68,12 +100,18 @@
</div> </div>
</div> </div>
</div> </div>
{elseif $mod=='api'}
<div class="col-sm-12 col-md-6 center-block"> <div class="col-sm-12 col-md-6 center-block">
<div class="panel panel-primary">
<div class="panel panel-info">
<div class="panel-heading"><h3 class="panel-title">宝塔Linux面板接口设置</h3></div> <div class="panel-heading"><h3 class="panel-title">宝塔Linux面板接口设置</h3></div>
<div class="panel-body"> <div class="panel-body">
<form onsubmit="return saveSetting(this)" method="post" class="form" role="form"> <form onsubmit="return saveSetting(this)" method="post" class="form" role="form">
<p>以下宝塔面板请使用官方最新脚本安装并绑定账号,用于获取最新插件列表及插件包</p>
<div class="form-group">
<label>对接方式:</label><br/>
<select class="form-control" name="bt_type" default="{:config_get('bt_type')}"><option value="0">对接宝塔面板接口</option><option value="1">对接其他第三方云端</option></select>
</div><hr/>
<div id="bt_type_0" style="{if config_get('bt_type')==1}display:none;{/if}">
<p>以下宝塔面板请使用官方最新脚本安装并绑定账号,用于获取插件列表及插件包</p>
<p><a href="/static/file/kaixin.zip">下载专用插件(Linux)</a>,在面板【软件商店】->【第三方应用】,点击【导入插件】,导入该专用插件。</p> <p><a href="/static/file/kaixin.zip">下载专用插件(Linux)</a>,在面板【软件商店】->【第三方应用】,点击【导入插件】,导入该专用插件。</p>
<div class="form-group"> <div class="form-group">
<label>宝塔面板URL:</label><br/> <label>宝塔面板URL:</label><br/>
@ -84,6 +122,14 @@
<label>宝塔面板接口密钥:</label> <label>宝塔面板接口密钥:</label>
<input type="text" name="bt_key" value="{:config_get('bt_key')}" class="form-control"/> <input type="text" name="bt_key" value="{:config_get('bt_key')}" class="form-control"/>
</div> </div>
</div>
<div id="bt_type_1" style="{if !config_get('bt_type')}display:none;{/if}">
<div class="form-group">
<label>第三方云端首页URL:</label><br/>
<input type="text" name="bt_surl" value="{:config_get('bt_surl')}" class="form-control"/>
<font color="green">填写规则如:<u>http://www.example.com/</u> ,必须以/结尾</font>
</div>
</div>
<div class="form-group text-center"> <div class="form-group text-center">
<button type="button" class="btn btn-info btn-block" id="testbturl">测试连接</button> <button type="button" class="btn btn-info btn-block" id="testbturl">测试连接</button>
<input type="submit" name="submit" value="保存" class="btn btn-success btn-block"/> <input type="submit" name="submit" value="保存" class="btn btn-success btn-block"/>
@ -91,11 +137,18 @@
</form> </form>
</div> </div>
</div> </div>
<div class="panel panel-primary">
</div>
<div class="col-sm-12 col-md-6 center-block">
<div class="panel panel-info">
<div class="panel-heading"><h3 class="panel-title">宝塔Windows面板接口设置</h3></div> <div class="panel-heading"><h3 class="panel-title">宝塔Windows面板接口设置</h3></div>
<div class="panel-body"> <div class="panel-body">
<form onsubmit="return saveSetting(this)" method="post" class="form" role="form"> <form onsubmit="return saveSetting(this)" method="post" class="form" role="form">
<p>以下宝塔面板请使用官方最新脚本安装并绑定账号,用于获取最新插件列表及插件包</p>
<div class="form-group">
<label>对接方式:</label><br/>
<select class="form-control" name="wbt_type" default="{:config_get('wbt_type')}"><option value="0">对接宝塔面板接口</option><option value="1">对接其他第三方云端</option></select>
</div><hr/>
<div id="wbt_type_0" style="{if config_get('wbt_type')==1}display:none;{/if}">
<p>以下宝塔面板请使用官方最新脚本安装并绑定账号,用于获取插件列表及插件包</p>
<p><a href="/static/file/win/kaixin.zip">下载专用插件(Win)</a>,在面板【软件商店】->【第三方应用】,点击【导入插件】,导入该专用插件。</p> <p><a href="/static/file/win/kaixin.zip">下载专用插件(Win)</a>,在面板【软件商店】->【第三方应用】,点击【导入插件】,导入该专用插件。</p>
<div class="form-group"> <div class="form-group">
<label>宝塔面板URL:</label><br/> <label>宝塔面板URL:</label><br/>
@ -106,6 +159,14 @@
<label>宝塔面板接口密钥:</label> <label>宝塔面板接口密钥:</label>
<input type="text" name="wbt_key" value="{:config_get('wbt_key')}" class="form-control"/> <input type="text" name="wbt_key" value="{:config_get('wbt_key')}" class="form-control"/>
</div> </div>
</div>
<div id="wbt_type_1" style="{if !config_get('wbt_type')}display:none;{/if}">
<div class="form-group">
<label>第三方云端首页URL:</label><br/>
<input type="text" name="wbt_surl" value="{:config_get('wbt_surl')}" class="form-control"/>
<font color="green">填写规则如:<u>http://www.example.com/</u> ,必须以/结尾</font>
</div>
</div>
<div class="form-group text-center"> <div class="form-group text-center">
<button type="button" class="btn btn-info btn-block" id="testbturl2">测试连接</button> <button type="button" class="btn btn-info btn-block" id="testbturl2">测试连接</button>
<input type="submit" name="submit" value="保存" class="btn btn-success btn-block"/> <input type="submit" name="submit" value="保存" class="btn btn-success btn-block"/>
@ -114,10 +175,30 @@
</div> </div>
</div> </div>
</div> </div>
<script>
$("select[name='bt_type']").change(function(){
if($(this).val() == 1){
$("#bt_type_0").hide();
$("#bt_type_1").show();
}else{
$("#bt_type_0").show();
$("#bt_type_1").hide();
}
});
$("select[name='wbt_type']").change(function(){
if($(this).val() == 1){
$("#wbt_type_0").hide();
$("#wbt_type_1").show();
}else{
$("#wbt_type_0").show();
$("#wbt_type_1").hide();
}
});
</script>
{elseif $mod=='task'} {elseif $mod=='task'}
<div class="col-sm-12 col-md-6 center-block"> <div class="col-sm-12 col-md-6 center-block">
<div class="panel panel-success"> <div class="panel panel-success">
<div class="panel-heading"><h3 class="panel-title">定时任务说明</h3></div>
<div class="panel-heading"><h3 class="panel-title">自动更新插件说明</h3></div>
<div class="panel-body"> <div class="panel-body">
<form onsubmit="return saveSetting(this)" method="post" class="form" role="form"> <form onsubmit="return saveSetting(this)" method="post" class="form" role="form">
<div class="alert alert-info">使用以下命令可以从宝塔官方获取最新的插件列表并批量下载插件包(增量更新)。<br/>你也可以将此命令添加到crontab以使此云端的插件保持最新,建议1天执行1次。</div> <div class="alert alert-info">使用以下命令可以从宝塔官方获取最新的插件列表并批量下载插件包(增量更新)。<br/>你也可以将此命令添加到crontab以使此云端的插件保持最新,建议1天执行1次。</div>
@ -130,7 +211,7 @@
</div> </div>
<div class="col-sm-12 col-md-6 center-block"> <div class="col-sm-12 col-md-6 center-block">
<div class="panel panel-info"> <div class="panel panel-info">
<div class="panel-heading"><h3 class="panel-title">定时任务设置</h3></div>
<div class="panel-heading"><h3 class="panel-title">自动更新插件设置</h3></div>
<div class="panel-body"> <div class="panel-body">
<form onsubmit="return saveSetting(this)" method="post" class="form" role="form"> <form onsubmit="return saveSetting(this)" method="post" class="form" role="form">
<div class="form-group"> <div class="form-group">
@ -206,22 +287,35 @@ $(document).ready(function(){
$(items[i]).val($(items[i]).attr("default")||0); $(items[i]).val($(items[i]).attr("default")||0);
} }
$("#testbturl").click(function(){ $("#testbturl").click(function(){
var bt_url = $("input[name=bt_url]").val();
var bt_key = $("input[name=bt_key]").val();
if(bt_url == ''){
layer.alert('宝塔面板URL不能为空');return;
}
if(bt_url.indexOf('http://')==-1 && bt_url.indexOf('https://')==-1){
layer.alert('宝塔面板URL不正确');return;
}
if(bt_key == ''){
layer.alert('宝塔面板接口密钥不能为空');return;
}
var bt_type = $("select[name=bt_type]").val();
if(bt_type == '1'){
var bt_surl = $("input[name=bt_surl]").val();
if(bt_surl == ''){
layer.alert('第三方云端URL不能为空');return;
}
if(bt_surl.indexOf('http://')==-1 && bt_surl.indexOf('https://')==-1){
layer.alert('第三方云端URL不正确');return;
}
var postdata = {bt_type:bt_type, bt_surl:bt_surl};
}else{
var bt_url = $("input[name=bt_url]").val();
var bt_key = $("input[name=bt_key]").val();
if(bt_url == ''){
layer.alert('宝塔面板URL不能为空');return;
}
if(bt_url.indexOf('http://')==-1 && bt_url.indexOf('https://')==-1){
layer.alert('宝塔面板URL不正确');return;
}
if(bt_key == ''){
layer.alert('宝塔面板接口密钥不能为空');return;
}
var postdata = {bt_type:bt_type, bt_url:bt_url, bt_key:bt_key};
}
var ii = layer.load(2, {shade:[0.1,'#fff']}); var ii = layer.load(2, {shade:[0.1,'#fff']});
$.ajax({ $.ajax({
type : 'POST', type : 'POST',
url : '/admin/testbturl', url : '/admin/testbturl',
data : {bt_url:bt_url, bt_key:bt_key},
data : postdata,
dataType : 'json', dataType : 'json',
success : function(data) { success : function(data) {
layer.close(ii); layer.close(ii);
@ -238,22 +332,35 @@ $(document).ready(function(){
}); });
}) })
$("#testbturl2").click(function(){ $("#testbturl2").click(function(){
var wbt_url = $("input[name=wbt_url]").val();
var wbt_key = $("input[name=wbt_key]").val();
if(wbt_url == ''){
layer.alert('宝塔面板URL不能为空');return;
}
if(wbt_url.indexOf('http://')==-1 && wbt_url.indexOf('https://')==-1){
layer.alert('宝塔面板URL不正确');return;
}
if(wbt_key == ''){
layer.alert('宝塔面板接口密钥不能为空');return;
}
var wbt_type = $("select[name=wbt_type]").val();
if(wbt_type == '1'){
var wbt_surl = $("input[name=wbt_surl]").val();
if(wbt_surl == ''){
layer.alert('第三方云端URL不能为空');return;
}
if(wbt_surl.indexOf('http://')==-1 && wbt_surl.indexOf('https://')==-1){
layer.alert('第三方云端URL不正确');return;
}
var postdata = {bt_type:wbt_type, bt_surl:wbt_surl};
}else{
var wbt_url = $("input[name=wbt_url]").val();
var wbt_key = $("input[name=wbt_key]").val();
if(wbt_url == ''){
layer.alert('宝塔面板URL不能为空');return;
}
if(wbt_url.indexOf('http://')==-1 && wbt_url.indexOf('https://')==-1){
layer.alert('宝塔面板URL不正确');return;
}
if(wbt_key == ''){
layer.alert('宝塔面板接口密钥不能为空');return;
}
var postdata = {bt_type:wbt_type, bt_url:wbt_url, bt_key:wbt_key};
}
var ii = layer.load(2, {shade:[0.1,'#fff']}); var ii = layer.load(2, {shade:[0.1,'#fff']});
$.ajax({ $.ajax({
type : 'POST', type : 'POST',
url : '/admin/testbturl', url : '/admin/testbturl',
data : {bt_url:wbt_url, bt_key:wbt_key},
data : postdata,
dataType : 'json', dataType : 'json',
success : function(data) { success : function(data) {
layer.close(ii); layer.close(ii);

8
install.sql

@ -12,15 +12,15 @@ INSERT INTO `cloud_config` (`key`, `value`) VALUES
('bt_key', ''), ('bt_key', ''),
('whitelist', '0'), ('whitelist', '0'),
('download_page', '1'), ('download_page', '1'),
('new_version', '8.0.1'),
('new_version', '8.0.2'),
('update_msg', '暂无更新日志'), ('update_msg', '暂无更新日志'),
('update_date', '2023-07-20'),
('update_date', '2023-08-28'),
('new_version_win', '7.9.0'), ('new_version_win', '7.9.0'),
('update_msg_win', '暂无更新日志'), ('update_msg_win', '暂无更新日志'),
('update_date_win', '2023-07-20'), ('update_date_win', '2023-07-20'),
('new_version_btm', '2.2.8'),
('new_version_btm', '2.2.9'),
('update_msg_btm', '暂无更新日志'), ('update_msg_btm', '暂无更新日志'),
('update_date_btm', '2023-08-04'),
('update_date_btm', '2023-08-11'),
('updateall_type', '0'), ('updateall_type', '0'),
('syskey', 'UqP94LtI8eWAIgCP'); ('syskey', 'UqP94LtI8eWAIgCP');

13
public/install/install_6.0.sh

@ -759,6 +759,18 @@ Install_Bt(){
if [ ! -f /www/server/panel/data/userInfo.json ]; then if [ ! -f /www/server/panel/data/userInfo.json ]; then
echo "{\"uid\":1,\"username\":\"Administrator\",\"address\":\"127.0.0.1\",\"serverid\":\"1\",\"access_key\":\"test\",\"secret_key\":\"123456\",\"ukey\":\"123456\",\"state\":1}" > /www/server/panel/data/userInfo.json echo "{\"uid\":1,\"username\":\"Administrator\",\"address\":\"127.0.0.1\",\"serverid\":\"1\",\"access_key\":\"test\",\"secret_key\":\"123456\",\"ukey\":\"123456\",\"state\":1}" > /www/server/panel/data/userInfo.json
fi fi
if [ ! -f /www/server/panel/data/panel_nps.pl ]; then
echo "" > /www/server/panel/data/panel_nps.pl
fi
if [ ! -f /www/server/panel/data/btwaf_nps.pl ]; then
echo "" > /www/server/panel/data/btwaf_nps.pl
fi
if [ ! -f /www/server/panel/data/tamper_proof_nps.pl ]; then
echo "" > /www/server/panel/data/tamper_proof_nps.pl
fi
if [ ! -f /www/server/panel/data/total_nps.pl ]; then
echo "" > /www/server/panel/data/total_nps.pl
fi
} }
Set_Bt_Panel(){ Set_Bt_Panel(){
Run_User="www" Run_User="www"
@ -1042,7 +1054,6 @@ echo -e " 点击【高级】-【继续访问】或【接受风险并继续】访
echo -e " 教程:https://www.bt.cn/bbs/thread-117246-1-1.html" echo -e " 教程:https://www.bt.cn/bbs/thread-117246-1-1.html"
echo -e "" echo -e ""
echo -e "==================================================================" echo -e "=================================================================="
endTime=`date +%s` endTime=`date +%s`
((outTime=($endTime-$startTime)/60)) ((outTime=($endTime-$startTime)/60))
echo -e "Time consumed:\033[32m $outTime \033[0mMinute!" echo -e "Time consumed:\033[32m $outTime \033[0mMinute!"

3
public/install/install_btmonitor.sh

@ -427,6 +427,9 @@ EOF
if [ -f $monitor_path/core/include/c_loader/PluginLoader.so ]; then if [ -f $monitor_path/core/include/c_loader/PluginLoader.so ]; then
rm -f $monitor_path/core/include/c_loader/PluginLoader.so rm -f $monitor_path/core/include/c_loader/PluginLoader.so
fi fi
if [ -f $monitor_path/sqlite_server/PluginLoader.so ]; then
rm -f $monitor_path/sqlite_server/PluginLoader.so
fi
} }
Start_Monitor(){ Start_Monitor(){

BIN
public/install/src/bt-monitor-2.2.8.zip → public/install/src/bt-monitor-2.2.9.zip

BIN
public/install/src/panel6.zip

BIN
public/install/update/LinuxPanel-8.0.1.zip → public/install/update/LinuxPanel-8.0.2.zip

12
public/install/update6.sh

@ -113,6 +113,18 @@ fi
if [ ! -f /www/server/panel/data/userInfo.json ]; then if [ ! -f /www/server/panel/data/userInfo.json ]; then
echo "{\"uid\":1,\"username\":\"Administrator\",\"address\":\"127.0.0.1\",\"serverid\":\"1\",\"access_key\":\"test\",\"secret_key\":\"123456\",\"ukey\":\"123456\",\"state\":1}" > /www/server/panel/data/userInfo.json echo "{\"uid\":1,\"username\":\"Administrator\",\"address\":\"127.0.0.1\",\"serverid\":\"1\",\"access_key\":\"test\",\"secret_key\":\"123456\",\"ukey\":\"123456\",\"state\":1}" > /www/server/panel/data/userInfo.json
fi fi
if [ ! -f /www/server/panel/data/panel_nps.pl ]; then
echo "" > /www/server/panel/data/panel_nps.pl
fi
if [ ! -f /www/server/panel/data/btwaf_nps.pl ]; then
echo "" > /www/server/panel/data/btwaf_nps.pl
fi
if [ ! -f /www/server/panel/data/tamper_proof_nps.pl ]; then
echo "" > /www/server/panel/data/tamper_proof_nps.pl
fi
if [ ! -f /www/server/panel/data/total_nps.pl ]; then
echo "" > /www/server/panel/data/total_nps.pl
fi
chattr -i /etc/init.d/bt chattr -i /etc/init.d/bt
chmod +x /etc/init.d/bt chmod +x /etc/init.d/bt

3
public/install/update_btmonitor.sh

@ -339,6 +339,9 @@ Install_Monitor(){
if [ -f $monitor_path/core/include/c_loader/PluginLoader.so ]; then if [ -f $monitor_path/core/include/c_loader/PluginLoader.so ]; then
rm -f $monitor_path/core/include/c_loader/PluginLoader.so rm -f $monitor_path/core/include/c_loader/PluginLoader.so
fi fi
if [ -f $monitor_path/sqlite_server/PluginLoader.so ]; then
rm -f $monitor_path/sqlite_server/PluginLoader.so
fi
} }
Service_Add(){ Service_Add(){

BIN
public/win/panel/panel_7.9.0.zip

3
route/app.php

@ -105,6 +105,9 @@ Route::group('api', function () {
Route::post('/v2/common_v1_authorization/get_pricing', 'api/return_error2'); Route::post('/v2/common_v1_authorization/get_pricing', 'api/return_error2');
Route::any('/bt_waf/getSpiders', 'api/btwaf_getspiders'); 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::miss('api/return_error'); Route::miss('api/return_error');
}); });

2
wiki/update.md

@ -107,7 +107,7 @@
- [可选]关闭未绑定域名提示页面:在class/panelSite.py,root /www/server/nginx/html改成return 400 - [可选]关闭未绑定域名提示页面:在class/panelSite.py,root /www/server/nginx/html改成return 400
- [可选]关闭自动生成访问日志:在 BTPanel/\_\_init\_\_.py 删除public.write_request_log()这一行
- [可选]关闭自动生成访问日志:在 BTPanel/\_\_init\_\_.py 删除public.write_request_log这一行
- [可选]删除小图标广告:在BTPanel/static/js/site.js,删除“WAF防火墙”对应的span标签 - [可选]删除小图标广告:在BTPanel/static/js/site.js,删除“WAF防火墙”对应的span标签

Loading…
Cancel
Save