mirror of
https://github.com/juewuy/ShellCrash.git
synced 2024-11-16 03:32:34 +08:00
格式化代码
This commit is contained in:
parent
b2a457908d
commit
59d36e8c65
15
install.sh
15
install.sh
|
@ -126,7 +126,8 @@ if [ -n "$systype" ];then
|
|||
set_cust_dir
|
||||
;;
|
||||
*)
|
||||
exit 1 ;;
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
}
|
||||
[ "$systype" = "asusrouter" ] && {
|
||||
|
@ -154,7 +155,8 @@ if [ -n "$systype" ];then
|
|||
set_asus_dir
|
||||
;;
|
||||
*)
|
||||
exit 1 ;;
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
}
|
||||
[ "$systype" = "ng_snapshot" ] && dir=/tmp/mnt
|
||||
|
@ -170,7 +172,7 @@ else
|
|||
#设置目录
|
||||
if [ -z $num ]; then
|
||||
echo 安装已取消
|
||||
exit 1;
|
||||
exit 1
|
||||
elif [ "$num" = "1" ]; then
|
||||
dir=/etc
|
||||
elif [ "$num" = "2" ]; then
|
||||
|
@ -184,7 +186,7 @@ else
|
|||
set_cust_dir
|
||||
else
|
||||
echo 安装已取消!!!
|
||||
exit 1;
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
|
@ -224,8 +226,7 @@ setversion(){
|
|||
3)
|
||||
url=$(echo $url | sed 's/master/dev/')
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
*) ;;
|
||||
esac
|
||||
}
|
||||
#特殊固件识别及标记
|
||||
|
@ -284,7 +285,7 @@ if [ -n "$CRASHDIR" ];then
|
|||
install
|
||||
else
|
||||
$echo "\033[31m输入错误!已取消安装!\033[0m"
|
||||
exit 1;
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
setdir
|
||||
|
|
|
@ -60,7 +60,8 @@ if [ -n "$systype" ];then
|
|||
set_cust_dir
|
||||
;;
|
||||
*)
|
||||
exit 1 ;;
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
}
|
||||
[ "$systype" = "asusrouter" ] && {
|
||||
|
@ -106,7 +107,7 @@ else
|
|||
#设置目录
|
||||
if [ -z $num ]; then
|
||||
echo 安装已取消
|
||||
exit 1;
|
||||
exit 1
|
||||
elif [ "$num" = "1" ]; then
|
||||
dir=/etc
|
||||
elif [ "$num" = "2" ]; then
|
||||
|
@ -128,7 +129,7 @@ else
|
|||
fi
|
||||
else
|
||||
echo 安装已取消!!!
|
||||
exit 1;
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
|
@ -298,7 +299,7 @@ fi
|
|||
nvram commit
|
||||
}
|
||||
#华硕下载大师启动额外设置
|
||||
[ -f "$dir/asusware.arm/etc/init.d/S50downloadmaster" ] && [ -z "$(grep 'ShellCrash' $dir/asusware.arm/etc/init.d/S50downloadmaster)" ] && \
|
||||
[ -f "$dir/asusware.arm/etc/init.d/S50downloadmaster" ] && [ -z "$(grep 'ShellCrash' $dir/asusware.arm/etc/init.d/S50downloadmaster)" ] &&
|
||||
sed -i "/^PATH=/a\\$CRASHDIR/start.sh init & #ShellCrash初始化脚本" "$dir/asusware.arm/etc/init.d/S50downloadmaster"
|
||||
#删除临时文件
|
||||
rm -rf /tmp/*rash*gz
|
||||
|
|
|
@ -1,7 +1,10 @@
|
|||
#!/bin/sh
|
||||
# Copyright (C) Juewuy
|
||||
|
||||
CRASHDIR=$(cd $(dirname $0);pwd)
|
||||
CRASHDIR=$(
|
||||
cd $(dirname $0)
|
||||
pwd
|
||||
)
|
||||
CFG_PATH=${CRASHDIR}/configs/ShellCrash.cfg
|
||||
YAMLSDIR=${CRASHDIR}/yamls
|
||||
JSONSDIR=${CRASHDIR}/jsons
|
||||
|
@ -43,7 +46,7 @@ ckstatus(){
|
|||
#检查mac地址记录
|
||||
[ ! -f ${CRASHDIR}/configs/mac ] && touch ${CRASHDIR}/configs/mac
|
||||
#获取本机host地址
|
||||
[ -z "$host" ] && host=$(ubus call network.interface.lan status 2>&1 | grep \"address\" | grep -oE '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}';)
|
||||
[ -z "$host" ] && host=$(ubus call network.interface.lan status 2>&1 | grep \"address\" | grep -oE '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}')
|
||||
[ -z "$host" ] && host=$(ip a 2>&1 | grep -w 'inet' | grep 'global' | grep 'lan' | grep -E ' 1(92|0|72)\.' | sed 's/.*inet.//g' | sed 's/\/[0-9][0-9].*$//g' | head -n 1)
|
||||
[ -z "$host" ] && host=$(ip a 2>&1 | grep -w 'inet' | grep 'global' | grep -E ' 1(92|0|72)\.' | sed 's/.*inet.//g' | sed 's/\/[0-9][0-9].*$//g' | head -n 1)
|
||||
[ -z "$host" ] && host='设备IP地址'
|
||||
|
@ -75,15 +78,15 @@ ckstatus(){
|
|||
PID=$(pidof CrashCore | awk '{print $NF}')
|
||||
if [ -n "$PID" ]; then
|
||||
run="\033[32m正在运行($redir_mod)\033[0m"
|
||||
VmRSS=`cat /proc/$PID/status|grep -w VmRSS|awk 'unit="MB" {printf "%.2f %s\n", $2/1000, unit}'`
|
||||
VmRSS=$(cat /proc/$PID/status | grep -w VmRSS | awk 'unit="MB" {printf "%.2f %s\n", $2/1000, unit}')
|
||||
#获取运行时长
|
||||
touch ${TMPDIR}/crash_start_time #用于延迟启动的校验
|
||||
start_time=$(cat ${TMPDIR}/crash_start_time)
|
||||
if [ -n "$start_time" ]; then
|
||||
time=$((`date +%s`-start_time))
|
||||
time=$(($(date +%s) - start_time))
|
||||
day=$((time / 86400))
|
||||
[ "$day" = "0" ] && day='' || day="$day天"
|
||||
time=`date -u -d @${time} +%H小时%M分%S秒`
|
||||
time=$(date -u -d @${time} +%H小时%M分%S秒)
|
||||
fi
|
||||
elif [ "$firewall_area" = 5 ] && [ -n "$(ip route list table 100)" ]; then
|
||||
run="\033[32m已设置($redir_mod)\033[0m"
|
||||
|
@ -112,7 +115,7 @@ ckstatus(){
|
|||
#检查执行权限
|
||||
[ ! -x ${CRASHDIR}/start.sh ] && chmod +x ${CRASHDIR}/start.sh
|
||||
#检查/tmp内核文件
|
||||
for file in `ls -F /tmp | grep -v [/\$] | grep -v ' ' | grep -Ev ".*(gz|zip|7z|tar)$" | grep -iE 'CrashCore|^clash$|^clash-linux.*|^mihomo.*|^sing.*box|^clash.meta.*'` ; do
|
||||
for file in $(ls -F /tmp | grep -v [/$] | grep -v ' ' | grep -Ev ".*(gz|zip|7z|tar)$" | grep -iE 'CrashCore|^clash$|^clash-linux.*|^mihomo.*|^sing.*box|^clash.meta.*'); do
|
||||
file=/tmp/$file
|
||||
chmod +x $file
|
||||
echo -e "发现可用的内核文件: \033[36m$file\033[0m "
|
||||
|
@ -122,12 +125,12 @@ ckstatus(){
|
|||
core_v=$($file -v 2>/dev/null | head -n 1 | sed 's/ linux.*//;s/.* //')
|
||||
[ -z "$core_v" ] && core_v=$($file version 2>/dev/null | grep -Eo 'version .*' | sed 's/version //')
|
||||
if [ -n "$core_v" ]; then
|
||||
source ${CRASHDIR}/webget.sh && setcoretype && \
|
||||
mv -f $file ${TMPDIR}/CrashCore && \
|
||||
tar -zcf ${BINDIR}/CrashCore.tar.gz ${tar_para} -C ${TMPDIR} CrashCore && \
|
||||
echo -e "\033[32m内核加载完成!\033[0m " && \
|
||||
setconfig crashcore $crashcore && \
|
||||
setconfig core_v $core_v && \
|
||||
source ${CRASHDIR}/webget.sh && setcoretype &&
|
||||
mv -f $file ${TMPDIR}/CrashCore &&
|
||||
tar -zcf ${BINDIR}/CrashCore.tar.gz ${tar_para} -C ${TMPDIR} CrashCore &&
|
||||
echo -e "\033[32m内核加载完成!\033[0m " &&
|
||||
setconfig crashcore $crashcore &&
|
||||
setconfig core_v $core_v &&
|
||||
switch_core
|
||||
sleep 1
|
||||
else
|
||||
|
@ -140,7 +143,7 @@ ckstatus(){
|
|||
echo -----------------------------------------------
|
||||
done
|
||||
#检查/tmp配置文件
|
||||
for file in `ls -F /tmp | grep -v [/\$] | grep -v ' ' | grep -iE '.yaml$|.yml$|config.json$'` ; do
|
||||
for file in $(ls -F /tmp | grep -v [/$] | grep -v ' ' | grep -iE '.yaml$|.yml$|config.json$'); do
|
||||
file=/tmp/$file
|
||||
echo -e "发现内核配置文件: \033[36m$file\033[0m "
|
||||
read -p "是否加载为$crashcore的配置文件?(1/0) > " res
|
||||
|
@ -681,8 +684,7 @@ setipv6(){ #ipv6设置
|
|||
echo -----------------------------------------------
|
||||
read -p "请输入对应数字 > " num
|
||||
case $num in
|
||||
0)
|
||||
;;
|
||||
0) ;;
|
||||
1)
|
||||
if [ "$ipv6_redir" = "未开启" ]; then
|
||||
ipv6_support=已开启
|
||||
|
@ -748,8 +750,7 @@ setfirewall(){ #防火墙设置
|
|||
setconfig cust_host_ipv4
|
||||
set_cust_host_ipv4
|
||||
;;
|
||||
0)
|
||||
;;
|
||||
0) ;;
|
||||
*)
|
||||
if [ -n "$(echo $text | grep -Eo '^([0-9]{1,3}\.){3}[0-9]{1,3}/[0-9]{1,2}'$)" -a -z "$(echo $cust_host_ipv4 | grep "$text")" ]; then
|
||||
cust_host_ipv4="$cust_host_ipv4 $text"
|
||||
|
@ -809,7 +810,8 @@ setfirewall(){ #防火墙设置
|
|||
echo -e "当前网段:\033[36m$reserve_ipv4\033[0m"
|
||||
echo -e "\033[33m地址必须是空格分隔,错误的设置可能导致网络回环或启动报错,请务必谨慎!\033[0m"
|
||||
read -p "请输入 > " text
|
||||
if [ -n "$(echo $text |grep -E "(((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])/(3[0-2]|[1-2]?[0-9]))( +|$)+"
|
||||
if [ -n "$(
|
||||
echo $text | grep -E "(((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])/(3[0-2]|[1-2]?[0-9]))( +|$)+"
|
||||
)" ]; then
|
||||
reserve_ipv4="$text"
|
||||
echo -e "已将保留地址网段设为:\033[32m$reserve_ipv4\033[0m"
|
||||
|
@ -999,8 +1001,7 @@ macfilter(){ #局域网设备过滤
|
|||
echo -e " 0 返回上级菜单"
|
||||
read -p "请输入对应数字 > " num
|
||||
case "$num" in
|
||||
0)
|
||||
;;
|
||||
0) ;;
|
||||
1)
|
||||
macfilter_type=$macfilter_over
|
||||
setconfig macfilter_type $macfilter_type
|
||||
|
@ -1050,8 +1051,7 @@ setboot(){ #启动相关设置
|
|||
read -p "请输入对应数字 > " num
|
||||
echo -----------------------------------------------
|
||||
case "$num" in
|
||||
0)
|
||||
;;
|
||||
0) ;;
|
||||
1)
|
||||
if [ "$autostart" = "enable" ]; then
|
||||
[ -d /etc/rc.d ] && cd /etc/rc.d && rm -rf *shellcrash >/dev/null 2>&1 && cd - >/dev/null
|
||||
|
@ -1144,7 +1144,8 @@ setboot(){ #启动相关设置
|
|||
read -p "请输入相应数字 > " num
|
||||
case "$num" in
|
||||
1)
|
||||
BINDIR="$TMPDIR" ;;
|
||||
BINDIR="$TMPDIR"
|
||||
;;
|
||||
2)
|
||||
set_usb_dir() {
|
||||
echo "请选择安装目录"
|
||||
|
@ -1197,8 +1198,7 @@ set_firewall_area(){ #防火墙模式设置
|
|||
echo -----------------------------------------------
|
||||
read -p "请输入对应数字 > " num
|
||||
case $num in
|
||||
0)
|
||||
;;
|
||||
0) ;;
|
||||
[1-4])
|
||||
[ $firewall_area -ge 4 ] && {
|
||||
redir_mod=Redir模式
|
||||
|
@ -1260,8 +1260,7 @@ set_firewall_area(){ #防火墙模式设置
|
|||
vm_redir=未开启
|
||||
unset vm_ipv4
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
*) ;;
|
||||
esac
|
||||
setconfig vm_redir $vm_redir
|
||||
setconfig vm_ipv4 "\'$vm_ipv4\'"
|
||||
|
@ -1363,7 +1362,8 @@ set_redir_mod(){ #代理模式设置
|
|||
set_redir_mod
|
||||
;;
|
||||
6)
|
||||
redir_mod=T&U旁路转发
|
||||
redir_mod=T &
|
||||
U旁路转发
|
||||
set_redir_config
|
||||
set_redir_mod
|
||||
;;
|
||||
|
@ -1518,9 +1518,9 @@ normal_set(){ #基础设置
|
|||
echo -e " 5 过滤局域网设备: \033[36m$mac_return\033[0m ————使用黑/白名单进行过滤"
|
||||
echo -e " 7 屏蔽QUIC流量: \033[36m$quic_rj\033[0m ————优化视频性能"
|
||||
[ "$disoverride" != "1" ] && {
|
||||
[ "$dns_mod" != "fake-ip" ] && \
|
||||
[ "$dns_mod" != "fake-ip" ] &&
|
||||
echo -e " 8 CN_IP绕过内核: \033[36m$cn_ip_route\033[0m ————优化性能,不兼容Fake-ip"
|
||||
[ "$dns_mod" != "redir_host" ] && \
|
||||
[ "$dns_mod" != "redir_host" ] &&
|
||||
echo -e " 9 管理Fake-ip过滤列表"
|
||||
}
|
||||
echo -----------------------------------------------
|
||||
|
@ -1658,8 +1658,7 @@ advanced_set(){ #进阶设置
|
|||
echo -----------------------------------------------
|
||||
read -p "请输入对应数字 > " num
|
||||
case "$num" in
|
||||
0)
|
||||
;;
|
||||
0) ;;
|
||||
3)
|
||||
setfirewall
|
||||
advanced_set
|
||||
|
@ -1934,12 +1933,12 @@ tools(){
|
|||
|
||||
elif [ -x /usr/sbin/otapredownload ] && [ "$num" = 5 ]; then
|
||||
if [ "$mi_update" = "禁用" ]; then
|
||||
grep -q "otapredownload" /etc/crontabs/root && \
|
||||
sed -i "/^[^\#]*otapredownload/ s/^/#/" /etc/crontabs/root || \
|
||||
grep -q "otapredownload" /etc/crontabs/root &&
|
||||
sed -i "/^[^\#]*otapredownload/ s/^/#/" /etc/crontabs/root ||
|
||||
echo "#15 3,4,5 * * * /usr/sbin/otapredownload >/dev/null 2>&1" >>/etc/crontabs/root
|
||||
else
|
||||
grep -q "otapredownload" /etc/crontabs/root && \
|
||||
sed -i "/^\s*#.*otapredownload/ s/^\s*#//" /etc/crontabs/root || \
|
||||
grep -q "otapredownload" /etc/crontabs/root &&
|
||||
sed -i "/^\s*#.*otapredownload/ s/^\s*#//" /etc/crontabs/root ||
|
||||
echo "15 3,4,5 * * * /usr/sbin/otapredownload >/dev/null 2>&1" >>/etc/crontabs/root
|
||||
fi
|
||||
echo -----------------------------------------------
|
||||
|
@ -1971,8 +1970,8 @@ tools(){
|
|||
echo 正在连接服务器获取Tun模块补丁文件…………
|
||||
${CRASHDIR}/start.sh get_bin ${TMPDIR}/tun.ko bin/fix/tun.ko
|
||||
if [ "$?" = "0" ]; then
|
||||
mv -f ${TMPDIR}/tun.ko ${CRASHDIR}/tools/tun.ko && \
|
||||
${CRASHDIR}/misnap_init.sh tunfix && \
|
||||
mv -f ${TMPDIR}/tun.ko ${CRASHDIR}/tools/tun.ko &&
|
||||
${CRASHDIR}/misnap_init.sh tunfix &&
|
||||
echo -e "\033[32m设置成功!请重启服务!\033[0m"
|
||||
else
|
||||
echo -e "\033[31m文件下载失败,请重试!\033[0m"
|
||||
|
@ -2006,14 +2005,14 @@ main_menu(){
|
|||
read -p "请输入对应数字 > " num
|
||||
if [ -z "$num" ]; then
|
||||
errornum
|
||||
exit;
|
||||
exit
|
||||
|
||||
elif [ "$num" = 0 ]; then
|
||||
exit;
|
||||
exit
|
||||
|
||||
elif [ "$num" = 1 ]; then
|
||||
start_service
|
||||
exit;
|
||||
exit
|
||||
|
||||
elif [ "$num" = 2 ]; then
|
||||
checkcfg=$(cat $CFG_PATH)
|
||||
|
@ -2067,13 +2066,16 @@ main_menu(){
|
|||
|
||||
else
|
||||
errornum
|
||||
exit;
|
||||
exit
|
||||
fi
|
||||
}
|
||||
|
||||
[ -z "$CRASHDIR" ] && {
|
||||
echo 环境变量配置有误!正在初始化~~~
|
||||
CRASHDIR=$(cd `dirname $0`; pwd)
|
||||
CRASHDIR=$(
|
||||
cd $(dirname $0)
|
||||
pwd
|
||||
)
|
||||
source ${CRASHDIR}/init.sh
|
||||
sleep 1
|
||||
echo 请重启SSH窗口以完成初始化!
|
||||
|
|
|
@ -2,7 +2,10 @@
|
|||
# Copyright (C) Juewuy
|
||||
|
||||
#初始化目录
|
||||
CRASHDIR=$(cd $(dirname $0);pwd)
|
||||
CRASHDIR=$(
|
||||
cd $(dirname $0)
|
||||
pwd
|
||||
)
|
||||
#加载执行目录,失败则初始化
|
||||
. "$CRASHDIR"/configs/command.env >/dev/null 2>&1
|
||||
[ -z "$BINDIR" -o -z "$TMPDIR" -o -z "$COMMAND" ] && . "$CRASHDIR"/init.sh >/dev/null 2>&1
|
||||
|
@ -928,11 +931,11 @@ start_ipt_route() { #iptables-route通用工具
|
|||
[ "$1" = ip6tables ] && [ "$dns_mod" != "fake-ip" ] && [ "$cn_ipv6_route" = "已开启" ] && [ -f "$BINDIR"/cn_ipv6.txt ] && $1 $w -t $2 -A $4 -m set --match-set cn_ip6 dst -j RETURN 2>/dev/null
|
||||
#局域网mac地址黑名单过滤
|
||||
[ "$3" = 'PREROUTING' ] && [ "$macfilter_type" != "白名单" ] && {
|
||||
[ -s "$CRASHDIR"/configs/mac ] && \
|
||||
[ -s "$CRASHDIR"/configs/mac ] &&
|
||||
for mac in $(cat "$CRASHDIR"/configs/mac); do
|
||||
$1 $w -t $2 -A $4 -m mac --mac-source $mac -j RETURN
|
||||
done
|
||||
[ -s "$CRASHDIR"/configs/ip_filter ] && [ "$1" = 'iptables' ] && \
|
||||
[ -s "$CRASHDIR"/configs/ip_filter ] && [ "$1" = 'iptables' ] &&
|
||||
for ip in $(cat "$CRASHDIR"/configs/ip_filter); do
|
||||
$1 $w -t $2 -A $4 -s $ip -j RETURN
|
||||
done
|
||||
|
@ -940,11 +943,11 @@ start_ipt_route() { #iptables-route通用工具
|
|||
#tcp&udp分别进代理链
|
||||
proxy_set() {
|
||||
if [ "$3" = 'PREROUTING' ] && [ "$4" != 'shellcrash_vm' ] && [ "$macfilter_type" = "白名单" ] && [ -n "$(cat $CRASHDIR/configs/mac $CRASHDIR/configs/ip_filter 2>/dev/null)" ]; then
|
||||
[ -s "$CRASHDIR"/configs/mac ] && \
|
||||
[ -s "$CRASHDIR"/configs/mac ] &&
|
||||
for mac in $(cat "$CRASHDIR"/configs/mac); do
|
||||
$1 $w -t $2 -A $4 -p $5 -m mac --mac-source $mac -j $JUMP
|
||||
done
|
||||
[ -s "$CRASHDIR"/configs/ip_filter ] && [ "$1" = 'iptables' ] && \
|
||||
[ -s "$CRASHDIR"/configs/ip_filter ] && [ "$1" = 'iptables' ] &&
|
||||
for ip in $(cat "$CRASHDIR"/configs/ip_filter); do
|
||||
$1 $w -t $2 -A $4 -p $5 -s $ip -j $JUMP
|
||||
done
|
||||
|
@ -985,22 +988,22 @@ start_ipt_dns() { #iptables-dns通用工具
|
|||
}
|
||||
#局域网mac地址黑名单过滤
|
||||
[ "$2" = 'PREROUTING' ] && [ "$macfilter_type" != "白名单" ] && {
|
||||
[ -s "$CRASHDIR"/configs/mac ] && \
|
||||
[ -s "$CRASHDIR"/configs/mac ] &&
|
||||
for mac in $(cat "$CRASHDIR"/configs/mac); do
|
||||
$1 $w -t nat -A $3 -m mac --mac-source $mac -j RETURN
|
||||
done
|
||||
[ -s "$CRASHDIR"/configs/ip_filter ] && [ "$1" = 'iptables' ] && \
|
||||
[ -s "$CRASHDIR"/configs/ip_filter ] && [ "$1" = 'iptables' ] &&
|
||||
for ip in $(cat "$CRASHDIR"/configs/ip_filter); do
|
||||
$1 $w -t nat -A $3 -s $ip -j RETURN
|
||||
done
|
||||
}
|
||||
if [ "$2" = 'PREROUTING' ] && [ "$3" != 'shellcrash_vm_dns' ] && [ "$macfilter_type" = "白名单" ] && [ -n "$(cat $CRASHDIR/configs/mac $CRASHDIR/configs/ip_filter 2>/dev/null)" ]; then
|
||||
[ -s "$CRASHDIR"/configs/mac ] && \
|
||||
[ -s "$CRASHDIR"/configs/mac ] &&
|
||||
for mac in $(cat "$CRASHDIR"/configs/mac); do
|
||||
$1 $w -t nat -A $3 -p tcp -m mac --mac-source $mac -j REDIRECT --to-ports $dns_port
|
||||
$1 $w -t nat -A $3 -p udp -m mac --mac-source $mac -j REDIRECT --to-ports $dns_port
|
||||
done
|
||||
[ -s "$CRASHDIR"/configs/ip_filter ] && [ "$1" = 'iptables' ] && \
|
||||
[ -s "$CRASHDIR"/configs/ip_filter ] && [ "$1" = 'iptables' ] &&
|
||||
for ip in $(cat "$CRASHDIR"/configs/ip_filter); do
|
||||
$1 $w -t nat -A $3 -p tcp -s $ip -j REDIRECT --to-ports $dns_port
|
||||
$1 $w -t nat -A $3 -p udp -s $ip -j REDIRECT --to-ports $dns_port
|
||||
|
@ -1717,7 +1720,7 @@ clash_check() { #clash启动前检查
|
|||
[ "$redir_mod" = "混合模式" ] ||
|
||||
[ "$redir_mod" = "Tun模式" ] && core_exchange meta '当前内核不支持的配置'
|
||||
fi
|
||||
[ "$crashcore" = "clash" ] && [ "$firewall_area" = 2 -o "$firewall_area" = 3 ] && [ -z "$(grep '0:7890' /etc/passwd)" ] && \
|
||||
[ "$crashcore" = "clash" ] && [ "$firewall_area" = 2 -o "$firewall_area" = 3 ] && [ -z "$(grep '0:7890' /etc/passwd)" ] &&
|
||||
core_exchange meta '当前内核不支持非root用户启用本机代理'
|
||||
core_check
|
||||
#预下载GeoIP数据库
|
||||
|
|
|
@ -7,7 +7,7 @@ tmp_dir=/tmp/ddns_$USER
|
|||
[ ! -f "$ddns_dir" -o ! -d "/etc/ddns" ] && echo -e "本脚本依赖OpenWrt内置的DDNS服务,当前设备无法运行,已退出!" && exit 1
|
||||
echo -----------------------------------------------
|
||||
echo -e "\033[30;46m欢迎使用ShellDDNS!\033[0m"
|
||||
echo -e "TG群:\033[36;4mhttps://t.me/clashfm\033[0m"
|
||||
echo -e "TG群:\033[36;4mhttps://t.me/ShellCrash\033[0m"
|
||||
|
||||
add_ddns() {
|
||||
cat >>$ddns_dir <<EOF
|
||||
|
@ -165,7 +165,5 @@ load_ddns(){
|
|||
fi
|
||||
}
|
||||
|
||||
|
||||
load_ddns
|
||||
rm -rf $tmp_dir
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user