mirror of
https://github.com/juewuy/ShellCrash.git
synced 2026-03-10 23:41:22 +00:00
Merge branch 'master' into dev
# Conflicts: # ShellCrash.tar.gz # bin/version # scripts/menus/2_settings.sh # scripts/starts/singbox_modify.sh # version
This commit is contained in:
@@ -23,7 +23,7 @@ core_unzip() { #$1:需要解压的文件 $2:目标文件名
|
|||||||
}
|
}
|
||||||
core_find(){
|
core_find(){
|
||||||
if [ ! -f "$TMPDIR"/CrashCore ];then
|
if [ ! -f "$TMPDIR"/CrashCore ];then
|
||||||
[ -n "$(find "$CRASHDIR"/CrashCore.* $find_para 2>/dev/null)" ] &&
|
[ -n "$(find "$CRASHDIR"/CrashCore.* $find_para 2>/dev/null)" ] && [ "$CRASHDIR" != "$BINDIR" ] &&
|
||||||
mv -f "$CRASHDIR"/CrashCore.* "$BINDIR"/
|
mv -f "$CRASHDIR"/CrashCore.* "$BINDIR"/
|
||||||
core_dir=$(find "$BINDIR"/CrashCore.* $find_para 2>/dev/null | head -n 1)
|
core_dir=$(find "$BINDIR"/CrashCore.* $find_para 2>/dev/null | head -n 1)
|
||||||
[ -n "$core_dir" ] && core_unzip "$core_dir" CrashCore
|
[ -n "$core_dir" ] && core_unzip "$core_dir" CrashCore
|
||||||
|
|||||||
@@ -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="/etc/storage/cron/crontabs"
|
||||||
[ ! -w "$crondir" ] && crondir="/var/spool/cron/crontabs"
|
[ ! -w "$crondir" ] && crondir="/var/spool/cron/crontabs"
|
||||||
[ ! -w "$crondir" ] && crondir="/var/spool/cron"
|
[ ! -w "$crondir" ] && crondir="/var/spool/cron"
|
||||||
tmpcron="$TMPDIR"/cron_tmp
|
tmpcron=/tmp/cron_tmp
|
||||||
|
touch "$tmpcron"
|
||||||
|
|
||||||
croncmd() { #定时任务工具
|
croncmd() { #定时任务工具
|
||||||
if [ -n "$(crontab -h 2>&1 | grep '\-l')" ]; then
|
if [ -w "$crondir" ] && [ -n "$USER" ];then
|
||||||
crontab "$1"
|
|
||||||
elif [ -w "$crondir" ] && [ -n "$USER" ];then
|
|
||||||
[ "$1" = "-l" ] && cat "$crondir"/"$USER" 2>/dev/null
|
[ "$1" = "-l" ] && cat "$crondir"/"$USER" 2>/dev/null
|
||||||
[ -f "$1" ] && cat "$1" >"$crondir"/"$USER"
|
[ -f "$1" ] && cat "$1" >"$crondir"/"$USER"
|
||||||
killall -HUP crond 2>/dev/null
|
killall -HUP crond 2>/dev/null
|
||||||
|
elif [ -n "$(crontab -h 2>&1 | grep '\-l')" ]; then
|
||||||
|
crontab "$1"
|
||||||
else
|
else
|
||||||
echo "找不到可用的crond或者crontab应用!No available crond or crontab application can be found!"
|
echo "找不到可用的crond或者crontab应用!No available crond or crontab application can be found!"
|
||||||
fi
|
fi
|
||||||
@@ -20,7 +21,6 @@ cronset() { #定时任务设置
|
|||||||
# 参数1代表要移除的关键字,参数2代表要添加的任务语句
|
# 参数1代表要移除的关键字,参数2代表要添加的任务语句
|
||||||
croncmd -l >"$tmpcron"
|
croncmd -l >"$tmpcron"
|
||||||
sed -i "/$1/d" "$tmpcron"
|
sed -i "/$1/d" "$tmpcron"
|
||||||
sed -i '/^$/d' "$tmpcron"
|
|
||||||
echo "$2" >>"$tmpcron"
|
echo "$2" >>"$tmpcron"
|
||||||
croncmd "$tmpcron"
|
croncmd "$tmpcron"
|
||||||
rm -f "$tmpcron"
|
rm -f "$tmpcron"
|
||||||
|
|||||||
@@ -11,7 +11,10 @@ settings() {
|
|||||||
while true; do
|
while true; do
|
||||||
# 获取设置默认显示
|
# 获取设置默认显示
|
||||||
[ -z "$skip_cert" ] && skip_cert=ON
|
[ -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'
|
[ -z "$dns_mod" ] && dns_mod='redir_host'
|
||||||
|
|
||||||
line_break
|
line_break
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
[ -z "$CRASHDIR" ] && CRASHDIR=$( cd $(dirname $0);cd ..;pwd)
|
[ -z "$CRASHDIR" ] && CRASHDIR=$( cd $(dirname $0);cd ..;pwd)
|
||||||
. "$CRASHDIR"/libs/web_json.sh
|
. "$CRASHDIR"/libs/web_json.sh
|
||||||
|
. "$CRASHDIR"/libs/set_config.sh
|
||||||
. "$CRASHDIR"/libs/web_get_lite.sh
|
. "$CRASHDIR"/libs/web_get_lite.sh
|
||||||
. "$CRASHDIR"/menus/running_status.sh
|
. "$CRASHDIR"/menus/running_status.sh
|
||||||
. "$CRASHDIR"/configs/gateway.cfg
|
. "$CRASHDIR"/configs/gateway.cfg
|
||||||
@@ -308,6 +309,9 @@ polling(){
|
|||||||
/crash)
|
/crash)
|
||||||
send_menu
|
send_menu
|
||||||
;;
|
;;
|
||||||
|
/"$my_alias")
|
||||||
|
send_menu
|
||||||
|
;;
|
||||||
/help)
|
/help)
|
||||||
send_help
|
send_help
|
||||||
;;
|
;;
|
||||||
|
|||||||
@@ -432,7 +432,7 @@ fw_filter_lan() {
|
|||||||
|
|
||||||
comp_box "\033[30;47m请在此添加或移除设备\033[0m" \
|
comp_box "\033[30;47m请在此添加或移除设备\033[0m" \
|
||||||
"" \
|
"" \
|
||||||
"当前过滤方式为:\033[33m$fw_filter_lan_type模式\033[0m" \
|
"当前过滤方式为:\033[33m$macfilter_type模式\033[0m" \
|
||||||
"仅列表内设备流量\033[36m$fw_filter_lan_scrip经过\033[0m内核"
|
"仅列表内设备流量\033[36m$fw_filter_lan_scrip经过\033[0m内核"
|
||||||
if [ -n "$(cat "$CRASHDIR"/configs/mac)" ]; then
|
if [ -n "$(cat "$CRASHDIR"/configs/mac)" ]; then
|
||||||
content_line "当前已过滤设备为:"
|
content_line "当前已过滤设备为:"
|
||||||
@@ -465,7 +465,7 @@ fw_filter_lan() {
|
|||||||
1)
|
1)
|
||||||
macfilter_type=$fw_filter_lan_over
|
macfilter_type=$fw_filter_lan_over
|
||||||
if setconfig macfilter_type $macfilter_type; then
|
if setconfig macfilter_type $macfilter_type; then
|
||||||
msg_alert "\033[32m已切换为$fw_filter_lan_type模式!\033[0m"
|
msg_alert "\033[32m已切换为$macfilter_type模式!\033[0m"
|
||||||
else
|
else
|
||||||
msg_alert "\033[31m$COMMON_FAILED\033[0m"
|
msg_alert "\033[31m$COMMON_FAILED\033[0m"
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -200,7 +200,7 @@ EOF
|
|||||||
EOF
|
EOF
|
||||||
#生成add_route.json
|
#生成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" },'
|
[ "$ts_service" = ON ] && tailscale_set='{ "inbound": [ "ts-ep" ], "port": 53, "action": "hijack-dns" },'
|
||||||
cat >"$TMPDIR"/jsons/add_route.json <<EOF
|
cat >"$TMPDIR"/jsons/add_route.json <<EOF
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user