mirror of
https://github.com/juewuy/ShellCrash.git
synced 2024-11-16 11:42:18 +08:00
v1.8.6
~更新功能调整,新增更新版本通道选择 ·增加稳定版分支及分支切换 ·增加公测版及开发版分支 ·现在前4个源都支持各个分支之间任意切换及回退 ·内测源今后改为个人开发测试用,请更新后尽快换源 ~正式适配sing-box1.8.0内核 ·已编译mips相关版本内核文件 ·已将内核添加到项目内/bin目录,以支持小闪存模式 ·编译时移除了with_gvisor参数,以优化内存占用 ~修复手动加载/tmp目录下内核时无法正确识别的bug ~修复保守模式启用本机代理后部分设备导致日志刷屏的bug
This commit is contained in:
parent
3679267902
commit
75f1bbeaa4
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -3,5 +3,5 @@ clashpre_v=2022.11.25
|
|||
clash_v=v1.7.1
|
||||
meta_v=v1.18.0
|
||||
singbox_v=1.8.0
|
||||
versionsh=1.8.5f
|
||||
GeoIP_v=20240107
|
||||
versionsh=1.8.6
|
||||
|
|
|
@ -1,22 +1,20 @@
|
|||
# ID&类型 说明 地址 其他说明 (类型:100-稳定源;200-测试源;300-基础sub;400-meta_sub;500-规则地址)
|
||||
# ID&类型 说明 地址 其他说明 (类型:100-三版全通源;200-单一源;300-基础sub;400-meta_sub;500-规则地址)
|
||||
|
||||
101 Jsdelivr-CDN源 https://fastly.jsdelivr.net/gh/juewuy/ShellCrash 稳定版
|
||||
102 Github源(须clash服务启用) https://raw.githubusercontent.com/juewuy/ShellCrash 稳定版
|
||||
101 Jsdelivr_CDN源 https://fastly.jsdelivr.net/gh/juewuy/ShellCrash
|
||||
102 Github直连源(请注意网络环境) https://raw.githubusercontent.com/juewuy/ShellCrash
|
||||
103 ShellClash自建源(请勿滥用!) https://gh.jwsc.eu.org
|
||||
104 Cloudflare_CDN源 https://gh.shellclash.workers.dev/https://raw.githubusercontent.com/juewuy/ShellCrash
|
||||
|
||||
201 Jsdelivr-CDN源 https://fastly.jsdelivr.net/gh/juewuy/ShellCrash@master 公测版
|
||||
202 ShellClash自建源 https://gh.jwsc.eu.org/master 公测版
|
||||
203 ShellClash-cfworkers源 https://gh.shellclash.workers.dev/https://raw.githubusercontent.com/juewuy/ShellCrash 公测版
|
||||
204 Github源(须clash服务启用) https://raw.githubusercontent.com/juewuy/ShellCrash/master 公测版
|
||||
205 (请加讨论组-https://t.me/ShellClash) http://t.jwsc.eu.org 内测版
|
||||
206 wwng2333自建CN源 https://mirrors.csgo.ovh/ShellClash 公测版
|
||||
201 wwng2333自建CN源(请勿滥用!) https://mirrors.csgo.ovh/ShellClash 公测版
|
||||
202 http私人内测源(危险!非必要请勿使用) http://t.jwsc.eu.org 开发版
|
||||
|
||||
301 墙洞提供,不支持vless|hy https://api.dler.io
|
||||
302 SUB作者提供,不支持vless|hy https://sub.xeton.dev
|
||||
303 品云提供,不支持vless|hy https://sub.id9.cc
|
||||
|
||||
401 肥羊提供(有广告),支持vless|hy2 https://sub.d1.mk
|
||||
402 肥羊提供(有广告),支持vless|hy2 https://api.v1.mk
|
||||
403 作者提供,支持vless|hy2 https://sub.jwsc.eu.org
|
||||
401 肥羊提供(有广告),支持vless|hy2 https://sub.d1.mk
|
||||
402 作者提供,支持vless|hy2 https://sub.jwsc.eu.org
|
||||
403 肥羊提供(有广告),支持vless|hy2 https://api.v1.mk
|
||||
|
||||
497 作者提供,未加密仅备用 http://sub2.jwsc.eu.org
|
||||
498 本地服务器 http://127.0.0.1:25500
|
||||
|
|
|
@ -9,6 +9,7 @@ dir_avail(){
|
|||
df -h &>/dev/null && h=$2
|
||||
df $h $1 |awk '{ for(i=1;i<=NF;i++){ if(NR==1){ arr[i]=$i; }else{ arr[i]=arr[i]" "$i; } } } END{ for(i=1;i<=NF;i++){ print arr[i]; } }' |grep -E 'Ava|可用' |awk '{print $2}'
|
||||
}
|
||||
|
||||
#导入订阅、配置文件相关
|
||||
setrules(){ #自定义clash规则
|
||||
set_rule_type(){
|
||||
|
@ -761,7 +762,7 @@ set_core_config(){ #配置文件功能
|
|||
}
|
||||
#下载更新相关
|
||||
gettar(){
|
||||
${CRASHDIR}/start.sh webget ${TMPDIR}/clashfm.tar.gz $tarurl
|
||||
${CRASHDIR}/start.sh get_bin ${TMPDIR}/update.tar.gz bin/clashfm.tar.gz
|
||||
if [ "$?" != "0" ];then
|
||||
echo -e "\033[33m文件下载失败!\033[0m"
|
||||
error_down
|
||||
|
@ -771,7 +772,7 @@ gettar(){
|
|||
echo -----------------------------------------------
|
||||
echo 开始解压文件!
|
||||
mkdir -p ${CRASHDIR} > /dev/null
|
||||
tar -zxvf "${TMPDIR}/clashfm.tar.gz" -C ${CRASHDIR}/ || tar -zxvf "${TMPDIR}/clashfm.tar.gz" --no-same-owner -C ${CRASHDIR}/
|
||||
tar -zxvf "${TMPDIR}/update.tar.gz" -C ${CRASHDIR}/ 2>/dev/null || tar -zxvf "${TMPDIR}/update.tar.gz" --no-same-owner -C ${CRASHDIR}/
|
||||
if [ $? -ne 0 ];then
|
||||
echo -e "\033[33m文件解压失败!\033[0m"
|
||||
error_down
|
||||
|
@ -780,7 +781,7 @@ gettar(){
|
|||
echo -e "\033[32m脚本更新成功!\033[0m"
|
||||
fi
|
||||
fi
|
||||
rm -rf ${TMPDIR}/clashfm.tar.gz
|
||||
rm -rf ${TMPDIR}/update.tar.gz
|
||||
exit
|
||||
}
|
||||
getsh(){
|
||||
|
@ -791,7 +792,6 @@ getsh(){
|
|||
echo -----------------------------------------------
|
||||
read -p "是否更新脚本?[1/0] > " res
|
||||
if [ "$res" = '1' ]; then
|
||||
tarurl=$update_url/bin/clashfm.tar.gz
|
||||
#下载更新
|
||||
gettar
|
||||
#提示
|
||||
|
@ -884,12 +884,14 @@ getcore(){
|
|||
[ -z "$crashcore" ] && crashcore=clashpre
|
||||
[ -z "$cpucore" ] && getcpucore
|
||||
[ "$crashcore" = singbox ] && core_new=singbox || core_new=clash
|
||||
#生成链接
|
||||
[ -z "$custcorelink" ] && corelink="${update_url}/bin/${crashcore}/${core_new}-linux-${cpucore}" || corelink="$custcorelink"
|
||||
#获取在线内核文件
|
||||
echo -----------------------------------------------
|
||||
echo 正在在线获取$crashcore核心文件……
|
||||
${CRASHDIR}/start.sh webget ${TMPDIR}/core.new $corelink
|
||||
if [ -z "$custcorelink" ];then
|
||||
${CRASHDIR}/start.sh get_bin ${TMPDIR}/core.new bin/${crashcore}/${core_new}-linux-${cpucore}
|
||||
else
|
||||
${CRASHDIR}/start.sh webget ${TMPDIR}/core.new "$custcorelink"
|
||||
fi
|
||||
if [ "$?" = "1" ];then
|
||||
echo -e "\033[31m核心文件下载失败!\033[0m"
|
||||
rm -rf ${TMPDIR}/core.new
|
||||
|
@ -931,7 +933,7 @@ setcustcore(){
|
|||
echo -e "\033[33m请选择需要使用的核心!\033[0m"
|
||||
echo -e "1 \033[32m 测试版ClashPre内核 \033[0m"
|
||||
echo -e "2 \033[32m 最新Meta.Alpha内核 \033[0m"
|
||||
echo -e "3 \033[32m Sing-Box官方内核 \033[0m"
|
||||
#echo -e "3 \033[32m Sing-Box官方内核 \033[0m"
|
||||
echo -e "4 \033[33m 自定义内核链接 \033[0m"
|
||||
read -p "请输入对应数字 > " num
|
||||
case "$num" in
|
||||
|
@ -984,11 +986,15 @@ setcore(){
|
|||
echo
|
||||
echo -e "3 \033[43;30mClash.Meta\033[0m: \033[32m多功能,支持最全面\033[0m"
|
||||
echo -e " (Meta稳定内核) \033[33m内存占用较高\033[0m"
|
||||
echo -e " 说明文档: \033[36;4mhttps://docs.metacubex.one\033[0m"
|
||||
echo -e " 说明文档: \033[36;4mhttps://wiki.metacubex.one\033[0m"
|
||||
echo
|
||||
echo -e "4 \033[32m自定义内核\033[0m: \033[33m仅限专业用户使用\033[0m"
|
||||
echo -e "4 \033[43;30mSing-Box\033[0m: \033[32m支持全面占用低\033[0m"
|
||||
echo -e " (sing-box内核) \033[33m另一个选择\033[0m"
|
||||
echo -e " 说明文档: \033[36;4mhttps://sing-box.sagernet.org\033[0m"
|
||||
echo
|
||||
echo "5 手动指定处理器架构"
|
||||
echo -e "5 \033[32m自定义内核\033[0m: \033[33m仅限专业用户使用\033[0m"
|
||||
echo
|
||||
echo "6 手动指定处理器架构"
|
||||
echo -----------------------------------------------
|
||||
echo 0 返回上级菜单
|
||||
read -p "请输入对应数字 > " num
|
||||
|
@ -1009,9 +1015,14 @@ setcore(){
|
|||
getcore
|
||||
;;
|
||||
4)
|
||||
setcustcore
|
||||
crashcore=singbox
|
||||
custcorelink=''
|
||||
getcore
|
||||
;;
|
||||
5)
|
||||
setcustcore
|
||||
;;
|
||||
6)
|
||||
setcpucore
|
||||
setcore
|
||||
;;
|
||||
|
@ -1023,10 +1034,9 @@ setcore(){
|
|||
|
||||
getgeo(){
|
||||
#生成链接
|
||||
[ -z "$custgeolink" ] && geolink="$update_url/bin/geodata/$geotype" || geolink="$custgeolink"
|
||||
echo -----------------------------------------------
|
||||
echo 正在从服务器获取数据库文件…………
|
||||
${CRASHDIR}/start.sh webget ${TMPDIR}/$geoname $geolink
|
||||
${CRASHDIR}/start.sh get_bin ${TMPDIR}/$geoname bin/geodata/$geotype
|
||||
if [ "$?" = "1" ];then
|
||||
echo -----------------------------------------------
|
||||
echo -e "\033[31m文件下载失败!\033[0m"
|
||||
|
@ -1277,10 +1287,10 @@ esac
|
|||
}
|
||||
|
||||
getdb(){
|
||||
dblink="${update_url}/bin/dashboard/${db_type}.tar.gz"
|
||||
dblink="${update_url}/"
|
||||
echo -----------------------------------------------
|
||||
echo 正在连接服务器获取安装文件…………
|
||||
${CRASHDIR}/start.sh webget ${TMPDIR}/clashdb.tar.gz $dblink
|
||||
${CRASHDIR}/start.sh get_bin ${TMPDIR}/clashdb.tar.gz bin/dashboard/${db_type}.tar.gz
|
||||
if [ "$?" = "1" ];then
|
||||
echo -----------------------------------------------
|
||||
echo -e "\033[31m文件下载失败!\033[0m"
|
||||
|
@ -1402,10 +1412,9 @@ setdb(){
|
|||
}
|
||||
|
||||
getcrt(){
|
||||
crtlink="${update_url}/bin/fix/ca-certificates.crt"
|
||||
echo -----------------------------------------------
|
||||
echo 正在连接服务器获取安装文件…………
|
||||
${CRASHDIR}/start.sh webget ${TMPDIR}/ca-certificates.crt $crtlink
|
||||
${CRASHDIR}/start.sh get_bin ${TMPDIR}/ca-certificates.crt bin/fix/ca-certificates.crt
|
||||
if [ "$?" = "1" ];then
|
||||
echo -----------------------------------------------
|
||||
echo -e "\033[31m文件下载失败!\033[0m"
|
||||
|
@ -1414,12 +1423,11 @@ getcrt(){
|
|||
echo -----------------------------------------------
|
||||
mkdir -p $openssldir
|
||||
mv -f ${TMPDIR}/ca-certificates.crt $crtdir
|
||||
${CRASHDIR}/start.sh webget ${TMPDIR}/ssl_test https://baidu.com echooff rediron skipceroff
|
||||
${CRASHDIR}/start.sh webget /dev/null https://baidu.com echooff rediron skipceroff
|
||||
if [ "$?" = "1" ];then
|
||||
export CURL_CA_BUNDLE=$crtdir
|
||||
echo "export CURL_CA_BUNDLE=$crtdir" >> /etc/profile
|
||||
fi
|
||||
rm -rf ${TMPDIR}/ssl_test
|
||||
echo -e "\033[32m证书安装成功!\033[0m"
|
||||
sleep 1
|
||||
fi
|
||||
|
@ -1454,68 +1462,123 @@ setcrt(){
|
|||
}
|
||||
#安装源
|
||||
setserver(){
|
||||
[ -z "$release_type" ] && release_name=未指定
|
||||
[ -n "$release_type" ] && release_name=${release_type}'(回退)'
|
||||
[ "$release_type" = stable ] && release_name=稳定版
|
||||
[ "$release_type" = master ] && release_name=公测版
|
||||
[ "$release_type" = dev ] && release_name=开发版
|
||||
[ -n "$url_id" ] && url_name=$(grep "$url_id" ${CRASHDIR}/configs/servers.list 2>/dev/null | awk '{print $2}') || url_name=$update_url
|
||||
saveserver(){
|
||||
#写入配置文件
|
||||
setconfig update_url \'$update_url\'
|
||||
setconfig release_url \'$release_url\'
|
||||
setconfig url_id $url_id
|
||||
setconfig release_type $release_type
|
||||
echo -----------------------------------------------
|
||||
echo -e "\033[32m源地址更新成功!\033[0m"
|
||||
release_new=""
|
||||
}
|
||||
echo -----------------------------------------------
|
||||
echo -e "\033[30;47m切换ShellCrash版本及更新源地址\033[0m"
|
||||
echo -e "当前源地址:\033[4;32m$update_url\033[0m"
|
||||
echo -e "当前版本:\033[4;33m$release_name\033[0m 当前源:\033[4;32m$url_name\033[0m"
|
||||
echo -----------------------------------------------
|
||||
grep -aE '^1|^2' ${CRASHDIR}/configs/servers.list | awk '{print " "NR" "$4" "$2}'
|
||||
grep -E "^1|$release_name" ${CRASHDIR}/configs/servers.list | awk '{print " "NR" "$2}'
|
||||
echo -----------------------------------------------
|
||||
echo -e " a 自定义源地址(用于本地源或自建源)"
|
||||
echo -e " b \033[31m版本回退\033[0m"
|
||||
echo -e " a 切换至\033[32m稳定版\033[0m"
|
||||
echo -e " b 切换至\033[36m公测版\033[0m"
|
||||
echo -e " c 切换至\033[33m开发版\033[0m"
|
||||
echo -----------------------------------------------
|
||||
echo -e " d 自定义源地址(用于本地源或自建源)"
|
||||
echo -e " e \033[31m版本回退\033[0m"
|
||||
echo -e " 0 返回上级菜单"
|
||||
read -p "请输入对应数字 > " num
|
||||
echo -----------------------------------------------
|
||||
read -p "请输入对应字母或数字 > " num
|
||||
case $num in
|
||||
0)
|
||||
;;
|
||||
[1-99])
|
||||
release_type=$(grep -aE '^1|^2' ${CRASHDIR}/configs/servers.list | sed -n ""$num"p" | awk '{print $4}')
|
||||
if [ "release_type" = "稳定版" ];then
|
||||
release_url=$(grep -aE '^1' ${CRASHDIR}/configs/servers.list | sed -n ""$num"p" | awk '{print $3}')
|
||||
url_id_new=$(grep -E "^1|$release_name" ${CRASHDIR}/configs/servers.list | sed -n ""$num"p" | awk '{print $1}')
|
||||
if [ -z "$url_id_new" ];then
|
||||
errornum
|
||||
sleep 1
|
||||
setserver
|
||||
elif [ "$url_id_new" -ge 200 ];then
|
||||
update_url=$(grep -E "^1|$release_name" ${CRASHDIR}/configs/servers.list | sed -n ""$num"p" | awk '{print $3}')
|
||||
url_id=''
|
||||
saveserver
|
||||
else
|
||||
update_url=$(grep -aE '^1|^2' ${CRASHDIR}/configs/servers.list | sed -n ""$num"p" | awk '{print $3}')
|
||||
unset release_url
|
||||
url_id=$url_id_new
|
||||
update_url=''
|
||||
saveserver
|
||||
fi
|
||||
saveserver
|
||||
unset url_id_new
|
||||
;;
|
||||
a)
|
||||
release_type=stable
|
||||
setconfig release_type $release_type
|
||||
setserver
|
||||
;;
|
||||
b)
|
||||
release_type=master
|
||||
setconfig release_type $release_type
|
||||
setserver
|
||||
;;
|
||||
c)
|
||||
echo -----------------------------------------------
|
||||
echo -e "\033[33m开发版未经过妥善测试,可能依然存在大量bug!!!\033[0m"
|
||||
echo -e "\033[36m如果你没有足够的耐心或者测试经验,切勿使用此版本!\033[0m"
|
||||
echo -e "请务必加入我们的讨论组:\033[32;4mhttps://t.me/ShellClash\033[0m"
|
||||
read -p "是否依然切换到开发版?(1/0) > " res
|
||||
if [ "$res" = 1 ];then
|
||||
release_type=dev
|
||||
setconfig release_type $release_type
|
||||
fi
|
||||
setserver
|
||||
;;
|
||||
d)
|
||||
echo -----------------------------------------------
|
||||
read -p "请输入个人源路径 > " update_url
|
||||
if [ -z "$update_url" ];then
|
||||
echo -----------------------------------------------
|
||||
echo -e "\033[31m取消输入,返回上级菜单\033[0m"
|
||||
else
|
||||
url_id=''
|
||||
release_type=''
|
||||
saveserver
|
||||
unset release_url
|
||||
fi
|
||||
;;
|
||||
b)
|
||||
e)
|
||||
echo -----------------------------------------------
|
||||
echo -e "\033[33m如无法连接,请务必先启用服务!!!\033[0m"
|
||||
${CRASHDIR}/start.sh webget ${TMPDIR}/release_new https://raw.githubusercontent.com/juewuy/ShellCrash/master/bin/release_version echooff rediroff 2>${TMPDIR}/release_new
|
||||
echo -e "\033[31m请选择想要回退至的release版本:\033[0m"
|
||||
cat ${TMPDIR}/release_new | awk '{print " "NR" "$1}'
|
||||
echo -e " 0 返回上级菜单"
|
||||
read -p "请输入对应数字 > " num
|
||||
if [ -z "$num" -o "$num" = 0 ]; then
|
||||
setserver
|
||||
elif [ $num -le $(cat ${TMPDIR}/release_new 2>/dev/null | awk 'END{print NR}') ]; then
|
||||
release_version=$(cat ${TMPDIR}/release_new | awk '{print $1}' | sed -n "$num"p)
|
||||
update_url="https://raw.githubusercontent.com/juewuy/ShellCrash/$release_version"
|
||||
saveserver
|
||||
unset release_url
|
||||
if [ -n "$url_id" ] && [ "$url_id" -lt 200 ];then
|
||||
echo -ne "\033[32m正在获取版本信息!\033[0m\r"
|
||||
${CRASHDIR}/start.sh get_bin ${TMPDIR}/release_version bin/release_version
|
||||
if [ "$?" = "0" ];then
|
||||
echo -e "\033[31m请选择想要回退至的稳定版版本:\033[0m"
|
||||
cat ${TMPDIR}/release_version | awk '{print " "NR" "$1}'
|
||||
echo -e " 0 返回上级菜单"
|
||||
read -p "请输入对应数字 > " num
|
||||
if [ -z "$num" -o "$num" = 0 ]; then
|
||||
setserver
|
||||
elif [ $num -le $(cat ${TMPDIR}/release_version 2>/dev/null | awk 'END{print NR}') ]; then
|
||||
release_type=$(cat ${TMPDIR}/release_version | awk '{print $1}' | sed -n "$num"p)
|
||||
update_url=''
|
||||
saveserver
|
||||
else
|
||||
echo -----------------------------------------------
|
||||
errornum
|
||||
sleep 1
|
||||
setserver
|
||||
fi
|
||||
else
|
||||
echo -----------------------------------------------
|
||||
echo -e "\033[31m版本回退信息获取失败,请尝试更换其他安装源!\033[0m"
|
||||
sleep 1
|
||||
setserver
|
||||
fi
|
||||
rm -rf ${TMPDIR}/release_version
|
||||
else
|
||||
echo -----------------------------------------------
|
||||
echo -e "\033[31m输入有误,请重新输入!\033[0m"
|
||||
echo -e "\033[31m当前源不支持版本回退,请尝试更换其他安装源!\033[0m"
|
||||
sleep 1
|
||||
setserver
|
||||
fi
|
||||
rm -rf ${TMPDIR}/release_new
|
||||
;;
|
||||
*)
|
||||
errornum
|
||||
|
@ -1524,29 +1587,16 @@ setserver(){
|
|||
}
|
||||
#检查更新
|
||||
checkupdate(){
|
||||
if [ -z "$release_new" ];then
|
||||
if [ -n "$release_url" ];then
|
||||
[ -n "$(echo $release_url|grep 'jsdelivr')" ] && check_url=$release_url@master || check_url=$release_url/master
|
||||
${CRASHDIR}/start.sh webget ${TMPDIR}/version_new $check_url/bin/release_version echoon rediroff 2>${TMPDIR}/version_new
|
||||
release_new=$(cat ${TMPDIR}/version_new | head -1)
|
||||
[ -n "$(echo $release_url|grep 'jsdelivr')" ] && update_url=$release_url@$release_new || update_url=$release_url/$release_new
|
||||
setconfig update_url \'$update_url\'
|
||||
release_type=正式版
|
||||
else
|
||||
release_type=测试版
|
||||
fi
|
||||
${CRASHDIR}/start.sh webget ${TMPDIR}/version_new $update_url/bin/version echooff
|
||||
[ "$?" = "0" ] && release_new=$(cat ${TMPDIR}/version_new | grep -oE 'versionsh=.*' | awk -F'=' '{ print $2 }')
|
||||
if [ -n "$release_new" ];then
|
||||
${CRASHDIR}/start.sh get_bin ${TMPDIR}/version_new bin/version echooff
|
||||
[ "$?" = "0" ] && version_new=$(cat ${TMPDIR}/version_new | grep -oE 'versionsh=.*' | awk -F'=' '{ print $2 }')
|
||||
if [ -n "$version_new" ];then
|
||||
source ${TMPDIR}/version_new 2>/dev/null
|
||||
else
|
||||
echo -e "\033[31m检查更新失败!请切换其他安装源!\033[0m"
|
||||
echo -e "\033[36m如全部安装源都无法使用,请先运行服务后再使用更新功能!\033[0m"
|
||||
sleep 1
|
||||
echo -e "\033[31m检查更新失败!请尝试切换其他安装源!\033[0m"
|
||||
setserver
|
||||
checkupdate
|
||||
fi
|
||||
rm -rf ${TMPDIR}/version_new
|
||||
fi
|
||||
}
|
||||
update(){
|
||||
echo -----------------------------------------------
|
||||
|
@ -1562,8 +1612,8 @@ update(){
|
|||
sleep 1
|
||||
}
|
||||
echo -----------------------------------------------
|
||||
echo -e " 1 更新\033[36m管理脚本 \033[33m$versionsh_l\033[0m > \033[32m$versionsh$release_type\033[0m"
|
||||
echo -e " 2 切换\033[33m内核文件 \033[33m$core_v\033[0m > \033[32m$core_v_new\033[0m"
|
||||
echo -e " 1 更新\033[36m管理脚本 \033[33m$versionsh_l\033[0m > \033[32m$version_new\033[0m"
|
||||
echo -e " 2 切换\033[33m内核文件 \033[33m$core_v\033[0m > \033[32m$core_v_new\033[0m"
|
||||
echo -e " 3 更新\033[32m数据库文件\033[0m"
|
||||
echo -e " 4 安装本地\033[35mDashboard\033[0m面板"
|
||||
echo -e " 5 安装/更新本地\033[33m根证书文件\033[0m"
|
||||
|
@ -1723,14 +1773,13 @@ userguide(){
|
|||
[ "$res" = 1 ] && checkupdate && getcrt
|
||||
fi
|
||||
#设置加密DNS
|
||||
${CRASHDIR}/start.sh webget ${TMPDIR}/ssl_test https://doh.pub echooff rediron
|
||||
${CRASHDIR}/start.sh webget /dev/null https://baidu.com echooff rediron
|
||||
if [ "$?" = "0" ];then
|
||||
dns_nameserver='https://223.5.5.5/dns-query, https://doh.pub/dns-query, tls://dns.rubyfish.cn:853'
|
||||
dns_fallback='https://1.0.0.1/dns-query, https://8.8.4.4/dns-query, https://doh.opendns.com/dns-query'
|
||||
setconfig dns_nameserver \'"$dns_nameserver"\'
|
||||
setconfig dns_fallback \'"$dns_fallback"\'
|
||||
fi
|
||||
rm -rf ${TMPDIR}/ssl_test
|
||||
#开启公网访问
|
||||
sethost(){
|
||||
read -p "请输入你的公网IP地址 > " host
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#!/bin/sh
|
||||
# Copyright (C) Juewuy
|
||||
|
||||
version=1.8.5f
|
||||
version=1.8.6
|
||||
|
||||
setdir(){
|
||||
dir_avail(){
|
||||
|
|
|
@ -9,7 +9,7 @@ source ${CRASHDIR}/configs/command.env &>/dev/null
|
|||
[ -z "$BINDIR" -o -z "$TMPDIR" -o -z "$COMMAND" ] && source ${CRASHDIR}/init.sh &>/dev/null
|
||||
[ ! -f ${TMPDIR} ] && mkdir -p ${TMPDIR}
|
||||
|
||||
#读取配置相关
|
||||
#脚本内部工具
|
||||
setconfig(){
|
||||
#参数1代表变量名,参数2代表变量值,参数3即文件路径
|
||||
[ -z "$3" ] && configpath=${CFG_PATH} || configpath="${3}"
|
||||
|
@ -18,7 +18,9 @@ setconfig(){
|
|||
ckcmd(){
|
||||
command -v sh &>/dev/null && command -v $1 &>/dev/null || type $1 &>/dev/null
|
||||
}
|
||||
ckstatus(){
|
||||
|
||||
#脚本启动前检查
|
||||
ckstatus(){
|
||||
#检查/读取脚本配置文件
|
||||
if [ -f $CFG_PATH ];then
|
||||
[ -n "$(awk 'a[$0]++' $CFG_PATH)" ] && awk '!a[$0]++' $CFG_PATH > $CFG_PATH #检查重复行并去除
|
||||
|
@ -28,8 +30,6 @@ ckstatus(){
|
|||
fi
|
||||
versionsh=$(cat ${CRASHDIR}/init.sh | grep -E ^version= | head -n 1 | sed 's/version=//')
|
||||
[ -n "$versionsh" ] && versionsh_l=$versionsh
|
||||
#服务器缺省地址
|
||||
[ -z "$update_url" ] && update_url=https://fastly.jsdelivr.net/gh/juewuy/ShellCrash
|
||||
#设置默认端口及变量
|
||||
[ -z "$mix_port" ] && mix_port=7890
|
||||
[ -z "$redir_port" ] && redir_port=7892
|
||||
|
@ -101,15 +101,15 @@ 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)(xz)]$" | grep -iE '^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 '^clash$|^clash-linux.*|^mihomo.*|^sing.*box|^clash.meta.*'` ; do
|
||||
file=/tmp/$file
|
||||
chmod +x $file
|
||||
echo -e "发现可用的内核文件: \033[36m$file\033[0m "
|
||||
read -p "是否加载(会停止当前服务)?(1/0) > " res
|
||||
[ "$res" = 1 ] && {
|
||||
${CRASHDIR}/start.sh stop
|
||||
core_v=$($file -v &>/dev/null)
|
||||
[ -z "$core_v" ] && $($file version &>/dev/null)
|
||||
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}/getdate.sh && setcoretype && \
|
||||
mv -f $file ${CRASHDIR}/CrashCore && \
|
||||
|
@ -151,8 +151,7 @@ ckstatus(){
|
|||
echo -----------------------------------------------
|
||||
}
|
||||
}
|
||||
|
||||
#启动相关
|
||||
#内核服务启动相关
|
||||
errornum(){
|
||||
echo -----------------------------------------------
|
||||
echo -e "\033[31m请输入正确的字母或数字!\033[0m"
|
||||
|
@ -394,7 +393,7 @@ log_pusher(){ #日志菜单
|
|||
*) errornum ;;
|
||||
esac
|
||||
}
|
||||
setport(){
|
||||
setport(){ #端口设置
|
||||
source $CFG_PATH > /dev/null
|
||||
[ -z "$secret" ] && secret=未设置
|
||||
[ -z "$authentication" ] && auth=未设置 || auth=******
|
||||
|
@ -514,7 +513,7 @@ setport(){
|
|||
setport
|
||||
fi
|
||||
}
|
||||
setdns(){
|
||||
setdns(){ #DNS设置
|
||||
[ -z "$dns_nameserver" ] && dns_nameserver='114.114.114.114, 223.5.5.5'
|
||||
[ -z "$dns_fallback" ] && dns_fallback='1.0.0.1, 8.8.4.4'
|
||||
[ -z "$hosts_opt" ] && hosts_opt=已开启
|
||||
|
@ -627,7 +626,7 @@ setdns(){
|
|||
setdns
|
||||
fi
|
||||
}
|
||||
setipv6(){
|
||||
setipv6(){ #ipv6设置
|
||||
|
||||
[ -z "$ipv6_support" ] && ipv6_support=已开启
|
||||
[ -z "$ipv6_redir" ] && ipv6_redir=未开启
|
||||
|
@ -687,7 +686,7 @@ setipv6(){
|
|||
;;
|
||||
esac
|
||||
}
|
||||
setfirewall(){
|
||||
setfirewall(){ #防火墙设置
|
||||
set_cust_host_ipv4(){
|
||||
echo -----------------------------------------------
|
||||
echo -e "当前已自动设置透明路由的网段为: \033[32m$(ip a 2>&1 | grep -w 'inet' | grep 'global' | grep 'br' | grep -v 'iot' | grep -E ' 1(92|0|72)\.' | sed 's/.*inet.//g' | sed 's/br.*$//g' | sed 's/metric.*$//g' | tr '\n' ' ' && echo ) \033[0m"
|
||||
|
@ -763,7 +762,7 @@ setfirewall(){
|
|||
;;
|
||||
esac
|
||||
}
|
||||
checkport(){
|
||||
checkport(){ #自动检查端口冲突
|
||||
for portx in $dns_port $mix_port $redir_port $db_port ;do
|
||||
if [ -n "$(netstat -ntul 2>&1 |grep '\:$portx ')" ];then
|
||||
echo -----------------------------------------------
|
||||
|
@ -777,7 +776,7 @@ checkport(){
|
|||
fi
|
||||
done
|
||||
}
|
||||
macfilter(){
|
||||
macfilter(){ #局域网设备过滤
|
||||
add_mac(){
|
||||
echo -----------------------------------------------
|
||||
echo 已添加的mac地址:
|
||||
|
@ -908,7 +907,7 @@ macfilter(){
|
|||
macfilter
|
||||
fi
|
||||
}
|
||||
localproxy(){
|
||||
localproxy(){ #本机代理
|
||||
[ -w /etc/systemd/system/shellcrash.service -o -w /usr/lib/systemd/system/shellcrash.service -o -x /bin/su ] && local_enh=1
|
||||
[ -f /etc/rc.common -a -w /etc/passwd ] && local_enh=1
|
||||
echo -----------------------------------------------
|
||||
|
@ -949,7 +948,7 @@ localproxy(){
|
|||
setconfig local_proxy $local_proxy
|
||||
setconfig local_type $local_type
|
||||
}
|
||||
setboot(){
|
||||
setboot(){ #启动相关设置
|
||||
[ -z "$start_old" ] && start_old=未开启
|
||||
[ -z "$start_delay" -o "$start_delay" = 0 ] && delay=未设置 || delay=${start_delay}秒
|
||||
[ "$autostart" = "enable" ] && auto_set="\033[33m禁止" || auto_set="\033[32m允许"
|
||||
|
@ -1096,7 +1095,7 @@ metacfg(){
|
|||
echo -----------------------------------------------
|
||||
|
||||
}
|
||||
normal_set(){
|
||||
normal_set(){ #基础设置
|
||||
set_redir_mod(){
|
||||
set_redir_config(){
|
||||
setconfig redir_mod $redir_mod
|
||||
|
@ -1423,7 +1422,7 @@ normal_set(){
|
|||
errornum
|
||||
fi
|
||||
}
|
||||
advanced_set(){
|
||||
advanced_set(){ #进阶设置
|
||||
#获取设置默认显示
|
||||
[ -z "$proxies_bypass" ] && proxies_bypass=未启用
|
||||
[ -z "$start_old" ] && start_old=未开启
|
||||
|
@ -1535,7 +1534,7 @@ advanced_set(){
|
|||
*) errornum ;;
|
||||
esac
|
||||
}
|
||||
#工具脚本
|
||||
#工具列表
|
||||
autoSSH(){
|
||||
echo -----------------------------------------------
|
||||
echo -e "\033[33m本功能使用软件命令进行固化不保证100%成功!\033[0m"
|
||||
|
@ -1668,7 +1667,7 @@ tools(){
|
|||
echo -----------------------------------------------
|
||||
if [ ! -f ${CRASHDIR}/tools/ShellDDNS.sh ];then
|
||||
echo -e "正在获取在线脚本……"
|
||||
${CRASHDIR}/start.sh webget ${TMPDIR}/ShellDDNS.sh $update_url/tools/ShellDDNS.sh
|
||||
${CRASHDIR}/start.sh get_bin ${TMPDIR}/ShellDDNS.sh tools/ShellDDNS.sh
|
||||
if [ "$?" = "0" ];then
|
||||
mv -f ${TMPDIR}/ShellDDNS.sh ${CRASHDIR}/tools/ShellDDNS.sh
|
||||
source ${CRASHDIR}/tools/ShellDDNS.sh
|
||||
|
@ -1708,10 +1707,9 @@ tools(){
|
|||
sleep 1
|
||||
read -p "我已知晓,出现问题会自行承担!(1/0) > " res
|
||||
if [ "$res" = 1 ];then
|
||||
tunfixlink="${update_url}/bin/fix/tun.ko"
|
||||
echo -----------------------------------------------
|
||||
echo 正在连接服务器获取Tun模块补丁文件…………
|
||||
${CRASHDIR}/start.sh webget ${TMPDIR}/tun.ko $tunfixlink
|
||||
${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 && \
|
||||
|
|
|
@ -138,6 +138,20 @@ put_save(){ #推送面板选择
|
|||
wget -q --method=PUT --header="Authorization: Bearer ${secret}" --header="Content-Type:application/json" --body-data="$2" "$1" >/dev/null
|
||||
fi
|
||||
}
|
||||
get_bin(){ #专用于项目内部文件的下载
|
||||
source ${CRASHDIR}/configs/ShellCrash.cfg >/dev/null
|
||||
[ -z "$update_url" ] && update_url=https://fastly.jsdelivr.net/gh/juewuy/ShellCrash@master
|
||||
if [ -n "$url_id" ];then
|
||||
if [ "$url_id" = 101 ];then
|
||||
url="$(grep "$url_id" ${CRASHDIR}/configs/servers.list | awk '{print $3}')@$release_type/$2" #jsdelivr特殊处理
|
||||
else
|
||||
url="$(grep "$url_id" ${CRASHDIR}/configs/servers.list | awk '{print $3}')/$release_type/$2"
|
||||
fi
|
||||
else
|
||||
url="$update_url/$2"
|
||||
fi
|
||||
$0 webget "$1" "$url" "$3" "$4" "$5" "$6"
|
||||
}
|
||||
mark_time(){ #时间戳
|
||||
echo `date +%s` > ${TMPDIR}/crash_start_time
|
||||
}
|
||||
|
@ -586,14 +600,14 @@ EOF
|
|||
"final": "$direct_dns",
|
||||
"independent_cache": true,
|
||||
"reverse_mapping": true,
|
||||
"fakeip": { "enabled": true, "inet4_range": "198.18.0.0/15" }
|
||||
"fakeip": { "enabled": true, "inet4_range": "198.18.0.0/15", "inet6_range": "fc00::/18" }
|
||||
},
|
||||
EOF
|
||||
}
|
||||
#生成ntp.json
|
||||
cat > ${TMPDIR}/ntp.json <<EOF
|
||||
"ntp": {
|
||||
"enabled": false,
|
||||
"enabled": true,
|
||||
"server": "time.apple.com",
|
||||
"server_port": 123,
|
||||
"interval": "30m0s",
|
||||
|
@ -719,7 +733,7 @@ cn_ip_route(){ #CN-IP绕过
|
|||
mv ${CRASHDIR}/cn_ip.txt ${BINDIR}/cn_ip.txt
|
||||
else
|
||||
logger "未找到cn_ip列表,正在下载!" 33
|
||||
$0 webget ${BINDIR}/cn_ip.txt "$update_url/bin/geodata/china_ip_list.txt"
|
||||
get_bin ${BINDIR}/cn_ip.txt "bin/geodata/china_ip_list.txt"
|
||||
[ "$?" = "1" ] && rm -rf ${BINDIR}/cn_ip.txt && logger "列表下载失败!" 31
|
||||
fi
|
||||
}
|
||||
|
@ -738,7 +752,7 @@ cn_ipv6_route(){ #CN-IPV6绕过
|
|||
mv ${CRASHDIR}/cn_ipv6.txt ${BINDIR}/cn_ipv6.txt
|
||||
else
|
||||
logger "未找到cn_ipv6列表,正在下载!" 33
|
||||
$0 webget ${BINDIR}/cn_ipv6.txt "$update_url/bin/geodata/china_ipv6_list.txt"
|
||||
get_bin ${BINDIR}/cn_ipv6.txt "bin/geodata/china_ipv6_list.txt"
|
||||
[ "$?" = "1" ] && rm -rf ${BINDIR}/cn_ipv6.txt && logger "列表下载失败!" 31
|
||||
fi
|
||||
}
|
||||
|
@ -1383,7 +1397,7 @@ core_check(){
|
|||
logger "未找到【$crashcore】核心,正在下载!" 33
|
||||
[ -z "$cpucore" ] && source ${CRASHDIR}/getdate.sh && getcpucore
|
||||
[ -z "$cpucore" ] && logger 找不到设备的CPU信息,请手动指定处理器架构类型! 31 && exit 1
|
||||
$0 webget ${BINDIR}/core.new "$update_url/bin/$crashcore/clash-linux-$cpucore"
|
||||
get_bin ${BINDIR}/core.new "bin/$crashcore/clash-linux-$cpucore"
|
||||
#校验内核
|
||||
chmod +x ${BINDIR}/core.new 2>/dev/null
|
||||
if [ "$crashcore" = singbox ];then
|
||||
|
@ -1431,7 +1445,7 @@ clash_check(){ #clash启动前检查
|
|||
mv ${CRASHDIR}/Country.mmdb ${BINDIR}/Country.mmdb
|
||||
else
|
||||
logger "未找到GeoIP数据库,正在下载!" 33
|
||||
$0 webget ${BINDIR}/Country.mmdb $update_url/bin/geodata/cn_mini.mmdb
|
||||
get_bin ${BINDIR}/Country.mmdb bin/geodata/cn_mini.mmdb
|
||||
[ "$?" = "1" ] && rm -rf ${BINDIR}/Country.mmdb && logger "数据库下载失败,已退出,请前往更新界面尝试手动下载!" 31 && exit 1
|
||||
Geo_v=$(date +"%Y%m%d")
|
||||
setconfig Geo_v $Geo_v
|
||||
|
@ -1443,7 +1457,7 @@ clash_check(){ #clash启动前检查
|
|||
mv -f ${CRASHDIR}/GeoSite.dat ${BINDIR}/GeoSite.dat
|
||||
else
|
||||
logger "未找到GeoSite数据库,正在下载!" 33
|
||||
$0 webget ${BINDIR}/GeoSite.dat $update_url/bin/geodata/geosite.dat
|
||||
get_bin ${BINDIR}/GeoSite.dat bin/geodata/geosite.dat
|
||||
[ "$?" = "1" ] && rm -rf ${BINDIR}/GeoSite.dat && logger "数据库下载失败,已退出,请前往更新界面尝试手动下载!" 31 && exit 1
|
||||
fi
|
||||
fi
|
||||
|
@ -1456,7 +1470,7 @@ singbox_check(){ #singbox启动前检查
|
|||
mv ${CRASHDIR}/geoip.db ${BINDIR}/geoip.db
|
||||
else
|
||||
logger "未找到GeoIP数据库,正在下载!" 33
|
||||
$0 webget ${BINDIR}/geoip.db $update_url/bin/geodata/geoip_cn.db
|
||||
get_bin ${BINDIR}/geoip.db bin/geodata/geoip_cn.db
|
||||
[ "$?" = "1" ] && rm -rf ${BINDIR}/geoip.db && logger "数据库下载失败,已退出,请前往更新界面尝试手动下载!" 31 && exit 1
|
||||
Geo_v=$(date +"%Y%m%d")
|
||||
setconfig Geo_v $Geo_v
|
||||
|
@ -1468,7 +1482,7 @@ singbox_check(){ #singbox启动前检查
|
|||
mv -f ${CRASHDIR}/geosite.db ${BINDIR}/geosite.db
|
||||
else
|
||||
logger "未找到GeoSite数据库,正在下载!" 33
|
||||
$0 webget ${BINDIR}/geosite.db $update_url/bin/geodata/geosite_cn.db
|
||||
get_bin ${BINDIR}/geosite.db bin/geodata/geosite_cn.db
|
||||
[ "$?" = "1" ] && rm -rf ${BINDIR}/geosite.db && logger "数据库下载失败,已退出,请前往更新界面尝试手动下载!" 31 && exit 1
|
||||
Geo_v=$(date +"%Y%m%d")
|
||||
setconfig Geo_v $Geo_v
|
||||
|
@ -1499,7 +1513,7 @@ bfstart(){ #启动前
|
|||
[ ! -s ${BINDIR}/ui/index.html ] && makehtml #如没有面板则创建跳转界面
|
||||
catpac #生成pac文件
|
||||
#内核及内核配置文件检查
|
||||
[ ! -x ${BINDIR}/CrashCore ] && chmod +x ${BINDIR}/CrashCore #检测可执行权限
|
||||
[ ! -x ${BINDIR}/CrashCore ] && chmod +x ${BINDIR}/CrashCore 2>/dev/null #检测可执行权限
|
||||
if [ "$crashcore" = singbox ];then
|
||||
singbox_check
|
||||
[ "$disoverride" != "1" ] && modify_json || ln -sf $core_config ${TMPDIR}/config.json
|
||||
|
@ -1617,7 +1631,7 @@ start_old(){ #保守模式
|
|||
#使用传统后台执行二进制文件的方式执行
|
||||
if [ "$local_proxy" = "已开启" -a -n "$(echo $local_type | grep '增强模式')" ];then
|
||||
if ckcmd su;then
|
||||
su shellcrash -c "$COMMAND" >/dev/null &
|
||||
su shellcrash -c "$COMMAND &>/dev/null" &
|
||||
else
|
||||
logger "当前设备缺少su命令,保守模式下无法兼容本机代理增强模式,已停止启动!" 31
|
||||
exit 1
|
||||
|
|
|
@ -19,7 +19,7 @@ ckcmd(){ #检查命令是否存在
|
|||
|
||||
#任务命令
|
||||
check_update(){ #检查更新工具
|
||||
${CRASHDIR}/start.sh webget ${TMPDIR}/crashversion "$update_url/bin/version" echooff
|
||||
${CRASHDIR}/start.sh get_bin ${TMPDIR}/crashversion "bin/version" echooff
|
||||
[ "$?" = "0" ] && source ${TMPDIR}/crashversion 2>/dev/null
|
||||
rm -rf ${TMPDIR}/crashversion
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ update_core(){ #自动更新内核
|
|||
else
|
||||
#更新内核
|
||||
[ "$crashcore" = singbox ] && core_new=singbox || core_new=clash
|
||||
${CRASHDIR}/start.sh webget ${TMPDIR}/core.new "${update_url}/bin/${crashcore}/${core_new}-linux-${cpucore}"
|
||||
${CRASHDIR}/start.sh get_bin ${TMPDIR}/core.new "bin/${crashcore}/${core_new}-linux-${cpucore}"
|
||||
if [ "$?" != "0" ];then
|
||||
logger "任务【自动更新内核】出错-下载失败!"
|
||||
rm -rf ${TMPDIR}/core.new
|
||||
|
@ -68,7 +68,7 @@ update_shellcrash(){ #自动更新脚本
|
|||
logger "任务【自动更新脚本】中止-未检测到版本更新"
|
||||
exit 1
|
||||
else
|
||||
${CRASHDIR}/start.sh webget ${TMPDIR}/update.tar.gz "$update_url/bin/update.tar.gz"
|
||||
${CRASHDIR}/start.sh get_bin ${TMPDIR}/update.tar.gz "bin/update.tar.gz"
|
||||
if [ "$?" != "0" ];then
|
||||
rm -rf ${TMPDIR}/update.tar.gz
|
||||
logger "任务【自动更新内核】出错-下载失败!"
|
||||
|
@ -98,7 +98,7 @@ update_mmdb(){ #自动更新数据库
|
|||
logger "任务【自动更新数据库文件】跳过-未检测到$2版本更新"
|
||||
else
|
||||
#更新文件
|
||||
${CRASHDIR}/start.sh webget ${TMPDIR}/$1 "$update_url/bin/geodata/$2"
|
||||
${CRASHDIR}/start.sh get_bin ${TMPDIR}/$1 "bin/geodata/$2"
|
||||
if [ "$?" != "0" ];then
|
||||
logger "任务【自动更新数据库文件】更新【$2】下载失败!"
|
||||
rm -rf ${TMPDIR}/$1
|
||||
|
|
Loading…
Reference in New Issue
Block a user