mirror of
https://github.com/juewuy/ShellCrash.git
synced 2024-11-16 03:32:34 +08:00
~修复部分情况下向systemd输出大量无用日志的bug
~修复首次使用6-2时倒入失败的bug ~尝试修复部分设备因ipv6导致的dns劫持失败的问题
This commit is contained in:
parent
7a6b7a7e5a
commit
00f10b81f9
|
@ -15,7 +15,7 @@ source ${CRASHDIR}/configs/command.env 2>/dev/null
|
||||||
setconfig(){
|
setconfig(){
|
||||||
#参数1代表变量名,参数2代表变量值,参数3即文件路径
|
#参数1代表变量名,参数2代表变量值,参数3即文件路径
|
||||||
[ -z "$3" ] && configpath=${CFG_PATH} || configpath="${3}"
|
[ -z "$3" ] && configpath=${CFG_PATH} || configpath="${3}"
|
||||||
[ -n "$(grep "${1}=" "$configpath")" ] && sed -i "s#${1}=.*#${1}=${2}#g" $configpath || echo "${1}=${2}" >> $configpath
|
grep -q "${1}=" "$configpath" && sed -i "s#${1}=.*#${1}=${2}#g" $configpath || sed -i "\$a\\${1}=${2}" $configpath
|
||||||
}
|
}
|
||||||
ckcmd(){
|
ckcmd(){
|
||||||
command -v sh >/dev/null 2>&1 && command -v $1 >/dev/null 2>&1 || type $1 >/dev/null 2>&1
|
command -v sh >/dev/null 2>&1 && command -v $1 >/dev/null 2>&1 || type $1 >/dev/null 2>&1
|
||||||
|
|
|
@ -6,8 +6,8 @@ After=network.target
|
||||||
Type=simple
|
Type=simple
|
||||||
User=shellcrash
|
User=shellcrash
|
||||||
ExecStartPre=/etc/ShellCrash/start.sh bfstart
|
ExecStartPre=/etc/ShellCrash/start.sh bfstart
|
||||||
ExecStart=/etc/ShellCrash/CrashCore run -D /etc/ShellCrash -C /tmp/ShellCrash/jsons
|
ExecStart=/etc/ShellCrash/CrashCore run -D /etc/ShellCrash -C /tmp/ShellCrash/jsons >/dev/null
|
||||||
ExecStartPost=/etc/ShellCrash/start.sh afstart >/dev/null &
|
ExecStartPost=/etc/ShellCrash/start.sh afstart
|
||||||
ExecStopPost=/etc/ShellCrash/start.sh stop_firewall ; /etc/ShellCrash/start.sh unset_proxy
|
ExecStopPost=/etc/ShellCrash/start.sh stop_firewall ; /etc/ShellCrash/start.sh unset_proxy
|
||||||
Restart=on-abnormal
|
Restart=on-abnormal
|
||||||
RestartSec=10s
|
RestartSec=10s
|
||||||
|
|
|
@ -46,7 +46,7 @@ getconfig() { #读取配置及全局变量
|
||||||
setconfig() { #脚本配置工具
|
setconfig() { #脚本配置工具
|
||||||
#参数1代表变量名,参数2代表变量值,参数3即文件路径
|
#参数1代表变量名,参数2代表变量值,参数3即文件路径
|
||||||
[ -z "$3" ] && configpath="$CRASHDIR"/configs/ShellCrash.cfg || configpath="${3}"
|
[ -z "$3" ] && configpath="$CRASHDIR"/configs/ShellCrash.cfg || configpath="${3}"
|
||||||
grep -q "${1}=" "$configpath" && sed -i "s#${1}=.*#${1}=${2}#g" "$configpath" || echo "${1}=${2}" >> "$configpath"
|
grep -q "${1}=" "$configpath" && sed -i "s#${1}=.*#${1}=${2}#g" "$configpath" || sed -i "\$a\\${1}=${2}" $configpath
|
||||||
}
|
}
|
||||||
ckcmd() { #检查命令是否存在
|
ckcmd() { #检查命令是否存在
|
||||||
command -v sh >/dev/null 2>&1 && command -v "$1" >/dev/null 2>&1 || type "$1" >/dev/null 2>&1
|
command -v sh >/dev/null 2>&1 && command -v "$1" >/dev/null 2>&1 || type "$1" >/dev/null 2>&1
|
||||||
|
@ -968,6 +968,10 @@ start_ipt_dns() { #iptables-dns通用工具
|
||||||
$1 -t nat -A $3 -p udp -s $ip -j REDIRECT --to-ports $dns_port
|
$1 -t nat -A $3 -p udp -s $ip -j REDIRECT --to-ports $dns_port
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
[ "$1" = 'ip6tables' ] && {
|
||||||
|
$1 -t nat -A $3 -p tcp -m comment --comment "ShellCrash-IPV6_DNS-REJECT" -j REJECT
|
||||||
|
$1 -t nat -A $3 -p udp -m comment --comment "ShellCrash-IPV6_DNS-REJECT" -j REJECT
|
||||||
|
}
|
||||||
$1 -t nat -I $2 -p tcp --dport 53 -j $3
|
$1 -t nat -I $2 -p tcp --dport 53 -j $3
|
||||||
$1 -t nat -I $2 -p udp --dport 53 -j $3
|
$1 -t nat -I $2 -p udp --dport 53 -j $3
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user