v1.6.15c
~修复脚本内置更新时无法正确更新版本号的bug ~修复dnsmasq转发无法正常禁用的bug ~梅林固件增加对nat-start文件的自启授权,解决脚本无法自启的问题 ~修复华硕固件因不支持command命令而导致的一系列问题
This commit is contained in:
@@ -3,6 +3,9 @@
|
||||
|
||||
|
||||
#读取配置相关
|
||||
ckcmd(){
|
||||
command -v sh &>/dev/null && command -v $1 &>/dev/null || type $1 &>/dev/null
|
||||
}
|
||||
getconfig(){
|
||||
|
||||
#服务器缺省地址
|
||||
@@ -427,8 +430,8 @@ setdns(){
|
||||
echo -e " 3 \033[33m重置\033[0mDNS配置"
|
||||
echo -e " 4 一键配置\033[32m加密DNS\033[0m"
|
||||
echo -e " 5 hosts优化: \033[36m$hosts_opt\033[0m ————调用本机hosts并劫持NTP服务"
|
||||
echo -e " 6 Dnsmasq转发: \033[36m$dns_redir\033[0m ————不明勿动"
|
||||
echo -e " 7 禁用内置DNS: \033[36m$dns_no\033[0m ————不明勿动"
|
||||
echo -e " 6 Dnsmasq转发: \033[36m$dns_redir\033[0m ————不推荐使用"
|
||||
echo -e " 7 禁用DNS劫持: \033[36m$dns_no\033[0m ————取消劫持局域网53端口"
|
||||
echo -e " 0 返回上级菜单"
|
||||
echo -----------------------------------------------
|
||||
read -p "请输入对应数字 > " num
|
||||
@@ -504,7 +507,11 @@ setdns(){
|
||||
echo -e "\033[32m已启用Dnsmasq转发DNS功能!!!\033[0m"
|
||||
sleep 1
|
||||
else
|
||||
echo -e "\033[33m禁用成功!!\033[0m"
|
||||
uci del dhcp.@dnsmasq[-1].server
|
||||
uci set dhcp.@dnsmasq[0].noresolv=0
|
||||
uci commit dhcp
|
||||
/etc/init.d/dnsmasq restart
|
||||
echo -e "\033[33m禁用成功!!如有报错请重启设备!\033[0m"
|
||||
dns_redir=未开启
|
||||
fi
|
||||
sleep 1
|
||||
@@ -516,10 +523,10 @@ setdns(){
|
||||
if [ "$dns_no" = "未禁用" ]; then
|
||||
echo -e "\033[31m仅限搭配其他DNS服务(比如dnsmasq、smartDNS)时使用!\033[0m"
|
||||
dns_no=已禁用
|
||||
echo -e "\033[32m已禁用内置DNS!!!\033[0m"
|
||||
echo -e "\033[32m已禁用DNS劫持!!!\033[0m"
|
||||
else
|
||||
dns_no=未禁用
|
||||
echo -e "\033[33m已启用内置DNS!!!\033[0m"
|
||||
echo -e "\033[33m已启用DNS劫持!!!\033[0m"
|
||||
fi
|
||||
sleep 1
|
||||
setconfig dns_no $dns_no
|
||||
@@ -742,7 +749,7 @@ localproxy(){
|
||||
echo -e " 1 \033[36m$proxy_set本机代理\033[0m"
|
||||
echo -e " 2 使用\033[32m环境变量\033[0m方式配置(部分应用可能无法使用)"
|
||||
[ -n "$(lsmod | grep ^xt_owner)" ] && echo -e " 3 使用\033[32miptables增强模式\033[0m配置(支持docker)"
|
||||
command -v nft &> /dev/null && echo -e " 4 使用\033[32mnftables增强模式\033[0m配置(支持docker)"
|
||||
ckcmd nft && echo -e " 4 使用\033[32mnftables增强模式\033[0m配置(支持docker)"
|
||||
echo -e " 0 返回上级菜单"
|
||||
echo -----------------------------------------------
|
||||
read -p "请输入对应数字 > " num
|
||||
@@ -829,13 +836,13 @@ setboot(){
|
||||
1)
|
||||
if [ "$autostart" = "enable" ]; then
|
||||
[ -d /etc/rc.d ] && cd /etc/rc.d && rm -rf *clash > /dev/null 2>&1 && cd - >/dev/null
|
||||
command -v systemctl >/dev/null 2>&1 && systemctl disable clash.service > /dev/null 2>&1
|
||||
ckcmd systemctl && systemctl disable clash.service > /dev/null 2>&1
|
||||
touch $clashdir/.dis_startup
|
||||
autostart=disable
|
||||
echo -e "\033[33m已禁止Clash开机启动!\033[0m"
|
||||
elif [ "$autostart" = "disable" ]; then
|
||||
[ -f /etc/rc.common ] && /etc/init.d/clash enable
|
||||
command -v systemctl >/dev/null 2>&1 && systemctl enable clash.service > /dev/null 2>&1
|
||||
ckcmd systemctl && systemctl enable clash.service > /dev/null 2>&1
|
||||
rm -rf $clashdir/.dis_startup
|
||||
autostart=enable
|
||||
echo -e "\033[32m已设置Clash开机启动!\033[0m"
|
||||
@@ -959,7 +966,7 @@ clashcfg(){
|
||||
}
|
||||
[ -n "$(iptables -j TPROXY 2>&1 | grep 'on-port')" ] && sup_tp=1
|
||||
#[ -n "$(lsmod | grep '^tun')" ] || ip tuntap &>/dev/null && sup_tun=1
|
||||
command -v nft &> /dev/null && sup_nft=1
|
||||
ckcmd nft && sup_nft=1
|
||||
#[ -n "$(lsmod | grep 'nft_tproxy')" ] && sup_nft=2
|
||||
echo -----------------------------------------------
|
||||
echo -e "当前代理模式为:\033[47;30m $redir_mod \033[0m;Clash核心为:\033[47;30m $clashcore \033[0m"
|
||||
@@ -1006,7 +1013,7 @@ clashcfg(){
|
||||
set_redir_config
|
||||
|
||||
elif [ "$num" = 6 ]; then
|
||||
if command -v opkg >/dev/null && [ -z "$(opkg list-installed | grep firewall4)" ];then
|
||||
if ckcmd opkg && [ -z "$(opkg list-installed | grep firewall4)" ];then
|
||||
read -p "检测到缺少firewall4依赖,是否自动安装?(1/0)" res
|
||||
[ "$res" = '1' ] && opkg install firewall4 && redir_mod=Nft基础
|
||||
else
|
||||
@@ -1015,7 +1022,7 @@ clashcfg(){
|
||||
set_redir_config
|
||||
|
||||
elif [ "$num" = 7 ]; then
|
||||
if command -v opkg >/dev/null && [ -z "$(opkg list-installed | grep kmod-nft-tproxy)" ];then
|
||||
if ckcmd opkg && [ -z "$(opkg list-installed | grep kmod-nft-tproxy)" ];then
|
||||
read -p "检测到缺少kmod-nft-tproxy依赖,是否自动安装?(1/0)" res
|
||||
[ "$res" = '1' ] && opkg install kmod-nft-tproxy && redir_mod=Nft混合
|
||||
else
|
||||
@@ -1467,9 +1474,9 @@ tools(){
|
||||
elif [ "$num" = 3 ]; then
|
||||
if [ "$ssh_ol" = "开启" ];then
|
||||
iptables -t nat -A PREROUTING -p tcp -m multiport --dports $ssh_port -j REDIRECT --to-ports 22
|
||||
[ -n "$(command -v ip6tables)" ] && ip6tables -t nat -A PREROUTING -p tcp -m multiport --dports $ssh_port -j REDIRECT --to-ports 22
|
||||
[ -n "$(ckcmd ip6tables)" ] && ip6tables -t nat -A PREROUTING -p tcp -m multiport --dports $ssh_port -j REDIRECT --to-ports 22
|
||||
echo "iptables -t nat -A PREROUTING -p tcp -m multiport --dports $ssh_port -j REDIRECT --to-ports 22 #启用外网访问SSH服务" >> /etc/firewall.user
|
||||
[ -n "$(command -v ip6tables)" ] && echo "ip6tables -t nat -A PREROUTING -p tcp -m multiport --dports $ssh_port -j REDIRECT --to-ports 22 #启用外网访问SSH服务" >> /etc/firewall.user
|
||||
[ -n "$(ckcmd ip6tables)" ] && echo "ip6tables -t nat -A PREROUTING -p tcp -m multiport --dports $ssh_port -j REDIRECT --to-ports 22 #启用外网访问SSH服务" >> /etc/firewall.user
|
||||
echo -----------------------------------------------
|
||||
echo -e "已开启外网访问SSH功能!"
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user