diff --git a/ShellCrash.tar.gz b/ShellCrash.tar.gz index 77e93bd1..c02a904e 100644 Binary files a/ShellCrash.tar.gz and b/ShellCrash.tar.gz differ diff --git a/bin/version b/bin/version index e40a355d..aae440a0 100644 --- a/bin/version +++ b/bin/version @@ -1,4 +1,4 @@ meta_v=v1.19.17 singboxr_v=1.13.0-alpha.27 -versionsh=1.9.5beta1 +versionsh=1.9.5beta2 GeoIP_v=20251205 diff --git a/scripts/libs/get_config.sh b/scripts/libs/get_config.sh index af3305d4..31fcdb1d 100644 --- a/scripts/libs/get_config.sh +++ b/scripts/libs/get_config.sh @@ -17,7 +17,7 @@ routing_mark=$((fwmark + 2)) [ -z "$dns_nameserver" ] && { dns_nameserver='223.5.5.5, 1.2.4.8' - netstat -ntlup 2>/dev/null | grep -q '127.0.0.1:53' && dns_nameserver='127.0.0.1' + netstat -ntlup 2>/dev/null | grep -q '127.0.0.1:53' || ss -ntlup 2>/dev/null | grep -q '127.0.0.1:53' && dns_nameserver='127.0.0.1' } [ -z "$dns_fallback" ] && dns_fallback="1.1.1.1, 8.8.8.8" [ -z "$dns_resolver" ] && dns_resolver="223.5.5.5, 2400:3200::1" diff --git a/scripts/menu.sh b/scripts/menu.sh index c902871c..a685d357 100644 --- a/scripts/menu.sh +++ b/scripts/menu.sh @@ -118,12 +118,12 @@ ckstatus() { PID=$(pidof CrashCore | awk '{print $NF}') if [ -n "$PID" ]; then - run="\033[32m$MENU_RUN_ON($redir_mod$MENU_MOD)\033[0m" + run="\033[32m$MENU_RUN_ON ($redir_mod$MENU_MOD) \033[0m" running_status elif [ "$firewall_area" = 5 ] && [ -n "$(ip route list table 100)" ]; then - run="\033[32m$MENU_RUN_SET($redir_mod$MENU_MOD)\033[0m" + run="\033[32m$MENU_RUN_SET ($redir_mod$MENU_MOD) \033[0m" else - run="\033[31m$MENU_RUN_OFF($redir_mod$MENU_MOD)\033[0m" + run="\033[31m$MENU_RUN_OFF ($redir_mod$MENU_MOD) \033[0m" # 检测系统端口占用 checkport fi diff --git a/scripts/menus/2_settings.sh b/scripts/menus/2_settings.sh index 27e510ba..96b30244 100644 --- a/scripts/menus/2_settings.sh +++ b/scripts/menus/2_settings.sh @@ -569,8 +569,6 @@ set_firewall_area() { [1-4]) if [ "$firewall_area" -ge 4 ]; then redir_mod='' - else - redir_mod=Redir fi firewall_area="$num" setconfig firewall_area "$firewall_area" diff --git a/scripts/menus/8_tools.sh b/scripts/menus/8_tools.sh index ad1c0f7c..95f2e3e1 100644 --- a/scripts/menus/8_tools.sh +++ b/scripts/menus/8_tools.sh @@ -592,10 +592,17 @@ testcommand() { 2) line_break echo "===========================================================" - netstat -ntulp | grep 53 + if ckcmd netstat;then + netstat -ntulp | grep 53 + elif ckcmd ss;then + ss -ntulp | grep 53 + else + echo -e "Neither net-tools nor iproute2 is installed. Please install one of these packages and try again." + fi echo echo -e "$TOOLS_NETSTAT_HINT" echo "===========================================================" + sleep 2 ;; 3) line_break diff --git a/scripts/menus/9_upgrade.sh b/scripts/menus/9_upgrade.sh index b887c9c9..ccc8de72 100644 --- a/scripts/menus/9_upgrade.sh +++ b/scripts/menus/9_upgrade.sh @@ -833,7 +833,7 @@ setgeo() { while true; do comp_box "\033[33m${UPG_GEO_CLEAN_HINT1_PREFIX}${CRASHDIR}${UPG_GEO_CLEAN_HINT1_SUFFIX}\033[0m" \ "$UPG_GEO_CLEAN_HINT2" - btm_box "$UPG_GEO_CLEAN_CONFIRM" \ + btm_box "1) $UPG_GEO_CLEAN_CONFIRM" \ "0) $COMMON_BACK" read -r -p "$COMMON_INPUT> " res case "$res" in @@ -841,8 +841,8 @@ setgeo() { break ;; 1) - for file in cn_ip.txt cn_ipv6.txt Country.mmdb GeoSite.dat geoip.db geosite.db; do - rm -rf $CRASHDIR/$file + for file in cn_ip.txt cn_ipv6.txt *.mmdb *.metadb *.dat geoip.db geosite.db; do + rm -rf "$CRASHDIR"/$file done for var in Country_v cn_mini_v china_ip_list_v china_ipv6_list_v geosite_v geoip_cn_v geosite_cn_v mrs_geosite_cn_v srs_geoip_cn_v srs_geosite_cn_v mrs_v srs_v; do setconfig $var diff --git a/scripts/menus/check_port.sh b/scripts/menus/check_port.sh index 5d5f1acd..ada49d58 100644 --- a/scripts/menus/check_port.sh +++ b/scripts/menus/check_port.sh @@ -1,13 +1,18 @@ #!/bin/sh # Copyright (C) Juewuy +. "$CRASHDIR"/libs/check_cmd.sh + load_lang check_port _get_netstat_cmd() { + local cmd=netstat + ckcmd ss && cmd=ss + case "$1" in - tcp) echo "netstat -ntl" ;; - udp) echo "netstat -nul" ;; - *) echo "netstat -ntul" ;; + tcp) echo "$cmd -ntl" ;; + udp) echo "$cmd -nul" ;; + *) echo "$cmd -ntul" ;; esac } diff --git a/scripts/menus/dns.sh b/scripts/menus/dns.sh index b960d2f3..72b0491a 100644 --- a/scripts/menus/dns.sh +++ b/scripts/menus/dns.sh @@ -95,7 +95,7 @@ set_dns_mod() { ;; *) if [ "$num" -ge 1 ] && [ "$num" -lt 65535 ]; then - if ckcmd netstat && netstat -ntul | grep -q ":$num "; then + if netstat -ntul 2>/dev/null | grep -q ":$num " || ss -ntul 2>/dev/null | grep -q ":$num "; then dns_redir_port="$num" setconfig dns_redir_port "$dns_redir_port" common_success diff --git a/scripts/menus/task_cmd.sh b/scripts/menus/task_cmd.sh index 0b1982e2..4aee5f21 100644 --- a/scripts/menus/task_cmd.sh +++ b/scripts/menus/task_cmd.sh @@ -135,7 +135,7 @@ hotupdate() { #热更新订阅 . "$CRASHDIR"/starts/core_config.sh && get_core_config && . "$CRASHDIR"/starts/check_core.sh && check_core && . "$CRASHDIR"/starts/"$target"_modify.sh && modify_"$format" && rm -rf "$TMPDIR"/CrashCore && - . "$CRASHDIR"/libs/web_restore.sh && put_save "http://127.0.0.1:$db_port/configs" "{\"path\":\"$CRASHDIR/config.$format\"}" + . "$CRASHDIR"/libs/web_restore.sh && put_save "http://127.0.0.1:$db_port/configs" "{\"path\":\"$TMPDIR/config.$format\"}" exit $? } diff --git a/scripts/menus/userguide.sh b/scripts/menus/userguide.sh index 4595633e..c470d7a8 100644 --- a/scripts/menus/userguide.sh +++ b/scripts/menus/userguide.sh @@ -77,7 +77,7 @@ forwhat() { content_line "\033[33m$UG_IP_FORWARD_WARN\033[0m" read -r -p "$COMMON_INPUT_R" res [ "$res" = 1 ] && { - content_line 'net.ipv4.ip_forward = 1' >>/etc/sysctl.conf + echo 'net.ipv4.ip_forward = 1' >>/etc/sysctl.conf sysctl -w net.ipv4.ip_forward=1 } fi diff --git a/scripts/starts/fw_start.sh b/scripts/starts/fw_start.sh index 955692d7..6a6927ab 100644 --- a/scripts/starts/fw_start.sh +++ b/scripts/starts/fw_start.sh @@ -38,7 +38,11 @@ } #判断代理用途 [ "$firewall_area" = 2 -o "$firewall_area" = 3 ] && local_proxy=true -[ "$firewall_area" = 1 -o "$firewall_area" = 3 -o "$firewall_area" = 5 ] && lan_proxy=true +[ "$firewall_area" = 1 -o "$firewall_area" = 3 -o "$firewall_area" = 5 ] && { + lan_proxy=true + #检查IP转发 + [ "$(cat /proc/sys/net/ipv4/ip_forward)" = "0" ] && echo 'net.ipv4.ip_forward = 1' >>/etc/sysctl.conf && sysctl -w net.ipv4.ip_forward=1 +} #防火墙配置 [ "$firewall_mod" = 'iptables' ] && . "$CRASHDIR"/starts/fw_iptables.sh && start_iptables [ "$firewall_mod" = 'nftables' ] && . "$CRASHDIR"/starts/fw_nftables.sh && start_nftables diff --git a/scripts/starts/singbox_modify.sh b/scripts/starts/singbox_modify.sh index 7e68080b..179ce929 100644 --- a/scripts/starts/singbox_modify.sh +++ b/scripts/starts/singbox_modify.sh @@ -169,7 +169,7 @@ gen_dns() { #防泄露设置 [ "$dns_protect" = "OFF" ] && sed -i 's/"server": "dns_proxy"/"server": "dns_direct"/g' "$TMPDIR"/jsons/route.json #生成add_rule_set.json - [ "$dns_mod" = "mix" ] || [ "$dns_mod" = "route" ] && ! grep -Eq '"tag" *:[[:space:]]*"cn"' "$CRASHDIR"/jsons/*.json && { + [ "$dns_mod" = "mix" ] || [ "$dns_mod" = "route" ] && ! grep -Eq '"tag" *:[[:space:]]*"cn"' "$CRASHDIR"/jsons/*.json && ! grep -Eq '"tag"[[:space:]]*:[[:space:]]*\[[^]]*"cn"' "$CRASHDIR"/jsons/*.json && { [ "$crashcore" = "singboxr" ] && srs_path='"path": "./ruleset/cn.srs",' cat >"$TMPDIR"/jsons/add_rule_set.json <