v1.8.8
~增加了自动还原面板设置的功能(singbox内核未支持此功能) ~优化了singbox的tun网卡默认网段,与clash内核统一,防止回环等问题 ~修复了dns模式为mix时,常用端口过滤会导致部分地址无法访问的问题 ~修复了部分旧设备保持面板节点出错的问题 ~修复了新手引导的部分报错问题
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -5,4 +5,4 @@ meta_v=v1.18.0
|
|||||||
|
|
||||||
singbox_v=1.7.8
|
singbox_v=1.7.8
|
||||||
GeoIP_v=20240113
|
GeoIP_v=20240113
|
||||||
versionsh=1.8.7e
|
versionsh=1.8.8
|
||||||
|
|||||||
@@ -1726,8 +1726,8 @@ userguide(){
|
|||||||
setconfig ipv6_dns 已开启
|
setconfig ipv6_dns 已开启
|
||||||
}
|
}
|
||||||
#设置开机启动
|
#设置开机启动
|
||||||
[ -f /etc/rc.common ] && /etc/init.d/CrashCore enable
|
[ -f /etc/rc.common -a "$(cat /proc/1/comm)" = "procd" ] && /etc/init.d/shellcrash enable
|
||||||
ckcmd systemctl && systemctl enable shellcrash.service > /dev/null 2>&1
|
ckcmd systemctl && [ "$(cat /proc/1/comm)" = "systemd" ] && systemctl enable shellcrash.service > /dev/null 2>&1
|
||||||
rm -rf ${CRASHDIR}/.dis_startup
|
rm -rf ${CRASHDIR}/.dis_startup
|
||||||
autostart=enable
|
autostart=enable
|
||||||
#检测IP转发
|
#检测IP转发
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
# Copyright (C) Juewuy
|
# Copyright (C) Juewuy
|
||||||
|
|
||||||
version=1.8.7e
|
version=1.8.8
|
||||||
|
|
||||||
setdir(){
|
setdir(){
|
||||||
dir_avail(){
|
dir_avail(){
|
||||||
|
|||||||
@@ -1207,7 +1207,7 @@ normal_set(){ #基础设置
|
|||||||
echo -e " 不支持绕过CN-IP功能"
|
echo -e " 不支持绕过CN-IP功能"
|
||||||
echo -e " 2 redir_host模式:\033[32m兼容性更好\033[0m"
|
echo -e " 2 redir_host模式:\033[32m兼容性更好\033[0m"
|
||||||
echo -e " 需搭配加密DNS使用"
|
echo -e " 需搭配加密DNS使用"
|
||||||
echo -e " 3 mix混合模式: \033[32m内部realip外部fakeip\033[0m"
|
echo -e " 3 mix混合模式: \033[32m内部realip外部fakeip\033[0m"
|
||||||
echo -e " 限singbox内核+geosite.db!"
|
echo -e " 限singbox内核+geosite.db!"
|
||||||
echo " 0 返回上级菜单"
|
echo " 0 返回上级菜单"
|
||||||
read -p "请输入对应数字 > " num
|
read -p "请输入对应数字 > " num
|
||||||
|
|||||||
@@ -136,10 +136,11 @@ get_save(){ #获取面板信息
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
put_save(){ #推送面板选择
|
put_save(){ #推送面板选择
|
||||||
|
[ -z "$3" ] && request_type=GET || request_type=$3
|
||||||
if curl --version > /dev/null 2>&1;then
|
if curl --version > /dev/null 2>&1;then
|
||||||
curl -sS -X PUT -H "Authorization: Bearer ${secret}" -H "Content-Type:application/json" "$1" -d "$2" >/dev/null
|
curl -sS -X ${request_type} -H "Authorization: Bearer ${secret}" -H "Content-Type:application/json" "$1" -d "$2" >/dev/null
|
||||||
elif wget --version > /dev/null 2>&1;then
|
elif wget --version > /dev/null 2>&1;then
|
||||||
wget -q --method=PUT --header="Authorization: Bearer ${secret}" --header="Content-Type:application/json" --body-data="$2" "$1" >/dev/null
|
wget -q --method=${request_type} --header="Authorization: Bearer ${secret}" --header="Content-Type:application/json" --body-data="$2" "$1" >/dev/null
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
get_bin(){ #专用于项目内部文件的下载
|
get_bin(){ #专用于项目内部文件的下载
|
||||||
@@ -585,7 +586,7 @@ EOF
|
|||||||
"final": "dns_direct",
|
"final": "dns_direct",
|
||||||
"independent_cache": true,
|
"independent_cache": true,
|
||||||
"reverse_mapping": true,
|
"reverse_mapping": true,
|
||||||
"fakeip": { "enabled": true, "inet4_range": "198.18.0.0/15", "inet6_range": "fc00::/18" }
|
"fakeip": { "enabled": true, "inet4_range": "198.18.0.0/16", "inet6_range": "fc00::/18" }
|
||||||
},
|
},
|
||||||
EOF
|
EOF
|
||||||
}
|
}
|
||||||
@@ -643,7 +644,7 @@ EOF
|
|||||||
"type": "tun",
|
"type": "tun",
|
||||||
"tag": "tun-in",
|
"tag": "tun-in",
|
||||||
"interface_name": "utun",
|
"interface_name": "utun",
|
||||||
"inet4_address": "172.19.0.1/30",
|
"inet4_address": "198.18.0.0/16",
|
||||||
"auto_route": false,
|
"auto_route": false,
|
||||||
"stack": "system",
|
"stack": "system",
|
||||||
"sniff": $sniffer,
|
"sniff": $sniffer,
|
||||||
@@ -786,7 +787,7 @@ start_redir(){ #iptables-redir
|
|||||||
fi
|
fi
|
||||||
#将PREROUTING链指向shellcrash链
|
#将PREROUTING链指向shellcrash链
|
||||||
iptables -t nat -A PREROUTING -p tcp $ports -j shellcrash
|
iptables -t nat -A PREROUTING -p tcp $ports -j shellcrash
|
||||||
[ "$dns_mod" = "fake-ip" -a "$common_ports" = "已开启" ] && iptables -t nat -A PREROUTING -p tcp -d 198.18.0.0/16 -j shellcrash
|
[ "$dns_mod" != "redir_host" -a "$common_ports" = "已开启" ] && iptables -t nat -A PREROUTING -p tcp -d 198.18.0.0/16 -j shellcrash
|
||||||
#设置ipv6转发
|
#设置ipv6转发
|
||||||
if [ "$ipv6_redir" = "已开启" -a -n "$(lsmod | grep 'ip6table_nat')" ];then
|
if [ "$ipv6_redir" = "已开启" -a -n "$(lsmod | grep 'ip6table_nat')" ];then
|
||||||
ip6tables -t nat -N shellcrashv6
|
ip6tables -t nat -N shellcrashv6
|
||||||
@@ -887,7 +888,7 @@ start_tproxy(){ #iptables-tproxy
|
|||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
iptables -t mangle -A PREROUTING -p $1 $ports -j shellcrash
|
iptables -t mangle -A PREROUTING -p $1 $ports -j shellcrash
|
||||||
[ "$dns_mod" = "fake-ip" -a "$common_ports" = "已开启" ] && iptables -t mangle -A PREROUTING -p $1 -d 198.18.0.0/16 -j shellcrash
|
[ "$dns_mod" != "redir_host" -a "$common_ports" = "已开启" ] && iptables -t mangle -A PREROUTING -p $1 -d 198.18.0.0/16 -j shellcrash
|
||||||
}
|
}
|
||||||
[ "$1" = "all" ] && tproxy_set tcp
|
[ "$1" = "all" ] && tproxy_set tcp
|
||||||
tproxy_set udp
|
tproxy_set udp
|
||||||
@@ -1293,25 +1294,29 @@ stop_firewall(){ #还原防火墙配置
|
|||||||
web_save(){ #最小化保存面板节点选择
|
web_save(){ #最小化保存面板节点选择
|
||||||
getconfig
|
getconfig
|
||||||
#使用get_save获取面板节点设置
|
#使用get_save获取面板节点设置
|
||||||
get_save http://127.0.0.1:${db_port}/proxies | awk -F ':\\{"' '{for(i=1;i<=NF;i++) print $i}' | grep -aE '"Selector"' | grep -aoE '"name":.*"now":".*",' > ${TMPDIR}/shellcrash_web_check_$USER
|
get_save http://127.0.0.1:${db_port}/proxies | sed 's/:{/!/g' | awk -F '!' '{for(i=1;i<=NF;i++) print $i}' | grep -aE '"Selector"' | grep -aoE '"name":.*"now":".*",' > ${TMPDIR}/web_proxies
|
||||||
while read line ;do
|
while read line ;do
|
||||||
def=$(echo $line | grep -oE '"all".*",' | awk -F "[:\"]" '{print $5}' )
|
def=$(echo $line | grep -oE '"all".*",' | awk -F "[:\"]" '{print $5}' )
|
||||||
now=$(echo $line | grep -oE '"now".*",' | awk -F "[:\"]" '{print $5}' )
|
now=$(echo $line | grep -oE '"now".*",' | awk -F "[:\"]" '{print $5}' )
|
||||||
[ "$def" != "$now" ] && {
|
[ "$def" != "$now" ] && {
|
||||||
name=$(echo $line | grep -oE '"name".*",' | awk -F "[:\"]" '{print $5}' )
|
name=$(echo $line | grep -oE '"name".*",' | awk -F "[:\"]" '{print $5}' )
|
||||||
echo "${name},${now}" >> ${TMPDIR}/shellcrash_web_save_$USER
|
echo "${name},${now}" >> ${TMPDIR}/web_save
|
||||||
}
|
}
|
||||||
done < ${TMPDIR}/shellcrash_web_check_$USER
|
done < ${TMPDIR}/web_proxies
|
||||||
rm -rf ${TMPDIR}/shellcrash_web_check_$USER
|
rm -rf ${TMPDIR}/web_proxies
|
||||||
|
#获取面板设置
|
||||||
|
[ "$crashcore" != singbox ] && get_save http://127.0.0.1:${db_port}/configs > ${TMPDIR}/web_configs
|
||||||
#对比文件,如果有变动且不为空则写入磁盘,否则清除缓存
|
#对比文件,如果有变动且不为空则写入磁盘,否则清除缓存
|
||||||
if [ -s ${TMPDIR}/shellcrash_web_save_$USER ];then
|
for file in web_save web_configs ;do
|
||||||
compare ${TMPDIR}/shellcrash_web_save_$USER ${CRASHDIR}/configs/web_save
|
if [ -s ${TMPDIR}/${file} ];then
|
||||||
[ "$?" = 0 ] && rm -rf ${TMPDIR}/shellcrash_web_save_$USER || mv -f ${TMPDIR}/shellcrash_web_save_$USER ${CRASHDIR}/configs/web_save
|
compare ${TMPDIR}/${file} ${CRASHDIR}/configs/${file}
|
||||||
else
|
[ "$?" = 0 ] && rm -rf ${TMPDIR}/${file} || mv -f ${TMPDIR}/${file} ${CRASHDIR}/configs/${file}
|
||||||
echo > ${CRASHDIR}/configs/web_save
|
else
|
||||||
fi
|
echo > ${CRASHDIR}/configs/${file}
|
||||||
|
fi
|
||||||
|
done
|
||||||
}
|
}
|
||||||
web_restore(){ #还原面板节点
|
web_restore(){ #还原面板选择
|
||||||
getconfig
|
getconfig
|
||||||
#设置循环检测clash面板端口
|
#设置循环检测clash面板端口
|
||||||
i=1
|
i=1
|
||||||
@@ -1324,15 +1329,19 @@ web_restore(){ #还原面板节点
|
|||||||
fi
|
fi
|
||||||
i=$((i+1))
|
i=$((i+1))
|
||||||
done
|
done
|
||||||
#发送数据
|
#发送节点选择数据
|
||||||
num=$(cat ${CRASHDIR}/configs/web_save | wc -l)
|
[ -s ${CRASHDIR}/configs/web_save ] && {
|
||||||
i=1
|
num=$(cat ${CRASHDIR}/configs/web_save | wc -l)
|
||||||
while [ "$i" -le "$num" ];do
|
i=1
|
||||||
group_name=$(awk -F ',' 'NR=="'${i}'" {print $1}' ${CRASHDIR}/configs/web_save | sed 's/ /%20/g')
|
while [ "$i" -le "$num" ];do
|
||||||
now_name=$(awk -F ',' 'NR=="'${i}'" {print $2}' ${CRASHDIR}/configs/web_save)
|
group_name=$(awk -F ',' 'NR=="'${i}'" {print $1}' ${CRASHDIR}/configs/web_save | sed 's/ /%20/g')
|
||||||
put_save http://127.0.0.1:${db_port}/proxies/${group_name} "{\"name\":\"${now_name}\"}"
|
now_name=$(awk -F ',' 'NR=="'${i}'" {print $2}' ${CRASHDIR}/configs/web_save)
|
||||||
i=$((i+1))
|
put_save http://127.0.0.1:${db_port}/proxies/${group_name} "{\"name\":\"${now_name}\"}"
|
||||||
done
|
i=$((i+1))
|
||||||
|
done
|
||||||
|
}
|
||||||
|
#还原面板设置
|
||||||
|
[ "$crashcore" != singbox ] && [ -s ${CRASHDIR}/configs/web_configs ] && put_save http://127.0.0.1:${db_port}/configs "$(cat ${CRASHDIR}/configs/web_configs)" PATCH
|
||||||
}
|
}
|
||||||
makehtml(){ #生成面板跳转文件
|
makehtml(){ #生成面板跳转文件
|
||||||
cat > ${BINDIR}/ui/index.html <<EOF
|
cat > ${BINDIR}/ui/index.html <<EOF
|
||||||
@@ -1463,7 +1472,7 @@ clash_check(){ #clash启动前检查
|
|||||||
}
|
}
|
||||||
singbox_check(){ #singbox启动前检查
|
singbox_check(){ #singbox启动前检查
|
||||||
#检测SSR节点
|
#检测SSR节点
|
||||||
if [ -n "$(cat $core_config | grep -oE '"type": "ssr"')" ];then
|
if [ -n "$(cat $core_config | grep -oE '"shadowsocksr"')" ];then
|
||||||
echo -----------------------------------------------
|
echo -----------------------------------------------
|
||||||
logger "singbox以移除对SSR相关协议的支持,请使用clash系内核!" 33
|
logger "singbox以移除对SSR相关协议的支持,请使用clash系内核!" 33
|
||||||
exit 1
|
exit 1
|
||||||
@@ -1600,9 +1609,9 @@ afstart(){ #启动后
|
|||||||
}
|
}
|
||||||
ckcmd iptables && start_wan #本地防火墙
|
ckcmd iptables && start_wan #本地防火墙
|
||||||
mark_time #标记启动时间
|
mark_time #标记启动时间
|
||||||
[ -s ${CRASHDIR}/configs/web_save ] && web_restore &>/dev/null & #后台还原面板配置
|
[ -s ${CRASHDIR}/configs/web_save -o -s ${CRASHDIR}/configs/web_configs ] && web_restore &>/dev/null & #后台还原面板配置
|
||||||
{ sleep 5;logger Clash服务已启动!;} & #推送日志
|
{ sleep 5;logger Clash服务已启动!;} & #推送日志
|
||||||
#加载定身任务
|
#加载定时任务
|
||||||
[ -s ${CRASHDIR}/task/cron ] && croncmd ${CRASHDIR}/task/cron
|
[ -s ${CRASHDIR}/task/cron ] && croncmd ${CRASHDIR}/task/cron
|
||||||
[ -s ${CRASHDIR}/task/running ] && {
|
[ -s ${CRASHDIR}/task/running ] && {
|
||||||
cronset '运行时每'
|
cronset '运行时每'
|
||||||
|
|||||||
Reference in New Issue
Block a user