From d8a9ce9ec347193319c171e014f60e6d7e71a6fc Mon Sep 17 00:00:00 2001 From: juewuy Date: Sun, 20 Oct 2024 10:52:27 +0800 Subject: [PATCH] =?UTF-8?q?~=E5=A2=9E=E5=8A=A0=E5=AF=B9=E8=87=AA=E5=AE=9A?= =?UTF-8?q?=E4=B9=89=E4=BF=9D=E7=95=99=E5=9C=B0=E5=9D=80=E6=AE=B5=E7=9A=84?= =?UTF-8?q?=E8=BE=93=E5=85=A5=E6=A0=A1=E9=AA=8C=E6=9C=BA=E5=88=B6=20~?= =?UTF-8?q?=E5=B0=9D=E8=AF=95=E4=BF=AE=E5=A4=8D=E9=83=A8=E5=88=86=E6=83=85?= =?UTF-8?q?=E5=86=B5=E4=B8=8B=E5=AE=89=E8=A3=85=E6=97=B6=E6=9C=AA=E6=AD=A3?= =?UTF-8?q?=E7=A1=AE=E5=88=9D=E5=A7=8B=E5=8C=96=E7=9A=84bug=20~=E4=BF=AE?= =?UTF-8?q?=E5=A4=8Dnftables-redir=E6=A8=A1=E5=BC=8F=E4=B8=8B=E4=BC=9A?= =?UTF-8?q?=E9=94=99=E8=AF=AF=E8=BF=90=E8=A1=8Ctproxy=E6=A8=A1=E5=BC=8F?= =?UTF-8?q?=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- install.sh | 8 ++++---- scripts/menu.sh | 8 +++++--- scripts/start.sh | 2 +- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/install.sh b/install.sh index 5d31b53..a0e4756 100644 --- a/install.sh +++ b/install.sh @@ -61,8 +61,8 @@ gettar(){ echo 开始解压文件! mkdir -p $CRASHDIR > /dev/null tar -zxf '/tmp/ShellCrash.tar.gz' -C $CRASHDIR/ || tar -zxf '/tmp/ShellCrash.tar.gz' --no-same-owner -C $CRASHDIR/ - if [ -f $CRASHDIR/init.sh ];then - . $CRASHDIR/init.sh >/dev/null + if [ -s $CRASHDIR/init.sh ];then + . $CRASHDIR/init.sh >/dev/null || $echo "\033[33m初始化失败,请尝试本地安装!\033[0m" else rm -rf /tmp/ShellCrash.tar.gz $echo "\033[33m文件解压失败!\033[0m" @@ -203,8 +203,8 @@ echo ----------------------------------------------- gettar echo ----------------------------------------------- echo ShellCrash 已经安装成功! -[ "$profile" = "~/.bashrc" ] && echo "请执行【source ~/.bashrc &> /dev/null】命令以加载环境变量!" -[ -n "$(ls -l /bin/sh|grep -oE 'zsh')" ] && echo "请执行【source ~/.zshrc &> /dev/null】命令以加载环境变量!" +[ "$profile" = "~/.bashrc" ] && echo "请执行【. ~/.bashrc &> /dev/null】命令以加载环境变量!" +[ -n "$(ls -l /bin/sh|grep -oE 'zsh')" ] && echo "请执行【. ~/.zshrc &> /dev/null】命令以加载环境变量!" echo ----------------------------------------------- $echo "\033[33m输入\033[30;47m crash \033[0;33m命令即可管理!!!\033[0m" echo ----------------------------------------------- diff --git a/scripts/menu.sh b/scripts/menu.sh index 393e17b..1f52367 100644 --- a/scripts/menu.sh +++ b/scripts/menu.sh @@ -808,12 +808,14 @@ setfirewall(){ #防火墙设置 [ -z "$reserve_ipv4" ] && reserve_ipv4="0.0.0.0/8 10.0.0.0/8 127.0.0.0/8 100.64.0.0/10 169.254.0.0/16 172.16.0.0/12 192.168.0.0/16 224.0.0.0/4 240.0.0.0/4" echo -e "当前网段:\033[36m$reserve_ipv4\033[0m" echo -e "\033[33m地址必须是空格分隔,错误的设置可能导致网络回环或启动报错,请务必谨慎!\033[0m" - read -p "请输入 > " reserve_ipv4 - if [ -n "$reserve_ipv4" ];then + read -p "请输入 > " text + if [ -n "$(echo $text |grep -E "(((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])/(3[0-2]|[1-2]?[0-9]))( +|$)+" +)" ];then + reserve_ipv4="$text" echo -e "已将保留地址网段设为:\033[32m$reserve_ipv4\033[0m" setconfig reserve_ipv4 "\'$reserve_ipv4\'" else - echo -e "\033[31m操作已取消!\033[0m" + echo -e "\033[31m输入有误,操作已取消!\033[0m" fi sleep 1 setfirewall diff --git a/scripts/start.sh b/scripts/start.sh index fe08ca1..6a64658 100644 --- a/scripts/start.sh +++ b/scripts/start.sh @@ -1325,7 +1325,7 @@ start_nftables() { #nftables配置总入口 [ "$lan_proxy" = true ] && start_nft_route prerouting prerouting nat -100 [ "$local_proxy" = true ] && start_nft_route output output nat -100 } - [ "$redir_mod" = "Tproxy模式" ] && modprobe nft_tproxy >/dev/null 2>&1 || lsmod 2>/dev/null | grep -q nft_tproxy && { + [ "$redir_mod" = "Tproxy模式" ] && ( modprobe nft_tproxy >/dev/null 2>&1 || lsmod 2>/dev/null | grep -q nft_tproxy ) && { JUMP="meta l4proto {tcp, udp} mark set $fwmark tproxy to :$tproxy_port" #跳转劫持的具体命令 [ "$lan_proxy" = true ] && start_nft_route prerouting prerouting filter -150 [ "$local_proxy" = true ] && {