From 91a0866b9eabba5e73a0484ecba814cdf5bfeebd Mon Sep 17 00:00:00 2001 From: juewuy Date: Sat, 6 Jul 2024 15:41:53 +0800 Subject: [PATCH] =?UTF-8?q?~=E5=90=88=E5=B9=B6https://github.com/juewuy/Sh?= =?UTF-8?q?ellCrash/pull/700=E5=B9=B6=E4=BC=98=E5=8C=96=E6=96=87=E6=9C=AC?= =?UTF-8?q?=E6=8F=90=E7=A4=BA=20~=E4=BC=98=E5=8C=96=E5=AE=9A=E6=97=B6?= =?UTF-8?q?=E4=BB=BB=E5=8A=A1=E4=B8=AD=E5=91=A8=E6=97=A5=E7=9A=84=E8=BE=93?= =?UTF-8?q?=E5=85=A5=E6=8F=90=E7=A4=BA=E5=B9=B6=E5=A2=9E=E5=8A=A0=E5=AE=B9?= =?UTF-8?q?=E9=94=99=E6=9C=BA=E5=88=B6=20~=E4=BF=AE=E5=A4=8Diptables-tprox?= =?UTF-8?q?y=E6=A8=A1=E5=BC=8F=E7=A6=81=E7=94=A8quic=E5=A4=B1=E8=B4=A5?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98=20~=E4=BF=AE=E5=A4=8D=E4=BC=9A?= =?UTF-8?q?=E5=B0=86tun=E6=89=80=E7=94=A8=E7=BD=91=E6=AE=B5=E5=8A=A0?= =?UTF-8?q?=E5=85=A5=E5=B1=80=E5=9F=9F=E7=BD=91=E4=BB=A3=E7=90=86=E7=9A=84?= =?UTF-8?q?bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/menu.sh | 8 ++++---- scripts/start.sh | 8 +++----- scripts/task.sh | 9 ++++++--- 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/scripts/menu.sh b/scripts/menu.sh index e7183c8..ca5b6ec 100644 --- a/scripts/menu.sh +++ b/scripts/menu.sh @@ -724,7 +724,7 @@ setipv6(){ #ipv6设置 } setfirewall(){ #防火墙设置 set_cust_host_ipv4(){ - [ -z "$replace_default_host_ipv4" ] && replace_default_host_ipv4="未开启" + [ -z "$replace_default_host_ipv4" ] && replace_default_host_ipv4="未启用" echo ----------------------------------------------- echo -e "当前默认透明路由的网段为: \033[32m$(ip a 2>&1 | grep -w 'inet' | grep 'global' | grep 'br' | grep -v 'iot' | grep -E ' 1(92|0|72)\.' | sed 's/.*inet.//g' | sed 's/br.*$//g' | sed 's/metric.*$//g' | tr '\n' ' ' && echo ) \033[0m" @@ -736,10 +736,10 @@ setfirewall(){ #防火墙设置 read -p "请输入对应的序号或需要额外添加的网段 > " text case $text in 2) - if [ "$replace_default_host_ipv4" == "未禁用" ]; then - replace_default_host_ipv4="已禁用" + if [ "$replace_default_host_ipv4" == "未启用" ]; then + replace_default_host_ipv4="已启用" else - replace_default_host_ipv4="未禁用" + replace_default_host_ipv4="未启用" fi setconfig replace_default_host_ipv4 "$replace_default_host_ipv4" set_cust_host_ipv4 diff --git a/scripts/start.sh b/scripts/start.sh index ae33c2b..7c25b87 100644 --- a/scripts/start.sh +++ b/scripts/start.sh @@ -186,7 +186,7 @@ mark_time() { #时间戳 getlanip() { #获取局域网host地址 i=1 while [ "$i" -le "20" ]; do - host_ipv4=$(ip a 2>&1 | grep -w 'inet' | grep 'global' | grep 'brd' | grep -Ev 'iot|peer' | grep -E ' 1(92|0|72)\.' | sed 's/.*inet.//g' | sed 's/br.*$//g' | sed 's/metric.*$//g') #ipv4局域网网段 + host_ipv4=$(ip a 2>&1 | grep -w 'inet' | grep 'global' | grep 'brd' | grep -Ev 'utun|iot|peer' | grep -E ' 1(92|0|72)\.' | sed 's/.*inet.//g' | sed 's/br.*$//g' | sed 's/metric.*$//g') #ipv4局域网网段 [ "$ipv6_redir" = "已开启" ] && host_ipv6=$(ip a 2>&1 | grep -w 'inet6' | grep -E 'global' | sed 's/.*inet6.//g' | sed 's/scope.*$//g') #ipv6公网地址段 [ -f "$TMPDIR"/ShellCrash.log ] && break [ -n "$host_ipv4" -a "$ipv6_redir" != "已开启" ] && break @@ -1114,8 +1114,8 @@ start_iptables() { #iptables配置总入口 set_cn_ip='-m set ! --match-set cn_ip dst' set_cn_ip6='-m set ! --match-set cn_ip6 dst' } - iptables -I FORWARD -p udp --dport 443 -o utun $set_cn_ip -j REJECT >/dev/null 2>&1 - ip6tables -I FORWARD -p udp --dport 443 -o utun $set_cn_ip6 -j REJECT >/dev/null 2>&1 + iptables -I INPUT -p udp --dport 443 $set_cn_ip -j REJECT >/dev/null 2>&1 + ip6tables -I INPUT -p udp --dport 443 $set_cn_ip6 -j REJECT >/dev/null 2>&1 } } start_nft_route() { #nftables-route通用工具 @@ -1376,7 +1376,6 @@ stop_firewall() { #还原防火墙配置 #屏蔽QUIC [ "$dns_mod" != "fake-ip" -a "$cn_ip_route" = "已开启" ] && set_cn_ip='-m set ! --match-set cn_ip dst' iptables -D INPUT -p udp --dport 443 $set_cn_ip -j REJECT 2>/dev/null - iptables -D FORWARD -p udp --dport 443 -o utun $set_cn_ip -j REJECT 2>/dev/null #公网访问 for ip in $host_ipv4 $local_ipv4 $reserve_ipv4; do iptables -D INPUT -p tcp -s $ip --dport $mix_port -j ACCEPT 2>/dev/null @@ -1420,7 +1419,6 @@ stop_firewall() { #还原防火墙配置 #屏蔽QUIC [ "$dns_mod" != "fake-ip" -a "$cn_ipv6_route" = "已开启" ] && set_cn_ip6='-m set ! --match-set cn_ip6 dst' ip6tables -D INPUT -p udp --dport 443 $set_cn_ip6 -j REJECT 2>/dev/null - ip6tables -D FORWARD -p udp --dport 443 -o utun $set_cn_ip6 -j REJECT 2>/dev/null #公网访问 ip6tables -D INPUT -p tcp --dport $mix_port -j REJECT 2>/dev/null ip6tables -D INPUT -p tcp --dport $mix_port -j ACCEPT 2>/dev/null diff --git a/scripts/task.sh b/scripts/task.sh index 760058c..77c2c51 100644 --- a/scripts/task.sh +++ b/scripts/task.sh @@ -222,6 +222,7 @@ set_service(){ task_user_add(){ #自定义命令添加 echo ----------------------------------------------- echo -e "\033[33m命令可包含空格,请确保命令可执行!\033[0m" + echo -e "\033[36m此处不要添加执行条件,请在添加完成后返回添加具体执行条件!\033[0m" echo -e "也可以手动编辑\033[32m${CRASHDIR}/task/task.user\033[0m添加" read -p "请输入命令语句 > " script if [ -n "$script" ];then @@ -318,13 +319,15 @@ task_type(){ #任务条件选择菜单 ;; 1) echo ----------------------------------------------- - echo -e " 输入 1~7 对应\033[33m每周的指定某天\033[0m运行" - echo -e " 输入 1,3,6 代表\033[36m每周1,3,6\033[0m运行" + echo -e " 输入 0~6 对应\033[33m每周的指定某天\033[0m运行(0=周日)" + echo -e " 输入 1,4,0 代表\033[36m每周一、周四、周日\033[0m运行" echo -e " 输入 1-5 代表\033[36m周一至周五\033[0m运行" - read -p "请在每周哪天执行? > " week + read -p "在每周哪天执行? > " week + week=`echo ${week/7/0}` #把7换成0 echo ----------------------------------------------- read -p "想在该日的具体哪个小时执行?(0-23) > " hour cron_time="在每周$week的$hour点整" + cron_time=`echo ${cron_time/0/日}` #把0换成日 set_cron ;; 2)