Compare commits

...

11 Commits
3.1 ... 3.4

Author SHA1 Message Date
flucout
263f5aec86 update 2025-07-27 22:48:52 +08:00
flucout
4e48a2722d update 2025-07-27 16:18:19 +08:00
flucout
28a34b273a update 2025-07-26 10:48:03 +08:00
flucout
655b408493 update 2025-07-26 10:44:47 +08:00
flucout
42500b40d1 修复无法获取宝塔恶意IP 2025-05-30 10:14:05 +08:00
flucout
9438c64796 update 2025-05-26 21:49:50 +08:00
Flucont
acb842a883 Merge pull request #264 from Illustar0/main
feat: support get_malicious_ip for bt_waf
2025-04-17 20:11:53 +08:00
Illustar0
6785d259f6 feat: support get_malicious_ip for bt_waf 2025-04-14 11:18:16 +08:00
flucout
04560cd70c update 2025-04-04 20:05:14 +08:00
flucout
ecfe3c9e20 update 2025-03-11 21:13:39 +08:00
flucout
d8de902f1b fix 2025-03-07 12:28:43 +08:00
26 changed files with 275 additions and 94 deletions

View File

@@ -107,20 +107,20 @@ class CleanViteJs extends Command
$flag = false;
if(strpos($file, 'window.location.protocol.indexOf("https")>=0')!==false){ //index
$file = str_replace('(window.location.protocol.indexOf("https")>=0)', '1', $file);
$file = str_replace('window.location.protocol.indexOf("https")>=0', '!0', $file);
$code = $this->getExtendCode($file, 'isGetCoupon:', 2);
if($code){
$file = str_replace($code, '{}', $file);
}
$file = preg_replace('!recommendShow:\w+,!', 'recommendShow:!1,', $file, 1);
$code = $this->getExtendCode($file, '"需求反馈"', 1, '[', ']');
$code = $this->getExtendCode($file, '"打开需求反馈"', 1, '[', ']');
if($code){
$file = str_replace($code, '[]', $file);
}
$flag = true;
}
if(strpos($file, '售后QQ群')!==false){ //main
if(strpos($file, '论坛求助')!==false){ //main
$code = $this->getExtendCode($file, '"微信公众号"', 1);
$code = $this->getExtendFunction($file, $code);
$start = strpos($file, $code) - 1;
@@ -130,7 +130,7 @@ class CleanViteJs extends Command
break;
}
}
$code = $this->getExtendCode($file, '"/other/customer-service.png"', 2);
$code = $this->getExtendCode($file, '"/other/customer-qrcode.png"', 2);
$code = $this->getExtendFunction($file, $code);
$end = strpos($file, $code)+strlen($code);
$code = substr($file, $start, $end - $start);
@@ -182,7 +182,7 @@ class CleanViteJs extends Command
if(strpos($file, '"商用SSL证书"')!==false){ //site-ssl
$code = $this->getExtendFunction($file, '"商用SSL证书"', '{', '}');
$file = str_replace($code, '', $file);
$code = $this->getExtendFunction($file, '"宝塔证书"', '{', '}');
$code = $this->getExtendFunction($file, '"测试证书"', '{', '}');
$file = str_replace($code, '', $file);
$code = $this->getExtendCode($file, '"购买商业证书"', 2);
if($code){
@@ -201,7 +201,7 @@ class CleanViteJs extends Command
if(strpos($file, '"商用SSL"')!==false){ //ssl
$code = $this->getExtendFunction($file, '"商用SSL"', '{', '}');
$file = str_replace($code, '', $file);
$code = $this->getExtendFunction($file, '"宝塔证书"', '{', '}');
$code = $this->getExtendFunction($file, '"测试证书"', '{', '}');
$file = str_replace($code, '', $file);
$code = $this->getExtendCode($file, ',"联系客服"', 2, '[', ']');
if($code){
@@ -259,7 +259,7 @@ class CleanViteJs extends Command
$file = str_replace($code, '[]', $file);
$flag = true;
}
$code = $this->getExtendFunction($file, '," 需求反馈 "');
$code = $this->getExtendFunction($file, 'label:"需求反馈",', '{', '}');
if($code){
$file = str_replace($code, '', $file);
$flag = true;

View File

@@ -2,6 +2,7 @@
namespace app\controller;
use think\facade\Db;
use think\facade\Cache;
use app\BaseController;
use app\lib\Plugins;
@@ -465,6 +466,40 @@ class Api extends BaseController
$data = bin2hex('[]');
return json(['status'=>true, 'msg'=>'', 'data'=>$data]);
}
//获取堡塔云WAF恶意IP库
public function get_malicious_ip_list()
{
$cacheKey = 'malicious_ip_list';
// 尝试从缓存获取
if (Cache::has($cacheKey)) {
return json(json_decode(Cache::get($cacheKey), true));
}
$url = 'https://api.bt.cn/bt_waf/get_malicious_ip';
$postData = json_encode([
'x_bt_token' => 'MzI3YjAzOGQ3Yjk3NjUxYjVlMDkyMGFm'
]);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postData);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Content-Type: application/json',
'Content-Length: ' . strlen($postData)
]);
$response = curl_exec($ch);
if (curl_errno($ch)) {
return json(['status'=>true, 'msg'=>'', 'data'=>bin2hex('[]')]);
}
curl_close($ch);
Cache::set($cacheKey, $response, 86400); //缓存一天
return json(json_decode($response, true));
}
public function return_success(){
return json(['status'=>true, 'msg'=>1, 'data'=>(object)[]]);
@@ -523,6 +558,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(){

View File

@@ -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']:'获取失败');
}
}
}

View File

@@ -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(){

View File

@@ -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;
}
}

View File

@@ -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);

View File

@@ -32,7 +32,7 @@ class LoadConfig
$res = Db::name('config')->cache('configs',0)->column('value','key');
Config::set($res, 'sys');
View::assign('cdnpublic', '//lf6-cdn-tos.bytecdntp.com/cdn/expire-1-M/');
View::assign('cdnpublic', 'https://s4.zstatic.net/ajax/libs/');
return $next($request)->header([
'Cache-Control' => 'no-store, no-cache, must-revalidate',
'Pragma' => 'no-cache',

View File

@@ -1,14 +1,14 @@
#!/bin/bash
Linux_Version="9.4.0"
Linux_Version="11.0.0"
Windows_Version="8.2.2"
Aapanel_Version="7.0.13"
Aapanel_Version="7.0.21"
Btm_Version="2.3.0"
FILES=(
public/install/src/panel6.zip
public/install/update/LinuxPanel-${Linux_Version}.zip
public/install/install_6.0.sh
public/install/install_panel.sh
public/install/update_panel.sh
public/install/update6.sh
public/win/install/panel_update.py
@@ -21,9 +21,9 @@ 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
)
PL_FILE="public/install/update/LinuxPanel-${Linux_Version}.pl"
DIR=$1
SITEURL=$2
@@ -81,6 +81,10 @@ do
fi
done
HASH=$(sha256sum "${DIR}public/install/update/LinuxPanel-${Linux_Version}.zip" | awk '{print $1}')
TIMESTAMP=$(date +%s)
printf '{"hash": "%s", "update_time": "%s"}' "$HASH" "$TIMESTAMP" > "${DIR}${PL_FILE}"
echo "=========================="
echo "处理完成"
echo "=========================="

View File

@@ -35,6 +35,7 @@ td{overflow: hidden;text-overflow: ellipsis;white-space: nowrap;max-width:340px;
<div class="modal-body">
<p>“版本与状态”一列中,红色的按钮代表本地不存在该版本插件包,需要点击下载;绿色的按钮代表已存在。</p>
<p>官方插件包本地存储路径是/data/plugins/package/软件标识-版本号.zip第三方插件包路径是/data/plugins/other/other/,对于部分包含二次验证的插件可以自行修改。</p>
<p>若对接的服务器网速较慢,可能会导致下载失败,提示"服务器错误",可稍等一会,进入对接服务器/tmp/plugins目录下载插件包将_改成-,并上传到本站/data/plugins/package目录下。</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
@@ -158,7 +159,7 @@ function download_item(){
return;
}
var plugin = $.preDownload[0];
if(plugin.name == 'firewall'){
if(plugin.name == 'firewall' || plugin.name == 'php_filter' || plugin.name == 'enterprise_backup' || plugin.name == 'tamper_drive'){
$.preDownload.shift();
download_item();
return;

View File

@@ -104,17 +104,17 @@
<div class="panel-body">
<form onsubmit="return saveSetting(this)" method="post" class="form" role="form">
<div class="form-group">
<label>宝塔Linux面板最新版本号:</label>
<label>aaPanel面板最新版本号:</label>
<input type="text" name="new_version_en" value="{:config_get('new_version_en')}" class="form-control"/>
<font color="green">用于一键更新脚本获取最新版本号,以及检测更新接口。并确保已在/public/install/update/放置对应版本更新包</font>
</div>
<div class="form-group">
<label>宝塔Linux面板更新日志:</label>
<label>aaPanel面板更新日志:</label>
<textarea class="form-control" name="update_msg_en" rows="5" placeholder="支持HTML代码">{:config_get('update_msg_en')}</textarea>
<font color="green">用于检测更新接口返回</font>
</div>
<div class="form-group">
<label>宝塔Linux面板更新日期:</label>
<label>aaPanel面板更新日期:</label>
<input type="date" name="update_date_en" value="{:config_get('update_date_en')}" class="form-control"/>
<font color="green">用于检测更新接口返回</font>
</div>

View File

@@ -110,15 +110,15 @@
<div class="install-code">
<span class="osname">Centos安装脚本</span>
<div class="code-cont">
<div class="command" title="点击复制Centos安装脚本">yum install -y wget && wget -O install.sh {$siteurl}/install/install_6.0.sh && sh install.sh</div>
<span class="ico-copy" title="点击复制Centos安装脚本" data-clipboard-text="yum install -y wget && wget -O install.sh {$siteurl}/install/install_6.0.sh && sh install.sh">复制</span>
<div class="command" title="点击复制Centos安装脚本">yum install -y wget && wget -O install.sh {$siteurl}/install/install_panel.sh && sh install.sh</div>
<span class="ico-copy" title="点击复制Centos安装脚本" data-clipboard-text="yum install -y wget && wget -O install.sh {$siteurl}/install/install_panel.sh && sh install.sh">复制</span>
</div>
</div>
<div class="install-code">
<span class="osname">Ubuntu/Debian安装脚本</span>
<div class="code-cont">
<div class="command" title="点击复制Ubuntu/Debian安装脚本">wget -O install.sh {$siteurl}/install/install_6.0.sh && bash install.sh</div>
<span class="ico-copy" title="点击复制Ubuntu/Debian安装脚本" data-clipboard-text="wget -O install.sh {$siteurl}/install/install_6.0.sh && bash install.sh">复制</span>
<div class="command" title="点击复制Ubuntu/Debian安装脚本">wget -O install.sh {$siteurl}/install/install_panel.sh && bash install.sh</div>
<span class="ico-copy" title="点击复制Ubuntu/Debian安装脚本" data-clipboard-text="wget -O install.sh {$siteurl}/install/install_panel.sh && bash install.sh">复制</span>
</div>
</div>
<div class="install-code">

View File

@@ -12,15 +12,15 @@ INSERT INTO `cloud_config` (`key`, `value`) VALUES
('bt_key', ''),
('whitelist', '0'),
('download_page', '1'),
('new_version', '9.4.0'),
('new_version', '11.0.0'),
('update_msg', '暂无更新日志'),
('update_date', '2025-01-09'),
('update_date', '2025-07-24'),
('new_version_win', '8.2.2'),
('update_msg_win', '暂无更新日志'),
('update_date_win', '2024-12-30'),
('new_version_en', '7.0.13'),
('new_version_en', '7.0.21'),
('update_msg_en', '暂无更新日志'),
('update_date_en', '2024-11-17'),
('update_date_en', '2025-07-22'),
('new_version_btm', '2.3.0'),
('update_msg_btm', '暂无更新日志'),
('update_date_btm', '2024-04-24'),

View File

@@ -63,7 +63,7 @@ GetSysInfo() {
echo -e ${SYS_VERSION}
echo -e Bit:${SYS_BIT} Mem:${MEM_TOTAL}M Core:${CPU_INFO}
echo -e ${SYS_INFO}
echo -e "Please screenshot above error message and post forum forum.aapanel.com or send email: kern@aapanel.com for help"
echo -e "Please screenshot above error message and post forum forum.aapanel.com or send email: support@aapanel.com for help"
}
@@ -421,8 +421,8 @@ Check_apt_status(){
retries=0
while [ $retries -lt $MAX_RETRIES ]; do
output=$(ps aux| grep -E '(apt|apt-get)\s' 2>&1)
check_output=$(echo "$output" | grep -E '(apt|apt-get)\s')
output=$(ps aux |grep -E '(apt|apt-get)\s' 2>&1)
check_output=$(echo "$output" | grep -v _apt | grep -E '(apt|apt-get)\s')
#If check_output is empty, terminate the loop
if [ -z "$check_output" ]; then
@@ -557,7 +557,7 @@ Install_RPM_Pack() {
yum config-manager --set-enabled PowerTools
fi
if [ -f "/etc/redhat-release" ] && [ $(cat /etc/os-release|grep PLATFORM_ID|grep -oE "el9") ];then
if [ -f "/etc/redhat-release" ] && [ $(cat /etc/os-release|grep PLATFORM_ID|grep -oE "el9|el10") ];then
dnf config-manager --set-enabled crb -y
fi
@@ -648,7 +648,7 @@ Install_Deb_Pack() {
apt-get install curl -y
fi
debPacks="wget curl libcurl4-openssl-dev gcc make zip unzip tar openssl libssl-dev gcc libxml2 libxml2-dev libxslt-dev zlib1g zlib1g-dev libjpeg-dev libpng-dev lsof libpcre3 libpcre3-dev cron net-tools swig build-essential libffi-dev libbz2-dev libncurses-dev libsqlite3-dev libreadline-dev tk-dev libgdbm-dev libdb-dev libdb++-dev libpcap-dev xz-utils git ufw ipset sqlite3 uuid-dev libpq-dev liblzma-dev ca-certificates sudo autoconf at mariadb-client rsyslog xfsprogs quota"
debPacks="wget curl libcurl4-openssl-dev gcc make zip unzip tar openssl libssl-dev gcc libxml2 libxml2-dev libxslt-dev zlib1g zlib1g-dev libjpeg-dev libpng-dev lsof libpcre3 libpcre3-dev cron net-tools swig build-essential libffi-dev libbz2-dev libncurses-dev libsqlite3-dev libreadline-dev tk-dev libgdbm-dev libdb-dev libdb++-dev libpcap-dev xz-utils git ufw ipset sqlite3 uuid-dev libpq-dev liblzma-dev ca-certificates sudo autoconf at mariadb-client rsyslog xfsprogs quota libssh2-1-dev"
DEBIAN_FRONTEND=noninteractive apt-get install -y $debPacks --allow-downgrades --allow-remove-essential --allow-change-held-packages
@@ -1130,7 +1130,7 @@ Get_Versions() {
os_version=""
fi
if [ -z "${os_version}" ]; then
os_version=$(cat /etc/redhat-release | grep Stream | grep -oE "8|9")
os_version=$(cat /etc/redhat-release | grep Stream | grep -oE "8|9|10")
fi
else
os_type='ubuntu'
@@ -1862,19 +1862,40 @@ Set_Firewall() {
Get_Ip_Address() {
getIpAddress=""
# getIpAddress=$(curl -sS --connect-timeout 10 -m 60 https://brandnew.aapanel.com/api/common/getClientIP)
getIpAddress=$(curl -sSk --connect-timeout 10 -m 60 https://www.aapanel.com/api/common/getClientIP)
# if [ -z "${getIpAddress}" ] || [ "${getIpAddress}" = "0.0.0.0" ]; then
# isHosts=$(cat /etc/hosts|grep 'www.bt.cn')
# if [ -z "${isHosts}" ];then
# echo "" >> /etc/hosts
# echo "103.224.251.67 www.bt.cn" >> /etc/hosts
# #getIpAddress=$(curl -sS --connect-timeout 10 -m 60 https://brandnew.aapanel.com/api/common/getClientIP)
# getIpAddress=$(curl -sS --connect-timeout 10 -m 60 https://www.bt.cn/Api/getIpAddress)
# if [ -z "${getIpAddress}" ];then
# sed -i "/bt.cn/d" /etc/hosts
# fi
# fi
# fi
# getIpAddress=$(curl -sSk --connect-timeout 10 -m 60 https://www.aapanel.com/api/common/getClientIP)
ipv4_address=""
ipv6_address=""
ipv4_address=$(curl -4 -sS --connect-timeout 10 -m 15 https://www.aapanel.com/api/common/getClientIP 2>&1)
if [ -z "${ipv4_address}" ];then
ipv4_address=$(curl -4 -sS --connect-timeout 10 -m 15 https://ifconfig.me 2>&1)
if [ -z "${ipv4_address}" ];then
ipv4_address=$(curl -4 -sS --connect-timeout 10 -m 15 https://www.bt.cn/Api/getIpAddress 2>&1)
fi
fi
IPV4_REGEX="^([0-9]{1,3}\.){3}[0-9]{1,3}$"
if ! [[ $ipv4_address =~ $IPV4_REGEX ]]; then
ipv4_address=""
fi
ipv6_address=$(curl -6 -sS --connect-timeout 10 -m 15 https://www.aapanel.com/api/common/getClientIP 2>&1)
# IPV6_REGEX="^([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}$"
IPV6_REGEX="^([0-9a-fA-F]{0,4}:){1,7}[0-9a-fA-F]{0,4}$"
if ! [[ $ipv6_address =~ $IPV6_REGEX ]]; then
ipv6_address=""
else
if [[ ! $ipv6_address =~ ^\[ ]]; then
ipv6_address="[$ipv6_address]"
fi
fi
if [ "${ipv4_address}" ];then
getIpAddress=$ipv4_address
elif [ "${ipv6_address}" ];then
getIpAddress=$ipv6_address
fi
ipv4Check=$($python_bin -c "import re; print(re.match(r'^(?:[0-9]{1,3}\.){3}[0-9]{1,3}$','${getIpAddress}'))")
if [ "${ipv4Check}" == "None" ]; then
@@ -1886,7 +1907,7 @@ Get_Ip_Address() {
getIpAddress=$(echo "[$getIpAddress]")
echo "True" >${setup_path}/server/panel/data/ipv6.pl
sleep 1
/etc/init.d/bt restart
# /etc/init.d/bt restart
fi
fi

View File

@@ -3,12 +3,6 @@ PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH
LANG=en_US.UTF-8
INSTALL_LOGFILE="/tmp/btpanel-install.log"
if [ -f "$INSTALL_LOGFILE" ];then
rm -f $INSTALL_LOGFILE
fi
exec > >(tee -a "$INSTALL_LOGFILE") 2>&1
Btapi_Url='http://www.example.com'
Check_Api=$(curl -Ss --connect-timeout 5 -m 2 $Btapi_Url/api/SetupCount)
if [ "$Check_Api" != 'ok' ];then
@@ -39,8 +33,9 @@ if [ "${UbuntuCheck}" ] && [ "${UbuntuCheck}" -lt "16" ];then
fi
HOSTNAME_CHECK=$(cat /etc/hostname)
if [ -z "${HOSTNAME_CHECK}" ];then
echo "当前主机名hostname为空无法安装宝塔面板请咨询服务器运营商设置好hostname后再重新安装"
exit 1
echo "localhost" > /etc/hostname
# echo "当前主机名hostname为空无法安装宝塔面板请咨询服务器运营商设置好hostname后再重新安装"
# exit 1
fi
UBUNTU_NO_LTS=$(cat /etc/issue|grep Ubuntu|grep -E "19|21|23|25")
@@ -82,25 +77,25 @@ Ready_Check(){
exit 1
fi
ROOT_DISK_INODE=$(df -i|grep /$|awk '{print $2}')
if [ "${ROOT_DISK_INODE}" != "0" ];then
ROOT_DISK_INODE_FREE=$(df -i|grep /$|awk '{print $4}')
if [ "${ROOT_DISK_INODE_FREE}" -le 1000 ];then
echo -e "系统盘剩余inodes空间不足1000,无法继续安装!"
echo -e "请尝试清理磁盘空间后再重新进行安装"
exit 1
fi
fi
# ROOT_DISK_INODE=$(df -i|grep /$|awk '{print $2}')
# if [ "${ROOT_DISK_INODE}" != "0" ];then
# ROOT_DISK_INODE_FREE=$(df -i|grep /$|awk '{print $4}')
# if [ "${ROOT_DISK_INODE_FREE}" -le 1000 ];then
# echo -e "系统盘剩余inodes空间不足1000,无法继续安装!"
# echo -e "请尝试清理磁盘空间后再重新进行安装"
# exit 1
# fi
# fi
WWW_DISK_INODE==$(df -i|grep /www|awk '{print $2}')
if [ "${WWW_DISK_INODE}" ] && [ "${WWW_DISK_INODE}" != "0" ] ;then
WWW_DISK_INODE_FREE=$(df -i|grep /www|awk '{print $4}')
if [ "${WWW_DISK_INODE_FREE}" ] && [ "${WWW_DISK_INODE_FREE}" -le 1000 ] ;then
echo -e "/www盘剩余inodes空间不足1000, 无法继续安装!"
echo -e "请尝试清理磁盘空间后再重新进行安装"
exit 1
fi
fi
# WWW_DISK_INODE==$(df -i|grep /www|awk '{print $2}')
# if [ "${WWW_DISK_INODE}" ] && [ "${WWW_DISK_INODE}" != "0" ] ;then
# WWW_DISK_INODE_FREE=$(df -i|grep /www|awk '{print $4}')
# if [ "${WWW_DISK_INODE_FREE}" ] && [ "${WWW_DISK_INODE_FREE}" -le 1000 ] ;then
# echo -e "/www盘剩余inodes空间不足1000, 无法继续安装!"
# echo -e "请尝试清理磁盘空间后再重新进行安装"
# exit 1
# fi
# fi
}
GetSysInfo(){
@@ -244,7 +239,8 @@ Set_Repo_Url(){
if [ "${PM}"="apt-get" ];then
ALI_CLOUD_CHECK=$(grep Alibaba /etc/motd)
Tencent_Cloud=$(cat /etc/hostname |grep -E VM-[0-9]+-[0-9]+)
if [ "${ALI_CLOUD_CHECK}" ] || [ "${Tencent_Cloud}" ];then
VELINUX_CHECK=$(grep veLinux /etc/os-release)
if [ "${ALI_CLOUD_CHECK}" ] || [ "${Tencent_Cloud}" ] || [ "${VELINUX_CHECK}" ];then
return
fi
@@ -1062,7 +1058,7 @@ Install_Bt(){
echo "${panelPort}" > ${setup_path}/server/panel/data/port.pl
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
wget -O /www/server/panel/data/softList.conf ${download_Url}/install/conf/softListtls10.conf
rm -f /www/server/panel/class/*.so
if [ ! -f /www/server/panel/data/not_workorder.pl ]; then
@@ -1237,7 +1233,40 @@ Set_Firewall(){
}
Get_Ip_Address(){
getIpAddress=""
getIpAddress=$(curl -sS --connect-timeout 10 -m 60 https://www.bt.cn/Api/getIpAddress)
#getIpAddress=$(curl -sS --connect-timeout 10 -m 60 https://www.bt.cn/Api/getIpAddress)
ipv4_address=""
ipv6_address=""
ipv4_address=$(curl -4 -sS --connect-timeout 4 -m 5 https://api.bt.cn/Api/getIpAddress 2>&1)
if [ -z "${ipv4_address}" ];then
ipv4_address=$(curl -4 -sS --connect-timeout 4 -m 5 https://www.bt.cn/Api/getIpAddress 2>&1)
if [ -z "${ipv4_address}" ];then
ipv4_address=$(curl -4 -sS --connect-timeout 4 -m 5 https://www.aapanel.com/api/common/getClientIP 2>&1)
fi
fi
IPV4_REGEX="^([0-9]{1,3}\.){3}[0-9]{1,3}$"
if ! [[ $ipv4_address =~ $IPV4_REGEX ]]; then
ipv4_address=""
fi
ipv6_address=$(curl -6 -sS --connect-timeout 4 -m 5 https://www.bt.cn/Api/getIpAddress 2>&1)
IPV6_REGEX="^([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}$"
if ! [[ $ipv6_address =~ $IPV6_REGEX ]]; then
ipv6_address=""
else
if [[ ! $ipv6_address =~ ^\[ ]]; then
ipv6_address="[$ipv6_address]"
fi
fi
if [ "${ipv4_address}" ];then
getIpAddress=$ipv4_address
elif [ "${ipv6_address}" ];then
getIpAddress=$ipv6_address
fi
if [ -z "${getIpAddress}" ] || [ "${getIpAddress}" = "0.0.0.0" ]; then
isHosts=$(cat /etc/hosts|grep 'www.bt.cn')
if [ -z "${isHosts}" ];then
@@ -1266,6 +1295,7 @@ Get_Ip_Address(){
echo "True" > ${setup_path}/server/panel/data/ipv6.pl
sleep 1
/etc/init.d/bt restart
getIpAddress=$(echo "[$getIpAddress]")
fi
fi
@@ -1415,8 +1445,16 @@ echo -e "\033[32mCongratulations! Installed successfully!\033[0m"
echo -e "========================面板账户登录信息=========================="
echo -e ""
echo -e " 【云服务器】请在安全组放行 $panelPort 端口"
echo -e " 外网面板地址: ${HTTP_S}://${getIpAddress}:${panelPort}${auth_path}"
echo -e " 网面板地址: ${HTTP_S}://${LOCAL_IP}:${panelPort}${auth_path}"
if [ -z "${ipv4_address}" ] && [ -z "${ipv6_address}" ];then
echo -e " 网面板地址: ${HTTP_S}://SERVER_IP:${panelPort}${auth_path}"
fi
if [ "${ipv4_address}" ];then
echo -e " 外网ipv4面板地址: ${HTTP_S}://${ipv4_address}:${panelPort}${auth_path}"
fi
if [ "${ipv6_address}" ];then
echo -e " 外网ipv6面板地址: ${HTTP_S}://${ipv6_address}:${panelPort}${auth_path}"
fi
echo -e " 内网面板地址: ${HTTP_S}://${LOCAL_IP}:${panelPort}${auth_path}"
echo -e " username: $username"
echo -e " password: $password"
echo -e ""

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1 @@
{"hash": "d869ee4b8bdcfae324c4fdef9ec647db4a1529e7f6890b8cb4693f40b8a24626", "update_time": "1748242787"}

View File

@@ -102,8 +102,8 @@ if [ -f "/etc/redhat-release" ];then
fi
setup_path=/www
version=$(curl -Ss --connect-timeout 5 -m 2 $Btapi_Url/api/panel/get_version)
if [ -z "$VERSION_CHECK" ];then
version='9.4.0'
if [ -z "$version" ];then
version='9.5.0'
fi
armCheck=$(uname -m|grep arm)
if [ "${armCheck}" ];then
@@ -167,6 +167,7 @@ pip_list=$($mypip list 2>&1)
request_v=$(btpip list 2>/dev/null|grep "requests "|awk '{print $2}'|cut -d '.' -f 2)
if [ "$request_v" = "" ] || [ "${request_v}" -gt "28" ];then
$mypip install requests==2.27.1
$mypip install chardet==4.0.0
fi
NATSORT_C=$(echo $pip_list|grep natsort)

View File

@@ -947,11 +947,11 @@ version=$(curl -Ss --connect-timeout 12 -m 2 $Btapi_Url/api/panel/getLatestOffic
check_version_num=$( echo "$version"|grep -Eo '^[0-9]+' )
if [ "$check_version_num" = '' ];then
echo "Check version failed!"
version='7.0.13'
version='7.0.21'
fi
if [ "$version" = '' ];then
version='7.0.13'
version='7.0.21'
fi
# if [ "$1" ];then
@@ -970,6 +970,10 @@ fi
unzip -o /tmp/panel.zip -d $setup_path/server/ > /dev/null
rm -f /tmp/panel.zip
if [ -f "/www/server/panel/data/is_beta.pl" ];then
rm -f /www/server/panel/data/is_beta.pl
fi
Update_Py_Lib
cd $setup_path/server/panel/

Binary file not shown.

View File

@@ -18,7 +18,7 @@ Route::post('/Auth/GetBindCode', 'api/return_error');
Route::post('/auth/GetUserGiveAway', 'api/get_user_give_away');
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/get_malicious_ip', 'api/get_malicious_ip_list');
Route::any('/bt_waf/daily_count_v2', 'api/get_ssl_list');
Route::any('/bt_waf/latest_version', 'api/btwaf_latest_version');
@@ -121,9 +121,11 @@ 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');
Route::any('/bt_waf/get_system_malicious', 'api/return_error2');
Route::any('/panel/get_spider', 'api/get_spider');
Route::post('/Auth/GetSocre', 'api/get_ssl_list');
@@ -148,6 +150,7 @@ Route::group('api', function () {
Route::post('/panel/submit_feature_invoked_bulk', 'api/return_success');
Route::post('/panel/submit_expand_pack_used', 'api/return_success');
Route::get('/panel/getLatestOfficialVersion', 'api/get_version_en');
Route::post('/cert/user/list', 'api/nps_questions');
Route::miss('api/return_error');
});

View File

@@ -59,13 +59,6 @@
temp_file = temp_file.replace('https://download.bt.cn/install/public.sh', 'http://www.example.com/install/public.sh')
```
def check_status(self, softInfo): 方法最后一行加上
```python
if 'endtime' in softInfo:
softInfo['endtime'] = time.time() + 86400 * 3650
```
- class_v2/btdockerModelV2/flush_plugin.py 文件删除clear_hosts()一行
- install/install_soft.sh 在. 执行之前加入以下代码
@@ -81,17 +74,23 @@
"update_software_list": update_software_list,
"malicious_file_scanning": malicious_file_scanning,
"check_panel_msg": check_panel_msg,
"check_panel_auth": check_panel_auth,
"count_ssh_logs": count_ssh_logs,
"update_vulnerabilities": update_vulnerabilities,
"refresh_dockerapps": refresh_dockerapps,
"submit_email_statistics": submit_email_statistics,
"submit_module_call_statistics": submit_module_call_statistics,
"mailsys_domain_restrictions": mailsys_domain_restrictions,
"mailsys_domain_blecklisted_alarm": mailsys_domain_blecklisted_alarm,
- [可选]去除各种计算题将bt.js里面的内容复制到 BTPanel/static/vite/oldjs/public_backup.js 末尾

View File

@@ -148,6 +148,27 @@ def module_run(module_name,def_name,args):
result = run_object(args)
return result
def get_module(filename: str):
'''
@name 获取模块对象
@param filename<string> 模块文件名
@return object
'''
if not filename: return None
if filename[0:2] == './':
return public.returnMsg(False,'不能是相对路径')
if not public.path_safe_check(filename):
return public.returnMsg(False,'模块路径不合法')
if not os.path.exists(filename):
return public.returnMsg(False,'模块文件不存在' % filename)
def_object = public.get_script_object(filename)
if not def_object: return public.returnMsg(False,'模块[%s]不存在' % filename)
return def_object.main()
def get_plugin_list(upgrade_force = False):
'''

View File

@@ -121,14 +121,12 @@
- script/site_task.py 删除flush_ssh_log()
- [可选]去除各种计算题复制bt.js到 BTPanel/static/ ,在 BTPanel/templates/default/layout.html 的\</body\>前面加入
- [可选]去除各种计算题复制bt.js到 BTPanel/static/ ,在 BTPanel/templates/default/software.html 的 \<script\>window.vite_public_request_token 前面加入
```javascript
<script src="/static/bt.js"></script>
```
在 BTPanel/templates/default/software.html 的 \<script\>window.vite_public_request_token 前面加入
- [可选]去除创建网站自动创建的垃圾文件在class/panelSite.py分别删除
htaccess = self.sitePath + '/.htaccess'