v1.0.0beta15
~新增对使用mips-softfloat核心设备的适配 ~新增手动指定核心架构的菜单 ~增加了按照关键字白名单筛选节点的功能 ~新增了帮助:-h,测试:-t脚本运行参数 ~优化节点保存方式,现在每10分钟检测一次,仅在检测到文件变动后方进行保存 ~修复部分ssr节点不可用的bug ~mac过滤功能增加移除单个设备以及添加全部设备功能 ~修复设置本机代理时直接跳出的bug ~优化安装脚本,增加root用户检测 ~优化ipv6dns拦截方式 ~回滚对循环计算的方式
This commit is contained in:
Binary file not shown.
@@ -1,4 +1,4 @@
|
||||
clash_v=1.2.0
|
||||
clashpre_v=2020.10.09
|
||||
GeoIP_v=20201010
|
||||
versionsh=1.0.0beta14fix4
|
||||
versionsh=1.0.0beta14fix5
|
||||
|
||||
@@ -15,9 +15,9 @@ echo "***********************************************"
|
||||
|
||||
#检查更新
|
||||
url="https://cdn.jsdelivr.net/gh/juewuy/ShellClash"
|
||||
if [ "$test" -eq 1 ];then
|
||||
if [ "$test" -gt 0 ];then
|
||||
url="--resolve raw.githubusercontent.com:443:199.232.68.133 https://raw.githubusercontent.com/juewuy/ShellClash/master"
|
||||
[ "$test" -eq 2 ] && url="http://192.168.31.30:8080/clash-for-Miwifi"
|
||||
[ "$test" -eq 2 ] && url="http://192.168.31.30:8080/clash-for-Miwifi" && echo $url
|
||||
[ "$test" -eq 3 ] && url="http://192.168.123.90:8080/clash-for-Miwifi"
|
||||
else
|
||||
release_new=$(curl -kfsSL --resolve api.github.com:443:140.82.113.5 "https://api.github.com/repos/juewuy/ShellClash/releases/latest" | grep "tag_name" | head -n 1 | awk -F ":" '{print $2}' | sed 's/\"//g;s/,//g;s/ //g') #检查版本
|
||||
@@ -25,7 +25,7 @@ fi
|
||||
[ -z "$release_new" ] && release_new=$(curl -kfsSL $url/bin/version | grep "versionsh" | awk -F "=" '{print $2}')
|
||||
[ -z "$release_new" ] && echo "无法连接服务器!" && exit
|
||||
tarurl=$url@$release_new/bin/clashfm.tar.gz
|
||||
[ "$test" -eq 1 ] && tarurl=$url/bin/clashfm.tar.gz
|
||||
[ "$test" -gt 0 ] && tarurl=$url/bin/clashfm.tar.gz
|
||||
gettar(){
|
||||
result=$(curl -w %{http_code} -kLo /tmp/clashfm.tar.gz $tarurl)
|
||||
[ "$result" != "200" ] && echo "文件下载失败!" && exit 1
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
# Copyright (C) Juewuy
|
||||
|
||||
echo='echo -e' && [ -n "$(ls -l /bin/sh|grep -o dash)" ] && echo=echo
|
||||
test=$1
|
||||
[ -z "$1" ] && test=0 || test=$1
|
||||
|
||||
echo "***********************************************"
|
||||
echo "** 欢迎使用 **"
|
||||
@@ -15,17 +15,17 @@ echo "***********************************************"
|
||||
|
||||
#检查更新
|
||||
url="https://cdn.jsdelivr.net/gh/juewuy/ShellClash"
|
||||
if [ $test -eq 1 ];then
|
||||
if [ "$test" -gt 0 ];then
|
||||
url="--resolve raw.githubusercontent.com:443:199.232.68.133 https://raw.githubusercontent.com/juewuy/ShellClash/master"
|
||||
[ $test -eq 2 ] && url="http://192.168.31.30:8080/clash-for-Miwifi"
|
||||
[ $test -eq 3 ] && url="http://192.168.123.90:8080/clash-for-Miwifi"
|
||||
[ "$test" -eq 2 ] && url="http://192.168.31.30:8080/clash-for-Miwifi" && echo $url
|
||||
[ "$test" -eq 3 ] && url="http://192.168.123.90:8080/clash-for-Miwifi"
|
||||
else
|
||||
release_new=$(curl -kfsSL --resolve api.github.com:443:140.82.113.5 "https://api.github.com/repos/juewuy/ShellClash/releases/latest" | grep "tag_name" | head -n 1 | awk -F ":" '{print $2}' | sed 's/\"//g;s/,//g;s/ //g') #检查版本
|
||||
fi
|
||||
[ -z "$release_new" ] && release_new=$(curl -kfsSL $url/bin/version | grep "versionsh" | awk -F "=" '{print $2}')
|
||||
[ -z "$release_new" ] && echo "无法连接服务器!" && exit
|
||||
tarurl=$url@$release_new/bin/clashfm.tar.gz
|
||||
[ $test -ge 1 ] && tarurl=$url/bin/clashfm.tar.gz
|
||||
[ "$test" -gt 0 ] && tarurl=$url/bin/clashfm.tar.gz
|
||||
gettar(){
|
||||
result=$(curl -w %{http_code} -kLo /tmp/clashfm.tar.gz $tarurl)
|
||||
[ "$result" != "200" ] && echo "文件下载失败!" && exit 1
|
||||
|
||||
@@ -193,7 +193,7 @@ setport(){
|
||||
}
|
||||
checkport(){
|
||||
for portx in $dns_port $mix_port $redir_port $db_port ;do
|
||||
if [ -n "$(netstat -ntul |grep :$portx)" ];then
|
||||
if [ -n "$(netstat -ntul 2>&1 |grep :$portx)" ];then
|
||||
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
echo -e "检测到端口【$portx】被以下进程占用!clash可能无法正常启动!\033[33m"
|
||||
echo $(netstat -ntulp | grep :$portx | head -n 1)
|
||||
@@ -239,15 +239,17 @@ if [ -z "$server_link" ]; then
|
||||
server_link=1
|
||||
fi
|
||||
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
echo -e "\033[30;47m 欢迎使用订阅功能!\033[0m"
|
||||
echo -e "\033[30;47m 欢迎使用导入配置文件功能!\033[0m"
|
||||
echo -----------------------------------------------
|
||||
echo -e " 1 在线导入\033[36m订阅\033[0m配置文件"
|
||||
echo -e " 2 在线导入clash配置文件"
|
||||
echo -e " 3 添加/修改\033[32m节点过滤\033[0m关键字 \033[47;30m$exclude\033[0m"
|
||||
echo -e " 4 选取\033[33mclash配置规则\033[0m模版"
|
||||
echo -e " 5 选择在线生成服务器"
|
||||
echo -e " 6 \033[36m还原\033[0m配置文件"
|
||||
echo -e " 7 \033[32m手动更新\033[0m订阅"
|
||||
echo -e " 1 在线导入\033[36m订阅\033[0m并生成Clash配置文件"
|
||||
echo -e " 2 在线导入\033[33mClash\033[0m配置文件"
|
||||
echo -e " 3 设置\033[31m节点过滤\033[0m关键字 \033[47;30m$exclude\033[0m"
|
||||
echo -e " 4 设置\033[32m节点筛选\033[0m关键字 \033[47;30m$include\033[0m"
|
||||
echo -e " 5 选取\033[33mClash配置规则\033[0m在线模版"
|
||||
echo -e " 6 选择在线生成服务器-subconverter"
|
||||
echo -e " 7 \033[36m还原\033[0m之前的配置文件"
|
||||
echo -e " 8 \033[33m手动更新\033[0m配置文件"
|
||||
echo -e " 9 设置\033[36m自动更新\033[0m配置文件"
|
||||
echo -----------------------------------------------
|
||||
echo -e " 0 返回上级菜单"
|
||||
read -p "请输入对应数字 > " num
|
||||
@@ -294,15 +296,20 @@ elif [[ $num == 3 ]];then
|
||||
|
||||
elif [[ $num == 4 ]];then
|
||||
source $clashdir/getdate.sh
|
||||
linkconfig
|
||||
linkfilter2
|
||||
clashlink
|
||||
|
||||
elif [[ $num == 5 ]];then
|
||||
source $clashdir/getdate.sh
|
||||
linkserver
|
||||
linkconfig
|
||||
clashlink
|
||||
|
||||
elif [[ $num == 6 ]];then
|
||||
source $clashdir/getdate.sh
|
||||
linkserver
|
||||
clashlink
|
||||
|
||||
elif [[ $num == 7 ]];then
|
||||
yamlbak=$yaml.bak
|
||||
if [ ! -f "$yaml".bak ];then
|
||||
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
@@ -322,7 +329,7 @@ elif [[ $num == 6 ]];then
|
||||
fi
|
||||
clashsh
|
||||
|
||||
elif [[ $num == 7 ]];then
|
||||
elif [[ $num == 8 ]];then
|
||||
if [ -z "$Url" -a -z "$Https" ];then
|
||||
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
echo -e "\033[31m没有找到你的订阅链接!请先输入链接!\033[0m"
|
||||
@@ -341,6 +348,10 @@ elif [[ $num == 7 ]];then
|
||||
fi
|
||||
clashlink
|
||||
fi
|
||||
|
||||
elif [[ $num == 9 ]];then
|
||||
clashcron
|
||||
|
||||
elif [[ $num == 0 ]];then
|
||||
clashsh
|
||||
else
|
||||
@@ -1155,4 +1166,24 @@ else
|
||||
fi
|
||||
exit 1
|
||||
}
|
||||
clashsh
|
||||
|
||||
[ -z "$1" ] && clashsh
|
||||
|
||||
case "$1" in
|
||||
-h)
|
||||
echo -----------------------------------------
|
||||
echo "欢迎使用ShellClash"
|
||||
echo -----------------------------------------
|
||||
echo " -t 测试模式"
|
||||
echo " -h 帮助列表"
|
||||
echo -----------------------------------------
|
||||
echo "在线求助:t.me/clashfm"
|
||||
echo "官方博客:juewuy.github.io"
|
||||
echo "发布页面:github.com/juewuy/ShellClash"
|
||||
echo -----------------------------------------
|
||||
;;
|
||||
-t)
|
||||
shtype=sh && [ -n "$(ls -l /bin/sh|grep -o dash)" ] && shtype=bash
|
||||
$shtype -x $clashdir/clash.sh
|
||||
;;
|
||||
esac
|
||||
|
||||
@@ -68,7 +68,7 @@ echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
echo -e "\033[44m 实验性功能,遇问题请加TG群反馈:\033[42;30m t.me/clashfm \033[0m"
|
||||
echo -e "\033[33m当前过滤关键字:\033[47;30m$exclude\033[0m"
|
||||
echo -----------------------------------------------
|
||||
echo -e "\033[36m匹配关键字的节点会在导入时被屏蔽\033[0m"
|
||||
echo -e "\033[33m匹配关键字的节点会在导入时被【屏蔽】!!!\033[0m"
|
||||
echo -e "多个关键字可以用\033[30;47m | \033[0m号分隔"
|
||||
echo -e "\033[32m支持正则表达式\033[0m,空格请使用\033[30;47m + \033[0m号替代"
|
||||
echo -----------------------------------------------
|
||||
@@ -87,6 +87,31 @@ sed -i '/exclude=*/'d $ccfg
|
||||
sed -i "1i\exclude=\'$exclude\'" $ccfg
|
||||
linkset
|
||||
}
|
||||
linkfilter2(){
|
||||
[ -z "$include" ] && include="未设置"
|
||||
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
echo -e "\033[44m 实验性功能,遇问题请加TG群反馈:\033[42;30m t.me/clashfm \033[0m"
|
||||
echo -e "\033[33m当前筛选关键字:\033[47;30m$include\033[0m"
|
||||
echo -----------------------------------------------
|
||||
echo -e "\033[33m仅有匹配关键字的节点才会被【导入】!!!\033[0m"
|
||||
echo -e "多个关键字可以用\033[30;47m | \033[0m号分隔"
|
||||
echo -e "\033[32m支持正则表达式\033[0m,空格请使用\033[30;47m + \033[0m号替代"
|
||||
echo -----------------------------------------------
|
||||
echo -e " 000 \033[31m删除\033[0m关键字"
|
||||
echo -e " 回车 取消输入并返回上级菜单"
|
||||
echo -----------------------------------------------
|
||||
read -p "请输入关键字 > " include
|
||||
if [ -z "$include" ]; then
|
||||
linkset
|
||||
elif [ "$include" = '000' ]; then
|
||||
echo -----------------------------------------------
|
||||
include=''
|
||||
echo -e "\033[31m 已删除节点匹配关键字!!!\033[0m"
|
||||
fi
|
||||
sed -i '/include=*/'d $ccfg
|
||||
sed -i "1i\include=\'$include\'" $ccfg
|
||||
linkset
|
||||
}
|
||||
linkset(){
|
||||
if [ -n "$Url" ];then
|
||||
[ -z "$skip_cert" ] && skip_cert=已开启
|
||||
@@ -94,11 +119,12 @@ if [ -n "$Url" ];then
|
||||
echo -e "\033[47;30m请检查输入的链接是否正确:\033[0m"
|
||||
echo -e "\033[32;4m$Url\033[0m"
|
||||
echo -----------------------------------------------
|
||||
echo -e " 1 \033[32m生成配置文件(原文件将被备份)\033[0m"
|
||||
echo -e " 2 \033[36m添加/修改节点过滤关键字 \033[47;30m$exclude\033[0m"
|
||||
echo -e " 3 \033[33m选取配置规则模版\033[0m"
|
||||
echo -e " 4 \033[0m选取在线生成服务器\033[0m"
|
||||
echo -e " 5 \033[0m跳过本地证书验证: \033[36m$skip_cert\033[0m ————自建tls节点务必开启"
|
||||
echo -e " 1 \033[36m生成配置文件\033[0m(原文件将被备份)"
|
||||
echo -e " 2 设置\033[31m节点过滤\033[0m关键字 \033[47;30m$exclude\033[0m"
|
||||
echo -e " 3 设置\033[32m节点筛选\033[0m关键字 \033[47;30m$include\033[0m"
|
||||
echo -e " 4 选取在线\033[33m配置规则模版\033[0m"
|
||||
echo -e " 5 \033[0m选取在线生成服务器\033[0m"
|
||||
echo -e " 6 \033[0m跳过本地证书验证: \033[36m$skip_cert\033[0m ————自建tls节点务必开启"
|
||||
echo -----------------------------------------------
|
||||
echo -e " 0 \033[31m取消导入\033[0m并返回上级菜单"
|
||||
echo -----------------------------------------------
|
||||
@@ -121,12 +147,15 @@ if [ -n "$Url" ];then
|
||||
linkfilter
|
||||
linkset
|
||||
elif [ "$num" = '3' ]; then
|
||||
linkconfig
|
||||
linkfilter2
|
||||
linkset
|
||||
elif [ "$num" = '4' ]; then
|
||||
linkserver
|
||||
linkconfig
|
||||
linkset
|
||||
elif [ "$num" = '5' ]; then
|
||||
linkserver
|
||||
linkset
|
||||
elif [ "$num" = '6' ]; then
|
||||
sed -i '/skip_cert*/'d $ccfg
|
||||
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
if [ "$skip_cert" = "未开启" ] > /dev/null 2>&1; then
|
||||
@@ -295,39 +324,45 @@ if [ "$res" = '1' ]; then
|
||||
fi
|
||||
}
|
||||
getcore(){
|
||||
#source $ccfg
|
||||
#获取核心及版本信息
|
||||
if [ ! -f $clashdir/clash ]; then
|
||||
clashcore=没有安装核心!
|
||||
clashv=''
|
||||
fi
|
||||
clashcore_n=$clashcore
|
||||
[ ! -f $clashdir/clash ] && clashcore="未安装核心"
|
||||
#获取设备处理器架构
|
||||
cputype=$(uname -ms | tr ' ' '_' | tr '[A-Z]' '[a-z]')
|
||||
[ -n "$(echo $cputype | grep -E "linux.*armv.*")" ] && cpucore="armv5"
|
||||
[ -n "$(echo $cputype | grep -E "linux.*armv7.*")" ] && [ -n "$(cat /proc/cpuinfo | grep vfp)" ] && cpucore="armv7"
|
||||
[ -n "$(echo $cputype | grep -E "linux.*aarch64.*|linux.*armv8.*")" ] && cpucore="armv8"
|
||||
[ -n "$(echo $cputype | grep -E "linux.*x86.*")" ] && cpucore="386"
|
||||
[ -n "$(echo $cputype | grep -E "linux.*x86_64.*")" ] && cpucore="amd64"
|
||||
if [ -n "$(echo $cputype | grep -E "linux.*mips.*")" ];then
|
||||
cpucore="mipsle-softfloat"
|
||||
[ -n "$(uname -a | grep -E "M2100")" ] && cpucore="mipsle-hardfloat"
|
||||
fi
|
||||
getcputype(){
|
||||
cputype=$(uname -ms | tr ' ' '_' | tr '[A-Z]' '[a-z]')
|
||||
[ -n "$(echo $cputype | grep -E "linux.*armv.*")" ] && cpucore="armv5"
|
||||
[ -n "$(echo $cputype | grep -E "linux.*armv7.*")" ] && [ -n "$(cat /proc/cpuinfo | grep vfp)" ] && cpucore="armv7"
|
||||
[ -n "$(echo $cputype | grep -E "linux.*aarch64.*|linux.*armv8.*")" ] && cpucore="armv8"
|
||||
[ -n "$(echo $cputype | grep -E "linux.*86.*")" ] && cpucore="386"
|
||||
[ -n "$(echo $cputype | grep -E "linux.*86_64.*")" ] && cpucore="amd64"
|
||||
if [ -n "$(echo $cputype | grep -E "linux.*mips.*")" ];then
|
||||
mipstype=$(echo -n I | hexdump -o | awk '{ print substr($2,6,1); exit}') #通过判断大小端判断mips或mipsle
|
||||
if [ "$mipstype" = "1" ];then
|
||||
cpucore="mipsle-softfloat"
|
||||
#[ -n "$(uname -a | grep -E "M2100")" ] && cpucore="mipsle-hardfloat"
|
||||
else
|
||||
cpucore="mips-softfloat"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
###
|
||||
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
[ -z "$cpucore" ] && getcputype
|
||||
echo -e "当前clash核心:\033[47;30m $clashcore \033[46;30m$clashv\033[0m"
|
||||
echo -e "\033[32m请选择需要下载的核心版本!\033[0m"
|
||||
echo -e "当前系统处理器架构:\033[32m $cpucore \033[0m"
|
||||
echo -e "\033[33m请选择需要下载的核心版本!\033[0m"
|
||||
echo -----------------------------------------------
|
||||
echo "1 clash: 稳定,内存占用小,推荐!"
|
||||
echo "(官方正式版) 不支持Tun模式、混合模式"
|
||||
echo
|
||||
echo "2 clashpre: 支持Tun模式、混合模式"
|
||||
echo "(高级预览版) 内存占用更高"
|
||||
echo
|
||||
echo "3 手动指定处理器架构"
|
||||
echo -----------------------------------------------
|
||||
echo 0 返回上级菜单
|
||||
read -p "请输入对应数字 > " num
|
||||
if [ -z "$num" ]; then
|
||||
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
echo -----------------------------------------------
|
||||
echo -e "\033[31m请输入正确的数字!\033[0m"
|
||||
update
|
||||
elif [[ $num == 0 ]]; then
|
||||
@@ -339,10 +374,23 @@ read -p "请输入对应数字 > " num
|
||||
clashcore=clashpre
|
||||
version=$clashpre_v
|
||||
elif [[ $num == 3 ]]; then
|
||||
clashcore=clashr
|
||||
version='已停止更新'
|
||||
cpucore_list="armv5 armv7 armv8 386 amd64 mipsle-softfloat mipsle-hardfloat mips-softfloat"
|
||||
echo -----------------------------------------------
|
||||
echo -e "\033[31m仅适合脚本无法正确识别核心或核心无法正常运行时使用!\033[0m"
|
||||
echo -e "当前可供在线下载的处理器架构为:"
|
||||
echo -e "\033[32m$cpucore_list\033[0m"
|
||||
echo -e "如果您的CPU架构未在以上列表中,请运行【uname -a】命令,并复制好返回信息"
|
||||
echo -e "之后前往 t.me/clashfm 群提交或 github.com/juewuy/ShellClash 提交issue"
|
||||
echo -----------------------------------------------
|
||||
read -p "请手动输入处理器架构 > " cpucore
|
||||
if [ -z "$(echo $cpucore_list |grep "$cpucore")" ];then
|
||||
echo -e "\033[31m请输入正确的处理器架构!\033[0m"
|
||||
sleep 1
|
||||
cpucore=""
|
||||
fi
|
||||
getcore
|
||||
else
|
||||
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
echo -----------------------------------------------
|
||||
echo -e "\033[31m请输入正确的数字!\033[0m"
|
||||
update
|
||||
fi
|
||||
|
||||
@@ -51,7 +51,7 @@ EOF`
|
||||
#如果传来的是Url链接则合成Https链接,否则直接使用Https链接
|
||||
if [ -z "$Https" ];then
|
||||
#echo $Url
|
||||
Https="https://$Server/sub?target=clash&insert=true&new_name=true&scv=true&exclude=$exclude&url=$Url&config=$Config"
|
||||
Https="https://$Server/sub?target=clash&insert=true&new_name=true&scv=true&exclude=$exclude&include=$include&url=$Url&config=$Config"
|
||||
markhttp=1
|
||||
fi
|
||||
#
|
||||
@@ -339,7 +339,7 @@ afstart(){
|
||||
#启用面板配置自动保存
|
||||
web_save_auto
|
||||
#后台还原面板配置
|
||||
web_restore &
|
||||
[ -f $clashdir/web_save ] && web_restore &
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
|
||||
Reference in New Issue
Block a user