diff --git a/bin/ShellCrash.tar.gz b/bin/ShellCrash.tar.gz index 8e61ec3..3c89bf4 100644 Binary files a/bin/ShellCrash.tar.gz and b/bin/ShellCrash.tar.gz differ diff --git a/bin/clashfm.tar.gz b/bin/clashfm.tar.gz index 29e131c..6ea0dc4 100644 Binary files a/bin/clashfm.tar.gz and b/bin/clashfm.tar.gz differ diff --git a/bin/public.tar.gz b/bin/public.tar.gz index 763d151..3ca34fb 100644 Binary files a/bin/public.tar.gz and b/bin/public.tar.gz differ diff --git a/bin/version b/bin/version index 7a15107..996652f 100644 --- a/bin/version +++ b/bin/version @@ -5,4 +5,4 @@ meta_v=v1.18.0 singbox_v=1.7.8 GeoIP_v=20240113 -versionsh=1.8.7e +versionsh=1.8.8 diff --git a/scripts/getdate.sh b/scripts/getdate.sh index 8649203..fe9773d 100644 --- a/scripts/getdate.sh +++ b/scripts/getdate.sh @@ -1726,8 +1726,8 @@ userguide(){ setconfig ipv6_dns 已开启 } #设置开机启动 - [ -f /etc/rc.common ] && /etc/init.d/CrashCore enable - ckcmd systemctl && systemctl enable shellcrash.service > /dev/null 2>&1 + [ -f /etc/rc.common -a "$(cat /proc/1/comm)" = "procd" ] && /etc/init.d/shellcrash enable + ckcmd systemctl && [ "$(cat /proc/1/comm)" = "systemd" ] && systemctl enable shellcrash.service > /dev/null 2>&1 rm -rf ${CRASHDIR}/.dis_startup autostart=enable #检测IP转发 diff --git a/scripts/init.sh b/scripts/init.sh index 6ae0520..de7d663 100644 --- a/scripts/init.sh +++ b/scripts/init.sh @@ -1,7 +1,7 @@ #!/bin/sh # Copyright (C) Juewuy -version=1.8.7e +version=1.8.8 setdir(){ dir_avail(){ diff --git a/scripts/menu.sh b/scripts/menu.sh index 834d865..ccce527 100644 --- a/scripts/menu.sh +++ b/scripts/menu.sh @@ -1207,7 +1207,7 @@ normal_set(){ #基础设置 echo -e " 不支持绕过CN-IP功能" echo -e " 2 redir_host模式:\033[32m兼容性更好\033[0m" 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 " 0 返回上级菜单" read -p "请输入对应数字 > " num diff --git a/scripts/start.sh b/scripts/start.sh index 5613c4f..0ed93e9 100644 --- a/scripts/start.sh +++ b/scripts/start.sh @@ -136,10 +136,11 @@ get_save(){ #获取面板信息 fi } put_save(){ #推送面板选择 + [ -z "$3" ] && request_type=GET || request_type=$3 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 - 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 } get_bin(){ #专用于项目内部文件的下载 @@ -585,7 +586,7 @@ EOF "final": "dns_direct", "independent_cache": 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 } @@ -643,7 +644,7 @@ EOF "type": "tun", "tag": "tun-in", "interface_name": "utun", - "inet4_address": "172.19.0.1/30", + "inet4_address": "198.18.0.0/16", "auto_route": false, "stack": "system", "sniff": $sniffer, @@ -786,7 +787,7 @@ start_redir(){ #iptables-redir fi #将PREROUTING链指向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转发 if [ "$ipv6_redir" = "已开启" -a -n "$(lsmod | grep 'ip6table_nat')" ];then ip6tables -t nat -N shellcrashv6 @@ -887,7 +888,7 @@ start_tproxy(){ #iptables-tproxy done fi 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 tproxy_set udp @@ -1293,25 +1294,29 @@ stop_firewall(){ #还原防火墙配置 web_save(){ #最小化保存面板节点选择 getconfig #使用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 def=$(echo $line | grep -oE '"all".*",' | awk -F "[:\"]" '{print $5}' ) now=$(echo $line | grep -oE '"now".*",' | awk -F "[:\"]" '{print $5}' ) [ "$def" != "$now" ] && { 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 - rm -rf ${TMPDIR}/shellcrash_web_check_$USER + done < ${TMPDIR}/web_proxies + 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 - compare ${TMPDIR}/shellcrash_web_save_$USER ${CRASHDIR}/configs/web_save - [ "$?" = 0 ] && rm -rf ${TMPDIR}/shellcrash_web_save_$USER || mv -f ${TMPDIR}/shellcrash_web_save_$USER ${CRASHDIR}/configs/web_save - else - echo > ${CRASHDIR}/configs/web_save - fi + for file in web_save web_configs ;do + if [ -s ${TMPDIR}/${file} ];then + compare ${TMPDIR}/${file} ${CRASHDIR}/configs/${file} + [ "$?" = 0 ] && rm -rf ${TMPDIR}/${file} || mv -f ${TMPDIR}/${file} ${CRASHDIR}/configs/${file} + else + echo > ${CRASHDIR}/configs/${file} + fi + done } -web_restore(){ #还原面板节点 +web_restore(){ #还原面板选择 getconfig #设置循环检测clash面板端口 i=1 @@ -1324,15 +1329,19 @@ web_restore(){ #还原面板节点 fi i=$((i+1)) done - #发送数据 - num=$(cat ${CRASHDIR}/configs/web_save | wc -l) - i=1 - while [ "$i" -le "$num" ];do - group_name=$(awk -F ',' 'NR=="'${i}'" {print $1}' ${CRASHDIR}/configs/web_save | sed 's/ /%20/g') - now_name=$(awk -F ',' 'NR=="'${i}'" {print $2}' ${CRASHDIR}/configs/web_save) - put_save http://127.0.0.1:${db_port}/proxies/${group_name} "{\"name\":\"${now_name}\"}" - i=$((i+1)) - done + #发送节点选择数据 + [ -s ${CRASHDIR}/configs/web_save ] && { + num=$(cat ${CRASHDIR}/configs/web_save | wc -l) + i=1 + while [ "$i" -le "$num" ];do + group_name=$(awk -F ',' 'NR=="'${i}'" {print $1}' ${CRASHDIR}/configs/web_save | sed 's/ /%20/g') + now_name=$(awk -F ',' 'NR=="'${i}'" {print $2}' ${CRASHDIR}/configs/web_save) + put_save http://127.0.0.1:${db_port}/proxies/${group_name} "{\"name\":\"${now_name}\"}" + 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(){ #生成面板跳转文件 cat > ${BINDIR}/ui/index.html </dev/null & #后台还原面板配置 + [ -s ${CRASHDIR}/configs/web_save -o -s ${CRASHDIR}/configs/web_configs ] && web_restore &>/dev/null & #后台还原面板配置 { sleep 5;logger Clash服务已启动!;} & #推送日志 - #加载定身任务 + #加载定时任务 [ -s ${CRASHDIR}/task/cron ] && croncmd ${CRASHDIR}/task/cron [ -s ${CRASHDIR}/task/running ] && { cronset '运行时每'