From 06ddd9968e0adb9c03397f8f32d669f9fb69840d Mon Sep 17 00:00:00 2001 From: juewuy Date: Tue, 13 Feb 2024 21:43:44 +0800 Subject: [PATCH] =?UTF-8?q?~=E9=87=8D=E6=96=B0=E5=90=AF=E7=94=A8=E5=86=85?= =?UTF-8?q?=E6=A0=B8=E5=90=AF=E5=8A=A8=E5=90=8E=E4=BC=9A=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E6=B8=85=E7=90=86=E7=BC=93=E5=AD=98=E6=96=87=E4=BB=B6=E7=9A=84?= =?UTF-8?q?=E5=8A=9F=E8=83=BD=20~=E4=BF=AE=E5=A4=8Dpre5=E7=89=88=E6=9C=AC?= =?UTF-8?q?=E5=9B=A0=E4=B8=BA=E5=86=85=E6=A0=B8=E7=BC=93=E5=AD=98=E8=A2=AB?= =?UTF-8?q?=E6=B8=85=E7=90=86=E4=BA=A7=E7=94=9F=E7=9A=84=E6=8A=A5=E9=94=99?= =?UTF-8?q?=20~=E7=8E=B0=E5=9C=A8=E4=BD=BF=E7=94=A8providers=E7=94=9F?= =?UTF-8?q?=E6=88=90=E9=85=8D=E7=BD=AE=E6=96=87=E4=BB=B6=E5=90=8E=EF=BC=8C?= =?UTF-8?q?=E4=BC=9A=E8=87=AA=E5=8A=A8=E7=A6=81=E7=94=A8=E5=AE=9A=E6=97=B6?= =?UTF-8?q?=E6=9B=B4=E6=96=B0=E9=85=8D=E7=BD=AE=E5=8A=9F=E8=83=BD=20~?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=9B=A0=E9=93=BE=E6=8E=A5=E5=8C=85=E5=90=AB?= =?UTF-8?q?=E7=89=B9=E6=AE=8A=E5=AD=97=E7=AC=A6=E5=AF=BC=E8=87=B4providers?= =?UTF-8?q?=E9=93=BE=E6=8E=A5=E4=BF=AE=E6=94=B9=E5=87=BA=E9=94=99=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98=20~=E4=BF=AE=E5=A4=8D=E8=84=9A=E6=9C=AC?= =?UTF-8?q?=E5=AE=89=E8=A3=85=E6=88=96=E5=8D=87=E7=BA=A7=E6=97=B6=E7=9A=84?= =?UTF-8?q?=E9=83=A8=E5=88=86=E9=94=99=E8=AF=AF=E6=8F=90=E7=A4=BA=20~singb?= =?UTF-8?q?ox=E7=8E=B0=E5=9C=A8=E4=BC=9A=E8=87=AA=E5=8A=A8=E8=A1=A5?= =?UTF-8?q?=E5=85=A8=E9=85=8D=E7=BD=AE=E6=96=87=E4=BB=B6=E4=B8=AD=E7=BC=BA?= =?UTF-8?q?=E5=B0=91=E7=9A=84DIRECT=E5=8F=8AREJECT=E5=87=BA=E5=8F=A3?= =?UTF-8?q?=E5=AD=97=E6=AE=B5=20~=E4=BF=AE=E5=A4=8D=E5=9B=A0=E4=B8=BA?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E4=BA=86=E9=9D=A2=E6=9D=BF=E8=AE=BF=E9=97=AE?= =?UTF-8?q?=E5=AF=86=E7=A0=81=E5=AF=BC=E8=87=B4=E8=8A=82=E7=82=B9=E8=BF=98?= =?UTF-8?q?=E5=8E=9F=E5=A4=B1=E8=B4=A5=E7=9A=84bug=20~cnip=E7=BB=95?= =?UTF-8?q?=E8=BF=87=E6=96=87=E4=BB=B6=E8=B0=83=E6=95=B4=E4=B8=BA=E5=90=AF?= =?UTF-8?q?=E5=8A=A8=E5=89=8D=E4=B8=8B=E8=BD=BD=E8=80=8C=E4=B8=8D=E6=98=AF?= =?UTF-8?q?=E5=90=AF=E5=8A=A8=E6=88=90=E5=8A=9F=E5=90=8E=20~=E9=83=A8?= =?UTF-8?q?=E5=88=86=E6=96=87=E5=AD=97=E8=AF=B4=E6=98=8E=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/getdate.sh | 21 ++++++++++++++------- scripts/init.sh | 8 ++++---- scripts/menu.sh | 1 + scripts/start.sh | 29 +++++++++++++++-------------- scripts/task.sh | 1 - 5 files changed, 34 insertions(+), 26 deletions(-) diff --git a/scripts/getdate.sh b/scripts/getdate.sh index 061465c..bdcdfcc 100644 --- a/scripts/getdate.sh +++ b/scripts/getdate.sh @@ -390,16 +390,17 @@ EOF cut -c 1- ${TMPDIR}/providers/providers.yaml ${TMPDIR}/providers/proxy-groups.yaml ${TMPDIR}/providers/rules.yaml > ${TMPDIR}/config.yaml rm -rf ${TMPDIR}/providers #调用内核测试 - ${TMPDIR}/CrashCore -t -d ${BINDIR} -f ${TMPDIR}/config.yaml >/dev/null + ${CRASHDIR}/start.sh core_check && ${TMPDIR}/CrashCore -t -d ${BINDIR} -f ${TMPDIR}/config.yaml >/dev/null if [ "$?" = 0 ];then echo -e "\033[32m配置文件生成成功!\033[0m" mv -f ${TMPDIR}/config.yaml ${CRASHDIR}/yamls/config.yaml read -p "是否立即启动/重启服务?(1/0) > " res [ "$res" = 1 ] && { - start_core + start_core && $CRASHDIR/start.sh cronset '更新订阅' exit } else + rm -rf ${TMPDIR}/CrashCore echo -e "\033[31m生成配置文件出错,请仔细检查输入!\033[0m" fi } @@ -463,24 +464,26 @@ EOF #使用模版生成outbounds和rules模块 cat ${CRASHDIR}/providers/${provider_temp_file} | sed "s/{providers_tags}/$providers_tags/g" >> ${TMPDIR}/providers/outbounds.json #调用内核测试 - ${TMPDIR}/CrashCore merge ${TMPDIR}/config.json -C ${TMPDIR}/providers + ${CRASHDIR}/start.sh core_check && ${TMPDIR}/CrashCore merge ${TMPDIR}/config.json -C ${TMPDIR}/providers if [ "$?" = 0 ];then echo -e "\033[32m配置文件生成成功!\033[0m" mv -f ${TMPDIR}/config.json ${CRASHDIR}/jsons/config.json rm -rf ${TMPDIR}/providers read -p "是否立即启动/重启服务?(1/0) > " res [ "$res" = 1 ] && { - start_core + start_core && $CRASHDIR/start.sh cronset '更新订阅' exit } else echo -e "\033[31m生成配置文件出错,请仔细检查输入!\033[0m" + rm -rf ${TMPDIR}/CrashCore rm -rf ${TMPDIR}/providers fi } setproviders(){ #自定义providers echo ----------------------------------------------- echo -e "\033[33m你可以在这里快捷管理与生成自定义的providers提供者\033[0m" + echo -e "\033[33m暂时只支持yaml格式的配置导入\033[0m" [ -s $CRASHDIR/configs/providers.cfg ] && { echo ----------------------------------------------- echo -e "\033[36m输入对应数字可管理providers提供者\033[0m" @@ -524,6 +527,7 @@ setproviders(){ #自定义providers 2) read -p "请输入http(s)格式的providers链接地址 > " link if [ -n "$(echo $link | grep -E '.*\..*')" ] && [ -z "$(grep "$link" $CRASHDIR/configs/providers.cfg)" ];then + link=$(echo $link | sed 's/\&/\\\&/g') #特殊字符添加转义 sed -i "s|$provider_name $provider_url|$provider_name $link|" $CRASHDIR/configs/providers.cfg else echo -e "\033[31m输入错误,请重新输入!\033[0m" @@ -1003,7 +1007,7 @@ set_core_config(){ #配置文件功能 exit ;; 5) - source ${CRASHDIR}/task/task.sh && task_add + source ${CRASHDIR}/task/task.sh && task_menu set_core_config ;; 6) @@ -1676,7 +1680,7 @@ setgeo(){ #数据库选择菜单 rm -rf $CRASHDIR/$file done rm -rf $CRASHDIR/*.srs - echo -e "\033[33m所以数据库文件均已清理!\033[0m" + echo -e "\033[33m所有数据库文件均已清理!\033[0m" sleep 1 } setgeo @@ -2285,6 +2289,7 @@ debug(){ else ${TMPDIR}/CrashCore -t -d ${BINDIR} -f ${TMPDIR}/config.yaml fi + rm -rf ${TMPDIR}/CrashCore echo ----------------------------------------------- exit ;; @@ -2292,6 +2297,7 @@ debug(){ $CRASHDIR/start.sh stop $CRASHDIR/start.sh bfstart $COMMAND + rm -rf ${TMPDIR}/CrashCore echo ----------------------------------------------- exit ;; @@ -2318,7 +2324,8 @@ debug(){ main_menu ;; 9) - $TMPDIR/CrashCore merge $TMPDIR/debug.json -C $TMPDIR/jsons && echo -e "\033[32m合并成功!\033[0m" + ${CRASHDIR}/start.sh core_check && $TMPDIR/CrashCore merge $TMPDIR/debug.json -C $TMPDIR/jsons && echo -e "\033[32m合并成功!\033[0m" + rm -rf ${TMPDIR}/CrashCore main_menu ;; *) diff --git a/scripts/init.sh b/scripts/init.sh index ec3bf12..107022f 100644 --- a/scripts/init.sh +++ b/scripts/init.sh @@ -160,7 +160,7 @@ else [ -w /etc/systemd/system ] && sysdir=/etc/systemd/system if [ -n "$sysdir" -a "$USER" = "root" -a "$(cat /proc/1/comm)" = "systemd" ];then #创建shellcrash用户 - ckcmd userdel && userdel shellcrash 2>/dev/null + type userdel && userdel shellcrash 2>/dev/null sed -i '/0:7890/d' /etc/passwd sed -i '/x:7890/d' /etc/group if type useradd >/dev/null 2>&1; then @@ -217,12 +217,12 @@ if [ -n "$profile" ];then source $profile >/dev/null 2>&1 || echo 运行错误!请使用bash而不是dash运行安装命令!!! #适配zsh环境变量 [ -n "$(cat /etc/shells 2>/dev/null|grep -oE 'zsh')" ] && [ -z "$(cat ~/.zshrc 2>/dev/null|grep CRASHDIR)" ] && { - sed -i '/alias crash=*/'d ~/.zshrc + sed -i '/alias crash=*/'d ~/.zshrc 2>/dev/null echo "alias crash=\"$shtype $CRASHDIR/menu.sh\"" >> ~/.zshrc # 兼容 clash 命令 - sed -i '/alias clash=*/'d ~/.zshrc + sed -i '/alias clash=*/'d ~/.zshrc 2>/dev/null echo "alias clash=\"$shtype $CRASHDIR/menu.sh\"" >> ~/.zshrc - sed -i '/export CRASHDIR=*/'d ~/.zshrc + sed -i '/export CRASHDIR=*/'d ~/.zshrc 2>/dev/null echo "export CRASHDIR=\"$CRASHDIR\"" >> ~/.zshrc source ~/.zshrc >/dev/null 2>&1 } diff --git a/scripts/menu.sh b/scripts/menu.sh index 5473647..f5a6b99 100644 --- a/scripts/menu.sh +++ b/scripts/menu.sh @@ -166,6 +166,7 @@ startover(){ echo -e "其他设备可以使用PAC配置连接:\033[4;32mhttp://$host:$db_port/ui/pac\033[0m" echo -e "或者使用HTTP/SOCK5方式连接:IP{\033[36m$host\033[0m}端口{\033[36m$mix_port\033[0m}" fi + return 0 } start_core(){ if [ "$crashcore" = singbox -o "$crashcore" = singboxp ];then diff --git a/scripts/start.sh b/scripts/start.sh index fea7416..b15c0bc 100644 --- a/scripts/start.sh +++ b/scripts/start.sh @@ -730,10 +730,14 @@ EOF EOF fi #生成add_outbounds.json - [ -z "$(cat ${CRASHDIR}/jsons/*.json | grep -oE '"tag": *"DIRECT"')" ] && cat > ${TMPDIR}/jsons/add_outbounds.json < ${TMPDIR}/jsons/add_outbounds.json < /dev/null 2>&1;then - test=$(curl -s http://127.0.0.1:${db_port}/configs | grep -o port) - else - test=$(wget -q -O - http://127.0.0.1:${db_port}/configs | grep -o port) - fi + test=$(get_save http://127.0.0.1:${db_port}/configs | grep -o port) i=$((i+1)) done [ -n "$test" ] && { @@ -1465,11 +1465,11 @@ makehtml(){ #生成面板跳转文件

您还未安装本地面板

请在脚本更新功能中(9-4)安装
或者使用在线面板:

+

请复制当前地址/ui(不包括)前面的内容,填入url位置即可连接

Meta XD面板(推荐)
Meta YACD面板(推荐)
Clash YACD面板
- Clash Razord面板
-
如已安装,请使用Ctrl+F5强制刷新!
+
如已安装,请使用Ctrl+F5强制刷新!
/dev/null | grep 'root')" ] && { @@ -1672,11 +1675,9 @@ afstart(){ #启动后 i=$((i+1)) done if [ -n "$test" -o -n "$(pidof CrashCore)" ];then - #rm -rf ${TMPDIR}/CrashCore #删除缓存目录内核文件 + rm -rf ${TMPDIR}/CrashCore #删除缓存目录内核文件 #设置DNS转发 start_dns(){ - [ "$dns_mod" != "fake-ip" ] && [ "$cn_ip_route" = "已开启" ] && cn_ip_route - [ "$ipv6_redir" = "已开启" ] && [ "$dns_mod" != "fake-ip" ] && [ "$cn_ipv6_route" = "已开启" ] && cn_ipv6_route if [ "$dns_no" != "已禁用" ];then if [ "$dns_redir" != "已开启" ];then [ -n "$(echo $redir_mod|grep Nft)" ] && start_nft_dns || start_ipt_dns diff --git a/scripts/task.sh b/scripts/task.sh index 30f1938..5580f8d 100644 --- a/scripts/task.sh +++ b/scripts/task.sh @@ -152,7 +152,6 @@ ntp(){ [ "$crashcore" != singbox ] && ckcmd ntpd && ntpd -n -q -p 203.107.6.88 >/dev/null 2>&1 || exit 0 & } #任务工具 - logger(){ [ "$task_push" = 1 ] && push= || push=off [ -n "$2" -a "$2" != 0 ] && echo -e "\033[$2m$1\033[0m"