Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified ShellCrash.tar.gz
Binary file not shown.
2 changes: 1 addition & 1 deletion bin/version
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
meta_v=v1.19.17
singboxr_v=1.13.0-alpha.27
versionsh=1.9.5alpha8.O2
versionsh=1.9.5alpha9
GeoIP_v=20251205
33 changes: 25 additions & 8 deletions docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,23 +87,19 @@ mkdir -p /root/ShellCrash
```shell
docker run -d \
………………
-v /root/ShellCrash:/etc/ShellCrash \
-v shellcrash_configs:/etc/ShellCrash/configs \
………………
```

------



------

## Compose Deployment(Compose部署)

### 1. 创建宿主机目录并进入目录

```shell
mkdir -p /root/ShellCrash
cd /root/ShellCrash
mkdir -p /tmp/ShellCrash
cd /tmp/ShellCrash
```

### 2. 下载Compose模版
Expand All @@ -126,8 +122,29 @@ docker compose up -d

------

### Notes
## Delete(移除容器镜像或删除卷)

### Docker删除容器

```shell
docker rm -f shellcrash
```

### Docker删除卷

```shell
docker volume rm shellcrash_configs
```

### Compose删除容器&卷

```shell
docker-compose down -v
```

## Notes

- 内置公网防火墙功能无法管理宿主机网络,请自行做好宿主机7890/9999端口的网络防护!
- 旁路由模式需要宿主机支持 `TUN`
- macvlan 网络下宿主机默认无法直接访问容器 IP
- 透明代理场景可能需要额外的网络规划
5 changes: 4 additions & 1 deletion docker/compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,12 @@ services:
sysctls:
net.ipv4.ip_forward: 1
volumes:
- /etc/ShellCrash:/root/ShellCrash
- shellcrash_configs:/etc/ShellCrash/configs:rw
restart: unless-stopped

volumes:
shellcrash_configs:

networks:
macvlan_lan:
name: macvlan_lan
Expand Down
6 changes: 3 additions & 3 deletions scripts/lang/chs/dns.lang
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
DNS_CURRENT_MODE="当前DNS运行模式为:"
DNS_RESTART_NOTICE="切换模式后需要手动重启服务以生效!"

DNS_MODE_MIX_DESC="CN域名real-ip,其它fake-ip分流"
DNS_MODE_ROUTE_DESC="CN域名real-ip,其它dns2proxy分流"
DNS_MODE_REDIR_DESC="不安全,需搭配第三方DNS服务使用"
DNS_MODE_MIX_DESC="CN域名DIRECT-DNS,其它fake-ip"
DNS_MODE_ROUTE_DESC="CN域名DIRECT-DNS,其它PROXY-DNS"
DNS_MODE_REDIR_DESC="建议搭配加密/第三方DNS服务使用"

DNS_MENU_PROTECT="DNS防泄漏"
DNS_MENU_HOSTS="Hosts优化"
Expand Down
6 changes: 3 additions & 3 deletions scripts/lang/en/dns.lang
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
DNS_CURRENT_MODE="Current DNS running mode:"
DNS_RESTART_NOTICE="Changes require a manual service restart to take effect."

DNS_MODE_MIX_DESC="CN domains use real-ip, others use fake-ip routing"
DNS_MODE_ROUTE_DESC="CN domains use real-ip, others use dns2proxy routing"
DNS_MODE_REDIR_DESC="Insecure. Must be used with a third-party DNS service."
DNS_MODE_MIX_DESC="CN domains use DIRECT-DNS, others use fake-ip"
DNS_MODE_ROUTE_DESC="CN domains use DIRECT-DNS, others use PROXY-DNS"
DNS_MODE_REDIR_DESC="All domains use DIRECT-DNS"

DNS_MENU_PROTECT="DNS Leak Protect"
DNS_MENU_HOSTS="Hosts Optimization"
Expand Down
1 change: 1 addition & 0 deletions scripts/libs/check_autostart.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ check_autostart(){
[ ! -f "$CRASHDIR"/.dis_startup ] && return 0
elif [ -f /etc/rc.common -a "$(cat /proc/1/comm)" = "procd" ]; then
[ -n "$(find /etc/rc.d -name '*shellcrash')" ] && return 0
[ ! -f "$CRASHDIR"/.dis_startup ] && return 0
elif ckcmd systemctl; then
[ "$(systemctl is-enabled shellcrash.service 2>&1)" = enabled ] && return 0
elif grep -q 's6' /proc/1/comm; then
Expand Down
2 changes: 1 addition & 1 deletion scripts/libs/get_config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ routing_mark=$((fwmark + 2))

[ -z "$dns_nameserver" ] && {
dns_nameserver='223.5.5.5, 1.2.4.8'
cat /proc/net/udp | grep -q '0035' && dns_nameserver='127.0.0.1'
nslookup localhost 127.0.0.1 >/dev/null 2>&1 && 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"
12 changes: 7 additions & 5 deletions scripts/libs/set_cron.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,19 @@ touch "$tmpcron"
cronadd() { #定时任务工具
if crontab -h 2>&1 | grep -q '\-l'; then
crontab "$1"
else
elif [ -f "$crondir/$USER" ];then
cat "$1" >"$crondir"/"$USER" && cru a REFRESH "0 0 1 1 * /bin/true" 2>/dev/null
else
echo "找不到可用的crond或者crontab应用!No available crond or crontab application can be found!"
fi
}
cronload() { #定时任务工具
if [ -f "$crondir/$USER" ];then
cat "$crondir"/"$USER" 2>/dev/null
elif crontab -h 2>&1 | grep -q '\-l'; then
if crontab -h 2>&1 | grep -q '\-l'; then
crontab -l
elif [ -f "$crondir/$USER" ];then
cat "$crondir"/"$USER" 2>/dev/null
else
echo "找不到可用的crond或者crontab应用!No available crond or crontab application can be found!"
return 1
fi
}
cronset() { #定时任务设置
Expand Down
1 change: 1 addition & 0 deletions scripts/menu.sh
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ ckstatus() {
userguide=1
. "$CRASHDIR"/menus/userguide.sh && userguide
setconfig userguide 1
. "$CRASHDIR"/configs/ShellCrash.cfg
fi

# 检查执行权限
Expand Down
14 changes: 13 additions & 1 deletion scripts/menus/4_setboot.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ setboot() {
content_line "4) 启用小闪存模式: \033[36m$(printf '%-4s' "$mini_clash")\033[0m ———用于闪存空间不足的设备"
[ "${BINDIR}" != "$CRASHDIR" ] && content_line "5) 设置小闪存目录: \033[36m${BINDIR}\033[0m"
btm_box "6) 自启网络检查: \033[36m$(printf '%-4s' "$network_check")\033[0m ———禁用则跳过自启时网络检查" \
"7) 查看启动日志" \
"" \
"0) 返回上级菜单"
read -r -p "请输入对应标号> " num
Expand Down Expand Up @@ -231,7 +232,18 @@ setboot() {
fi
fi
;;
*)
7)
if [ -s "$TMPDIR"/ShellCrash.log ]; then
line_break
echo "==========================================================="
grep -v '任务' "$TMPDIR"/ShellCrash.log
echo "==========================================================="
exit
else
msg_alert "\033[31m未找到相关日志!\033[0m"
fi
;;
*)
errornum
;;
esac
Expand Down
1 change: 1 addition & 0 deletions scripts/menus/8_tools.sh
Original file line number Diff line number Diff line change
Expand Up @@ -501,6 +501,7 @@ log_pusher() {
echo "==========================================================="
cat "$TMPDIR"/ShellCrash.log
echo "==========================================================="
exit
else
msg_alert "\033[31m未找到相关日志!\033[0m"
fi
Expand Down
2 changes: 1 addition & 1 deletion scripts/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ case "$1" in
start)
[ -n "$(pidof CrashCore)" ] && $0 stop #禁止多实例
stop_firewall #清理路由策略
rm -f "CRASHDIR"/.start_error #移除自启失败标记
rm -f "$CRASHDIR"/\.start_error #移除自启失败标记
#使用不同方式启动服务
if [ "$firewall_area" = "5" ]; then #主旁转发
. "$CRASHDIR"/starts/fw_start.sh
Expand Down
17 changes: 8 additions & 9 deletions scripts/starts/afstart.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ if [ -n "$test" -o -n "$(pidof CrashCore)" ]; then
[ "$start_old" = "ON" ] && [ ! -L "$TMPDIR"/CrashCore ] && rm -f "$TMPDIR"/CrashCore #删除缓存目录内核文件
. "$CRASHDIR"/starts/fw_start.sh #配置防火墙流量劫持
date +%s >"$TMPDIR"/crash_start_time #标记启动时间
#TG机器人守护进程
[ "$bot_tg_service" = ON ] && . "$CRASHDIR"/menus/bot_tg_service.sh && bot_tg_cron
#后台还原面板配置
[ -s "$CRASHDIR"/configs/web_save ] && {
. "$CRASHDIR"/libs/web_restore.sh
Expand All @@ -35,13 +33,14 @@ if [ -n "$test" -o -n "$(pidof CrashCore)" ]; then
} &
ckcmd mtd_storage.sh && mtd_storage.sh save >/dev/null 2>&1 #Padavan保存/etc/storage
#加载定时任务
[ -s "$CRASHDIR"/task/cron ] && cronadd "$CRASHDIR"/task/cron
[ -s "$CRASHDIR"/task/running ] && {
cronload | grep -v '^$' | grep -vF "运行时每" >/tmp/cron_tmp
cat "$CRASHDIR"/task/running >> /tmp/cron_tmp
cronadd /tmp/cron_tmp
}
[ "$start_old" = "ON" ] && cronset '保守模式守护进程' "* * * * * /bin/sh $CRASHDIR/starts/start_legacy_wd.sh shellcrash #ShellCrash保守模式守护进程"
cronload | grep -v '^$' > "$TMPDIR"/cron_tmp
[ -s "$CRASHDIR"/task/cron ] && cat "$CRASHDIR"/task/cron >> "$TMPDIR"/cron_tmp
[ -s "$CRASHDIR"/task/running ] && cat "$CRASHDIR"/task/running >> "$TMPDIR"/cron_tmp
[ "$bot_tg_service" = ON ] && echo "* * * * * /bin/sh $CRASHDIR/starts/start_legacy_wd.sh bot_tg #ShellCrash-TG_BOT守护进程" >> "$TMPDIR"/cron_tmp
[ "$start_old" = ON ] && echo "* * * * * /bin/sh $CRASHDIR/starts/start_legacy_wd.sh shellcrash #ShellCrash保守模式守护进程" >> "$TMPDIR"/cron_tmp
awk '!x[$0]++' "$TMPDIR"/cron_tmp > "$TMPDIR"/cron_tmp2 #删除重复行
cronadd "$TMPDIR"/cron_tmp2
rm -f "$TMPDIR"/cron_tmp "$TMPDIR"/cron_tmp2
#加载条件任务
[ -s "$CRASHDIR"/task/afstart ] && { . "$CRASHDIR"/task/afstart; } &
[ -s "$CRASHDIR"/task/affirewall -a -s /etc/init.d/firewall -a ! -f /etc/init.d/firewall.bak ] && {
Expand Down
2 changes: 1 addition & 1 deletion scripts/starts/bfstart.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
[ ! -f "$TMPDIR" ] && mkdir -p "$TMPDIR"

#当上次启动失败时终止自启动
[ -f "CRASHDIR"/.start_error ] && exit 1
[ -f "$CRASHDIR"/.start_error ] && exit 1
#加载工具
. "$CRASHDIR"/libs/check_cmd.sh
. "$CRASHDIR"/libs/check_target.sh
Expand Down
2 changes: 2 additions & 0 deletions scripts/starts/start_legacy_wd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
[ -z "$CRASHDIR" ] && CRASHDIR=$( cd $(dirname $0);cd ..;pwd)
PIDFILE="/tmp/ShellCrash/$1.pid"

[ -f "$CRASHDIR"/.start_error ] && [ ! -f /tmp/ShellCrash/crash_start_time ] && exit 1 #当启动失败后禁止开机自启动

if [ -f "$PIDFILE" ]; then
PID="$(cat "$PIDFILE")"
if [ -n "$PID" ] && [ -d "/proc/$PID" ]; then
Expand Down
2 changes: 1 addition & 1 deletion version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.9.5alpha8.O2
1.9.5alpha9
Loading