mirror of
https://github.com/juewuy/ShellCrash.git
synced 2026-03-11 07:51:45 +00:00
Binary file not shown.
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -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 "-----------------------------------------------"
|
||||
|
||||
@@ -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
|
||||
;;
|
||||
|
||||
@@ -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"
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 <<EOF
|
||||
{
|
||||
|
||||
@@ -2,6 +2,10 @@
|
||||
# Copyright (C) Juewuy
|
||||
|
||||
CRASHDIR="$(uci get firewall.ShellCrash.path | sed 's/\/starts.*//')"
|
||||
#防止提前自启
|
||||
/etc/init.d/shellcrash disable
|
||||
crontab -l | grep -v 'start_legacy_wd.sh shellcrash' | crontab -
|
||||
#防止usb未加载
|
||||
i=0
|
||||
while [ ! -f "$CRASHDIR/configs/ShellCrash.cfg" ]; do
|
||||
[ $i -gt 20 ] && exit 1
|
||||
@@ -57,10 +61,15 @@ auto_clean(){
|
||||
}
|
||||
auto_start(){
|
||||
#设置init.d服务
|
||||
cp -f "$CRASHDIR"/starts/shellcrash.procd /etc/init.d/shellcrash
|
||||
chmod 755 /etc/init.d/shellcrash
|
||||
[ ! -x /etc/init.d/shellcrash ] && {
|
||||
cp -f "$CRASHDIR"/starts/shellcrash.procd /etc/init.d/shellcrash
|
||||
chmod 755 /etc/init.d/shellcrash
|
||||
}
|
||||
#初始化环境变量
|
||||
. "$CRASHDIR"/libs/set_profile.sh && set_profile '/etc/profile'
|
||||
grep -q '^export CRASHDIR=' '/etc/profile' || {
|
||||
. "$CRASHDIR"/libs/set_profile.sh
|
||||
set_profile '/etc/profile'
|
||||
}
|
||||
#启动服务
|
||||
if [ ! -f "$CRASHDIR"/.dis_startup ]; then
|
||||
#AX6S/AX6000修复tun功能
|
||||
@@ -70,13 +79,9 @@ auto_start(){
|
||||
#自动覆盖根证书文件
|
||||
[ -s "$CRASHDIR"/tools/ca-certificates.crt ] && cp -f "$CRASHDIR"/tools/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
|
||||
#启动服务
|
||||
"$CRASHDIR"/start.sh start
|
||||
/etc/init.d/shellcrash enable
|
||||
"$CRASHDIR"/start.sh stop
|
||||
/etc/init.d/shellcrash start && /etc/init.d/shellcrash enable
|
||||
fi
|
||||
#启动自定义服务
|
||||
[ -s /data/auto_start.sh ] && /bin/sh /data/auto_start.sh &
|
||||
#兼容auto_ssh脚本
|
||||
[ -s /data/auto_ssh/auto_ssh.sh ] && /bin/sh /data/auto_ssh/auto_ssh.sh &
|
||||
}
|
||||
init(){
|
||||
#等待启动完成
|
||||
@@ -85,7 +90,11 @@ init(){
|
||||
done
|
||||
autoSSH #软固化功能
|
||||
auto_clean #自动清理
|
||||
[ -s "$CRASHDIR"/start.sh ] && [ ! -x /etc/init.d/shellcrash ] && auto_start
|
||||
auto_start
|
||||
#启动自定义服务
|
||||
[ -s /data/auto_start.sh ] && /bin/sh /data/auto_start.sh &
|
||||
#兼容auto_ssh脚本
|
||||
[ -s /data/auto_ssh/auto_ssh.sh ] && /bin/sh /data/auto_ssh/auto_ssh.sh &
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
|
||||
@@ -11,3 +11,4 @@ touch "$CRASHDIR"/.start_error #标记启动失败,防止自启
|
||||
error=$(cat "$TMPDIR"/core_test.log | grep -iEo 'error.*=.*|.*ERROR.*|.*FATAL.*')
|
||||
logger "服务启动失败!请查看报错信息!详细信息请查看$TMPDIR/core_test.log" 33
|
||||
logger "$error" 31
|
||||
"$CRASHDIR"/start.sh stop
|
||||
|
||||
Reference in New Issue
Block a user