From d8de902f1b3040698a3629171c968e6330474283 Mon Sep 17 00:00:00 2001 From: flucout Date: Fri, 7 Mar 2025 12:28:43 +0800 Subject: [PATCH] fix --- app/controller/Api.php | 10 ++++++++++ app/lib/BtPlugins.php | 14 ++++++++++++++ app/lib/Btapi.php | 12 ++++++++++++ app/lib/Plugins.php | 7 +++++++ app/lib/ThirdPlugins.php | 18 +++++++++++++++--- app/script/convert.sh | 1 - route/app.php | 1 + 7 files changed, 59 insertions(+), 4 deletions(-) diff --git a/app/controller/Api.php b/app/controller/Api.php index 776bb29..d964124 100644 --- a/app/controller/Api.php +++ b/app/controller/Api.php @@ -523,6 +523,16 @@ class Api extends BaseController $result = Plugins::get_spider($type); return json($result); } + + //获取堡塔恶意情报IP库 + public function btwaf_getmalicious(){ + try{ + $result = Plugins::btwaf_getmalicious(); + return json($result); + }catch(\Exception $e){ + return json(['success'=>false, 'res'=>$e->getMessage()]); + } + } //检查是否国内IP public function check_cnip(){ diff --git a/app/lib/BtPlugins.php b/app/lib/BtPlugins.php index 97433a3..9aaafb4 100644 --- a/app/lib/BtPlugins.php +++ b/app/lib/BtPlugins.php @@ -196,12 +196,14 @@ class BtPlugins $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('"https://www.bt.cn/api/bt_waf/get_malicious', 'public.GetConfigValue(\'home\')+"/api/bt_waf/get_malicious', $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/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); $data = str_replace('\'http://www.bt.cn/api/Auth', 'public.GetConfigValue(\'home\')+\'/api/Auth', $data); @@ -290,4 +292,16 @@ class BtPlugins } } + //获取堡塔恶意情报IP库 + public function btwaf_getmalicious(){ + $result = $this->btapi->btwaf_getmalicious(); + if(isset($result['success'])){ + return $result; + }elseif(isset($result['msg'])){ + throw new Exception($result['msg']); + }else{ + throw new Exception(isset($result['res'])?$result['res']:'获取失败'); + } + } + } \ No newline at end of file diff --git a/app/lib/Btapi.php b/app/lib/Btapi.php index c494666..6a2269b 100644 --- a/app/lib/Btapi.php +++ b/app/lib/Btapi.php @@ -169,6 +169,18 @@ class Btapi $data = json_decode($result,true); return $data; } + + //BTWAF-获取堡塔恶意情报IP库 + public function btwaf_getmalicious(){ + $url = $this->BT_PANEL.'/plugin?action=a&name=kaixin&s=btwaf_getmalicious'; + + $p_data = $this->GetKeyData(); + + $result = $this->curl($url,$p_data); + + $data = json_decode($result,true); + return $data; + } private function GetKeyData(){ diff --git a/app/lib/Plugins.php b/app/lib/Plugins.php index baaca38..61366ea 100644 --- a/app/lib/Plugins.php +++ b/app/lib/Plugins.php @@ -193,4 +193,11 @@ class Plugins return $result; } + //获取堡塔恶意情报IP库 + public static function btwaf_getmalicious(){ + $btapi = self::get_btapi('Linux'); + $result = $btapi->btwaf_getmalicious(); + return $result; + } + } \ No newline at end of file diff --git a/app/lib/ThirdPlugins.php b/app/lib/ThirdPlugins.php index 5c116a2..30d2e22 100644 --- a/app/lib/ThirdPlugins.php +++ b/app/lib/ThirdPlugins.php @@ -28,11 +28,11 @@ class ThirdPlugins public function get_plugin_list() { if($this->os == 'en'){ - $url = $this->url . 'api/panel/get_plugin_list_en'; + $url = $this->url . 'api/panel/getSoftListEn'; }elseif($this->os == 'Windows'){ - $url = $this->url . 'api/wpanel/get_plugin_list'; + $url = $this->url . 'api/wpanel/get_soft_list'; }else{ - $url = $this->url . 'api/panel/get_plugin_list'; + $url = $this->url . 'api/panel/get_soft_list'; } $res = $this->curl($url); $result = json_decode($res, true); @@ -174,6 +174,18 @@ class ThirdPlugins } } + //获取堡塔恶意情报IP库 + public function btwaf_getmalicious(){ + $url = $this->url . 'api/bt_waf/get_malicious'; + $res = $this->curl($url); + $result = json_decode($res, true); + if(isset($result['success'])){ + return $result; + }else{ + throw new Exception(isset($result['res'])?$result['res']:'获取失败'); + } + } + private function curl($url, $post = 0){ $ua = "Mozilla/5.0 (BtCloud; ".request()->root(true).")"; return get_curl($url, $post, 0, 0, 0, $ua); diff --git a/app/script/convert.sh b/app/script/convert.sh index 364f7be..bdf3e3d 100644 --- a/app/script/convert.sh +++ b/app/script/convert.sh @@ -21,7 +21,6 @@ public/install/update_btmonitor.sh public/install/src/panel_7_en.zip public/install/update/LinuxPanel_EN-${Aapanel_Version}.zip public/install/install_7.0_en.sh -public/install/install_pro_en.sh public/install/update_7.x_en.sh ) diff --git a/route/app.php b/route/app.php index 86a9e88..d1fceb4 100644 --- a/route/app.php +++ b/route/app.php @@ -121,6 +121,7 @@ Route::group('api', function () { Route::post('/v2/product/email', 'api/return_error2'); Route::any('/bt_waf/getSpiders', 'api/btwaf_getspiders'); + Route::any('/bt_waf/get_malicious', 'api/btwaf_getmalicious'); Route::post('/bt_waf/addSpider', 'api/return_empty'); Route::post('/bt_waf/getVulScanInfoList', 'api/return_empty'); Route::post('/bt_waf/reportInterceptFail', 'api/return_empty');