diff --git a/ShellCrash.tar.gz b/ShellCrash.tar.gz index 9ea82aae..52db4e3b 100644 Binary files a/ShellCrash.tar.gz and b/ShellCrash.tar.gz differ diff --git a/bin/version b/bin/version index 7e52d536..549cac4b 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.4rc1 +versionsh=1.9.4rc3 GeoIP_v=20251205 diff --git a/scripts/init.sh b/scripts/init.sh index d5535529..800c4fcf 100644 --- a/scripts/init.sh +++ b/scripts/init.sh @@ -130,7 +130,7 @@ if [ "$systype" = "mi_snapshot" -o "$systype" = "ng_snapshot" ]; then chmod 755 "$CRASHDIR"/starts/snapshot_init.sh if [ "$systype" = "mi_snapshot" ];then path="/data/shellcrash_init.sh" - setconfig CRASHDIR "$CRASHDIR" "$CRASHDIR"/starts/snapshot_init.sh + sed -i "s#^CRASHDIR=.*#CRASHDIR=$CRASHDIR#" "$CRASHDIR"/starts/snapshot_init.sh mv -f "$CRASHDIR"/starts/snapshot_init.sh "$path" [ ! -f /data/auto_start.sh ] && echo '#用于自定义需要开机启动的功能或者命令,会在开机后自动运行' > /data/auto_start.sh else diff --git a/scripts/libs/core_tools.sh b/scripts/libs/core_tools.sh index 98dfb1c1..39f54253 100644 --- a/scripts/libs/core_tools.sh +++ b/scripts/libs/core_tools.sh @@ -23,7 +23,9 @@ core_unzip() { #$1:需要解压的文件 $2:目标文件名 } core_find(){ if [ ! -f "$TMPDIR"/CrashCore ];then - core_dir=$(find "$BINDIR"/CrashCore.* $find_para 2>/dev/null) + [ -n "$(find "$CRASHDIR"/CrashCore.* $find_para 2>/dev/null)" ] && [ "$CRASHDIR" != "$BINDIR" ] && + mv -f "$CRASHDIR"/CrashCore.* "$BINDIR"/ + core_dir=$(find "$BINDIR"/CrashCore.* $find_para 2>/dev/null | head -n 1) [ -n "$core_dir" ] && core_unzip "$core_dir" CrashCore fi } @@ -49,7 +51,12 @@ core_check(){ else mv -f "$1" "$BINDIR/CrashCore.$zip_type" fi - mv -f "$TMPDIR/core_new" "$TMPDIR/CrashCore" + if [ "$zip_type" = 'upx' ];then + rm -f "$1" "$TMPDIR"/core_new + ln -sf "$TMPDIR/CrashCore.upx" "$TMPDIR/CrashCore" + else + mv -f "$TMPDIR/core_new" "$TMPDIR/CrashCore" + fi core_v="$v" setconfig COMMAND "$COMMAND" "$CRASHDIR"/configs/command.env && . "$CRASHDIR"/configs/command.env setconfig crashcore "$crashcore" @@ -73,7 +80,7 @@ core_webget(){ if [ "$?" = 0 ];then core_check "$TMPDIR/Coretmp.$zip_type" else - rm -rf "$TMPDIR/Coretmp.$zip_type" + rm -f "$TMPDIR/Coretmp.$zip_type" return 1 fi } diff --git a/scripts/libs/set_cron.sh b/scripts/libs/set_cron.sh index d93c776c..a38feb0a 100644 --- a/scripts/libs/set_cron.sh +++ b/scripts/libs/set_cron.sh @@ -3,15 +3,16 @@ crondir="$(crond -h 2>&1 | grep -oE 'Default:.*' | awk -F ":" '{print $2}')" [ ! -w "$crondir" ] && crondir="/etc/storage/cron/crontabs" [ ! -w "$crondir" ] && crondir="/var/spool/cron/crontabs" [ ! -w "$crondir" ] && crondir="/var/spool/cron" -tmpcron="$TMPDIR"/cron_tmp +tmpcron=/tmp/cron_tmp +touch "$tmpcron" croncmd() { #定时任务工具 - if [ -n "$(crontab -h 2>&1 | grep '\-l')" ]; then - crontab "$1" - elif [ -w "$crondir" ] && [ -n "$USER" ];then + if [ -w "$crondir" ] && [ -n "$USER" ];then [ "$1" = "-l" ] && cat "$crondir"/"$USER" 2>/dev/null [ -f "$1" ] && cat "$1" >"$crondir"/"$USER" killall -HUP crond 2>/dev/null + elif [ -n "$(crontab -h 2>&1 | grep '\-l')" ]; then + crontab "$1" else echo "找不到可用的crond或者crontab应用!No available crond or crontab application can be found!" fi @@ -20,7 +21,6 @@ cronset() { #定时任务设置 # 参数1代表要移除的关键字,参数2代表要添加的任务语句 croncmd -l >"$tmpcron" sed -i "/$1/d" "$tmpcron" - sed -i '/^$/d' "$tmpcron" echo "$2" >>"$tmpcron" croncmd "$tmpcron" rm -f "$tmpcron" diff --git a/scripts/libs/web_save.sh b/scripts/libs/web_save.sh index 23cecb35..e7a16f3f 100644 --- a/scripts/libs/web_save.sh +++ b/scripts/libs/web_save.sh @@ -26,7 +26,7 @@ web_save() { #最小化保存面板节点选择 . "$CRASHDIR"/libs/compare.sh && compare "$TMPDIR/$file" "$CRASHDIR/configs/$file" [ "$?" = 0 ] && rm -f "$TMPDIR/$file" || mv -f "$TMPDIR/$file" "$CRASHDIR/configs/$file" else - rm -f "$CRASHDIR/configs/$file" #空文件时移除旧文件 + > "$CRASHDIR/configs/$file" #空文件时移除旧文件 fi done } diff --git a/scripts/menus/2_settings.sh b/scripts/menus/2_settings.sh index 6a55f446..1eb28e1a 100644 --- a/scripts/menus/2_settings.sh +++ b/scripts/menus/2_settings.sh @@ -7,7 +7,10 @@ __IS_MODULE_2_SETTINGS_LOADED=1 settings() { #功能设置 #获取设置默认显示 [ -z "$skip_cert" ] && skip_cert=ON - [ -z "$sniffer" ] && sniffer=OFF + [ -z "$sniffer" ] && { + sniffer=OFF + echo "$crashcore" | grep -q 'singbox' && sniffer=ON + } [ -z "$dns_mod" ] && dns_mod='redir_host' # echo "-----------------------------------------------" @@ -633,7 +636,7 @@ fw_filter_lan() { #局域网设备过滤 fi ###### echo -e "\033[30;47m请在此添加或移除设备\033[0m" - echo -e "当前过滤方式为:\033[33m$fw_filter_lan_type模式\033[0m" + echo -e "当前过滤方式为:\033[33m$macfilter_type模式\033[0m" echo -e "仅列表内设备流量\033[36m$fw_filter_lan_scrip经过\033[0m内核" if [ -n "$(cat "$CRASHDIR"/configs/mac)" ]; then echo "-----------------------------------------------" diff --git a/scripts/menus/bot_tg.sh b/scripts/menus/bot_tg.sh index 3dd6bece..9f3c554e 100644 --- a/scripts/menus/bot_tg.sh +++ b/scripts/menus/bot_tg.sh @@ -2,6 +2,7 @@ [ -z "$CRASHDIR" ] && CRASHDIR=$( cd $(dirname $0);cd ..;pwd) . "$CRASHDIR"/libs/web_json.sh +. "$CRASHDIR"/libs/set_config.sh . "$CRASHDIR"/libs/web_get_lite.sh . "$CRASHDIR"/menus/running_status.sh . "$CRASHDIR"/configs/gateway.cfg @@ -308,6 +309,9 @@ polling(){ /crash) send_menu ;; + /"$my_alias") + send_menu + ;; /help) send_help ;; diff --git a/scripts/menus/bot_tg_service.sh b/scripts/menus/bot_tg_service.sh index 67a2ee10..62ede38b 100644 --- a/scripts/menus/bot_tg_service.sh +++ b/scripts/menus/bot_tg_service.sh @@ -9,7 +9,7 @@ bot_tg_start(){ } bot_tg_stop(){ cronset 'TG_BOT守护进程' - [ -f "$TMPDIR/bot_tg.pid" ] && kill -TERM "$(cat "$TMPDIR/bot_tg.pid")" + [ -f "$TMPDIR/bot_tg.pid" ] && kill -TERM "$(cat "$TMPDIR/bot_tg.pid")" 2>/dev/null killall bot_tg.sh 2>/dev/null rm -f "$TMPDIR/bot_tg.pid" } diff --git a/scripts/start.sh b/scripts/start.sh index e9ee6403..190ba3f1 100644 --- a/scripts/start.sh +++ b/scripts/start.sh @@ -47,8 +47,8 @@ start) /etc/init.d/shellcrash start elif [ "$USER" = "root" ] && grep -q 'systemd' /proc/1/comm; then FragmentPath=$(systemctl show -p FragmentPath shellcrash | sed 's/FragmentPath=//') - [ -f $FragmentPath ] && { - setconfig ExecStart "$COMMAND >/dev/null" "$FragmentPath" + [ -f "$FragmentPath" ] && { + sed -i "s#^ExecStart=.*#ExecStart=$COMMAND >/dev/null#" "$FragmentPath" systemctl daemon-reload } systemctl start shellcrash.service || . "$CRASHDIR"/starts/start_error.sh @@ -71,9 +71,11 @@ stop) cronset '保守模式守护进程' cronset '运行时每' cronset '流媒体预解析' + #停止tg_bot + . "$CRASHDIR"/menus/bot_tg_service.sh && bot_tg_stop #多种方式结束进程 if [ -f "$TMPDIR/shellcrash.pid" ];then - kill -TERM "$(cat "$TMPDIR/shellcrash.pid")" + kill -TERM "$(cat "$TMPDIR/shellcrash.pid")" 2>/dev/null rm -f "$TMPDIR/shellcrash.pid" stop_firewall elif [ "$USER" = "root" ] && grep -q 'systemd' /proc/1/comm; then diff --git a/scripts/starts/afstart.sh b/scripts/starts/afstart.sh index 675c0f3b..504289e6 100644 --- a/scripts/starts/afstart.sh +++ b/scripts/starts/afstart.sh @@ -55,5 +55,4 @@ if [ -n "$test" -o -n "$(pidof CrashCore)" ]; then exit 0 else . "$CRASHDIR"/starts/start_error.sh - "$CRASHDIR"/start.sh stop fi diff --git a/scripts/starts/singbox_modify.sh b/scripts/starts/singbox_modify.sh index e1c02052..0ee8eeec 100644 --- a/scripts/starts/singbox_modify.sh +++ b/scripts/starts/singbox_modify.sh @@ -200,7 +200,7 @@ EOF EOF #生成add_route.json #域名嗅探配置 - [ "$sniffer" = ON ] && sniffer_set='{ "action": "sniff", "timeout": "500ms" },' + [ "$sniffer" != OFF ] && sniffer_set='{ "action": "sniff", "timeout": "500ms" },' [ "$ts_service" = ON ] && tailscale_set='{ "inbound": [ "ts-ep" ], "port": 53, "action": "hijack-dns" },' cat >"$TMPDIR"/jsons/add_route.json <