diff --git a/661.sh b/661.sh index 3786107..96f8356 100644 --- a/661.sh +++ b/661.sh @@ -149,6 +149,101 @@ uncf(){ rm -rf /root/CFwarp.sh nf /usr/bin/cf } +ShowSOCKS5(){ +if [[ $(systemctl is-active warp-svc) = active ]]; then +mport=`warp-cli --accept-tos settings 2>/dev/null | grep 'WarpProxy on port' | awk -F "port " '{print $2}'` +s5ip=`curl -sx socks5h://localhost:$mport ip.sb -k` +NF=$(./nf -proxy socks5h://localhost:$mport | awk '{print $1}' | sed -n '3p') +[[ $(curl -sx socks5h://localhost:$mport https://chat.openai.com/ -I | grep "text/plain") != "" ]] && chat='遗憾,无法访问Chatgpt官网服务' || chat='恭喜,支持访问Chatgpt官网服务' +isp4a=`curl -sx socks5h://localhost:$mport --user-agent "${UA_Browser}" http://ip-api.com/json/$v4?lang=zh-CN -k | cut -f13 -d ":" | cut -f2 -d '"'` +isp4b=`curl -sx socks5h://localhost:$mport --user-agent "${UA_Browser}" https://api.ip.sb/geoip/$v4 -k | awk -F "isp" '{print $2}' | awk -F "offset" '{print $1}' | sed "s/[,\":]//g"` +[[ -n $isp4a ]] && isp4=$isp4a || isp4=$isp4b +nonf=$(curl -sx socks5h://localhost:$mport --user-agent "${UA_Browser}" http://ip-api.com/json/$v4?lang=zh-CN -k | cut -f2 -d"," | cut -f4 -d '"') +sunf=$(./nf | awk '{print $1}' | sed -n '4p') +snnf=$(curl -sx socks5h://localhost:$mport ip.p3terx.com -k | sed -n 2p | awk '{print $3}') +if [[ -n $sunf ]]; then +country=$sunf +elif [[ -z $sunf && -n $nonf ]]; then +country=$nonf +else +country=$snnf +fi +socks5=$(curl -sx socks5h://localhost:$mport www.cloudflare.com/cdn-cgi/trace -k --connect-timeout 2 | grep warp | cut -d= -f2) +case ${socks5} in +plus) +S5Status=$(white "Socks5 WARP+状态:\c" ; rred "运行中,WARP+普通账户(剩余WARP+流量:$((`warp-cli --accept-tos account | grep Quota | awk '{ print $(NF) }'`/1000000000))GiB)" ; white " Socks5 端口:\c" ; rred "$mport" ; white " 服务商 Cloudflare 获取IPV4地址:\c" ; rred "$s5ip $country" ; white " 奈飞NF解锁情况:\c" ; rred "$NF" ; white " Chatgpt支持情况:\c" ; rred "$chat");; +on) +S5Status=$(white "Socks5 WARP状态:\c" ; green "运行中,WARP普通账户(无限WARP流量)" ; white " Socks5 端口:\c" ; green "$mport" ; white " 服务商 Cloudflare 获取IPV4地址:\c" ; green "$s5ip $country" ; white " 奈飞NF解锁情况:\c" ; green "$NF" ; white " Chatgpt支持情况:\c" ; green "$chat");; +*) +S5Status=$(white "Socks5 WARP状态:\c" ; yellow "已安装Socks5-WARP客户端,但端口处于关闭状态") +esac +else +S5Status=$(white "Socks5 WARP状态:\c" ; red "未安装Socks5-WARP客户端") +fi +} + +SOCKS5ins(){ +yellow "检测Socks5-WARP安装环境中……" +if [[ $release = Centos ]]; then +[[ ! ${vsid} =~ 8 ]] && yellow "当前系统版本号:Centos $vsid \nSocks5-WARP仅支持Centos 8 " && bash CFwarp.sh +elif [[ $release = Ubuntu ]]; then +[[ ! ${vsid} =~ 16|18|20|22 ]] && yellow "当前系统版本号:Ubuntu $vsid \nSocks5-WARP仅支持 Ubuntu 16.04/18.04/20.04/22.04系统 " && bash CFwarp.sh +elif [[ $release = Debian ]]; then +[[ ! ${vsid} =~ 9|10|11 ]] && yellow "当前系统版本号:Debian $vsid \nSocks5-WARP仅支持 Debian 9/10/11系统 " && bash CFwarp.sh +fi +[[ $(warp-cli --accept-tos status 2>/dev/null) =~ 'Connected' ]] && red "当前Socks5-WARP已经在运行中" && bash CFwarp.sh + +systemctl stop wg-quick@wgcf >/dev/null 2>&1 +v4v6 +if [[ -n $v6 && -z $v4 ]]; then +systemctl start wg-quick@wgcf >/dev/null 2>&1 +red "纯IPV6的VPS目前不支持安装Socks5-WARP" && bash CFwarp.sh +elif [[ -n $v4 && -z $v6 ]]; then +systemctl start wg-quick@wgcf >/dev/null 2>&1 +checkwgcf +[[ $wgcfv4 =~ on|plus ]] && red "纯IPV4的VPS已安装Wgcf-WARP-IPV4,不支持安装Socks5-WARP" && bash CFwarp.sh +elif [[ -n $v4 && -n $v6 ]]; then +systemctl start wg-quick@wgcf >/dev/null 2>&1 +checkwgcf +[[ $wgcfv4 =~ on|plus || $wgcfv6 =~ on|plus ]] && red "原生双栈VPS已安装Wgcf-WARP-IPV4/IPV6,请先卸载。然后安装Socks5-WARP,最后安装Wgcf-WARP-IPV4/IPV6" && bash CFwarp.sh +fi +systemctl start wg-quick@wgcf >/dev/null 2>&1 +checkwgcf +if [[ $wgcfv4 =~ on|plus && $wgcfv6 =~ on|plus ]]; then +red "已安装Wgcf-WARP-IPV4+IPV6,不支持安装Socks5-WARP" && bash CFwarp.sh +fi +if [[ $release = Centos ]]; then +if [[ ${vsid} =~ 8 ]]; then +cd /etc/yum.repos.d/ && mkdir backup && mv *repo backup/ +curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-8.repo +sed -i -e "s|mirrors.cloud.aliyuncs.com|mirrors.aliyun.com|g " /etc/yum.repos.d/CentOS-* +sed -i -e "s|releasever|releasever-stream|g" /etc/yum.repos.d/CentOS-* +yum clean all && yum makecache +fi +yum -y install epel-release && yum -y install net-tools +rpm -ivh https://pkg.cloudflareclient.com/cloudflare-release-el8.rpm +yum -y install cloudflare-warp +fi +if [[ $release = Debian ]]; then +[[ ! $(type -P gpg) ]] && apt update && apt install gnupg -y +[[ ! $(apt list 2>/dev/null | grep apt-transport-https | grep installed) ]] && apt update && apt install apt-transport-https -y +fi +if [[ $release != Centos ]]; then +apt install net-tools -y +curl https://pkg.cloudflareclient.com/pubkey.gpg | gpg --yes --dearmor --output /usr/share/keyrings/cloudflare-warp-archive-keyring.gpg +echo "deb [arch=amd64 signed-by=/usr/share/keyrings/cloudflare-warp-archive-keyring.gpg] http://pkg.cloudflareclient.com/ $(lsb_release -sc) main" | tee /etc/apt/sources.list.d/cloudflare-client.list +apt update;apt install cloudflare-warp -y +fi +warp-cli --accept-tos register >/dev/null 2>&1 && sleep 2 +warp-cli --accept-tos set-mode proxy >/dev/null 2>&1 +warp-cli --accept-tos enable-always-on >/dev/null 2>&1 +sleep 2 && ShowSOCKS5 +S5menu +} + + + + ONEWARPGO(){ STOPwgcf(){ if [[ -n $(type -P warp-cli) ]]; then @@ -538,6 +633,13 @@ white " 当前 IPV6 接管出站流量情况如下" white " ${WARPIPv6Status}" white "------------------------------------------------------------------------------------" } +S5menu(){ +white "------------------------------------------------------------------------------------------------" +white " 当前Socks5-WARP客户端本地代理127.0.0.1情况如下" +blue " ${S5Status}" +white "------------------------------------------------------------------------------------------------" +} + back(){ white "------------------------------------------------------------------------------------" white " 回主菜单,请按任意键" @@ -546,7 +648,7 @@ get_char && bash CFwarp.sh } IP_Status_menu(){ -WGCFmenu +WGCFmenu;S5menu } warprefresh(){ @@ -755,7 +857,7 @@ echo } start_menu(){ -ShowWGCF +ShowWGCF;ShowSOCKS5 clear green "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" echo -e "${bblue} ░██ ░██ ░██ ██ ██ ░█${plain}█ ░██ ░██ ░██ ░█${red}█ ░██${plain} " @@ -1392,100 +1494,6 @@ changewarp(){ WARPun && ONEWARPGO } -ShowSOCKS5(){ -if [[ $(systemctl is-active warp-svc) = active ]]; then -mport=`warp-cli --accept-tos settings 2>/dev/null | grep 'WarpProxy on port' | awk -F "port " '{print $2}'` -s5ip=`curl -sx socks5h://localhost:$mport ip.sb -k` -NF=$(./nf -proxy socks5h://localhost:$mport | awk '{print $1}' | sed -n '3p') -[[ $(curl -sx socks5h://localhost:$mport https://chat.openai.com/ -I | grep "text/plain") != "" ]] && chat='遗憾,无法访问Chatgpt官网服务' || chat='恭喜,支持访问Chatgpt官网服务' -isp4a=`curl -sx socks5h://localhost:$mport --user-agent "${UA_Browser}" http://ip-api.com/json/$v4?lang=zh-CN -k | cut -f13 -d ":" | cut -f2 -d '"'` -isp4b=`curl -sx socks5h://localhost:$mport --user-agent "${UA_Browser}" https://api.ip.sb/geoip/$v4 -k | awk -F "isp" '{print $2}' | awk -F "offset" '{print $1}' | sed "s/[,\":]//g"` -[[ -n $isp4a ]] && isp4=$isp4a || isp4=$isp4b -nonf=$(curl -sx socks5h://localhost:$mport --user-agent "${UA_Browser}" http://ip-api.com/json/$v4?lang=zh-CN -k | cut -f2 -d"," | cut -f4 -d '"') -sunf=$(./nf | awk '{print $1}' | sed -n '4p') -snnf=$(curl -sx socks5h://localhost:$mport ip.p3terx.com -k | sed -n 2p | awk '{print $3}') -if [[ -n $sunf ]]; then -country=$sunf -elif [[ -z $sunf && -n $nonf ]]; then -country=$nonf -else -country=$snnf -fi -socks5=$(curl -sx socks5h://localhost:$mport www.cloudflare.com/cdn-cgi/trace -k --connect-timeout 2 | grep warp | cut -d= -f2) -case ${socks5} in -plus) -S5Status=$(white "Socks5 WARP+状态:\c" ; rred "运行中,WARP+普通账户(剩余WARP+流量:$((`warp-cli --accept-tos account | grep Quota | awk '{ print $(NF) }'`/1000000000))GiB)" ; white " Socks5 端口:\c" ; rred "$mport" ; white " 服务商 Cloudflare 获取IPV4地址:\c" ; rred "$s5ip $country" ; white " 奈飞NF解锁情况:\c" ; rred "$NF" ; white " Chatgpt支持情况:\c" ; rred "$chat");; -on) -S5Status=$(white "Socks5 WARP状态:\c" ; green "运行中,WARP普通账户(无限WARP流量)" ; white " Socks5 端口:\c" ; green "$mport" ; white " 服务商 Cloudflare 获取IPV4地址:\c" ; green "$s5ip $country" ; white " 奈飞NF解锁情况:\c" ; green "$NF" ; white " Chatgpt支持情况:\c" ; green "$chat");; -*) -S5Status=$(white "Socks5 WARP状态:\c" ; yellow "已安装Socks5-WARP客户端,但端口处于关闭状态") -esac -else -S5Status=$(white "Socks5 WARP状态:\c" ; red "未安装Socks5-WARP客户端") -fi -} - -SOCKS5ins(){ -yellow "检测Socks5-WARP安装环境中……" -if [[ $release = Centos ]]; then -[[ ! ${vsid} =~ 8 ]] && yellow "当前系统版本号:Centos $vsid \nSocks5-WARP仅支持Centos 8 " && bash CFwarp.sh -elif [[ $release = Ubuntu ]]; then -[[ ! ${vsid} =~ 16|18|20|22 ]] && yellow "当前系统版本号:Ubuntu $vsid \nSocks5-WARP仅支持 Ubuntu 16.04/18.04/20.04/22.04系统 " && bash CFwarp.sh -elif [[ $release = Debian ]]; then -[[ ! ${vsid} =~ 9|10|11 ]] && yellow "当前系统版本号:Debian $vsid \nSocks5-WARP仅支持 Debian 9/10/11系统 " && bash CFwarp.sh -fi -[[ $(warp-cli --accept-tos status 2>/dev/null) =~ 'Connected' ]] && red "当前Socks5-WARP已经在运行中" && bash CFwarp.sh - -systemctl stop wg-quick@wgcf >/dev/null 2>&1 -v4v6 -if [[ -n $v6 && -z $v4 ]]; then -systemctl start wg-quick@wgcf >/dev/null 2>&1 -red "纯IPV6的VPS目前不支持安装Socks5-WARP" && bash CFwarp.sh -elif [[ -n $v4 && -z $v6 ]]; then -systemctl start wg-quick@wgcf >/dev/null 2>&1 -checkwgcf -[[ $wgcfv4 =~ on|plus ]] && red "纯IPV4的VPS已安装Wgcf-WARP-IPV4,不支持安装Socks5-WARP" && bash CFwarp.sh -elif [[ -n $v4 && -n $v6 ]]; then -systemctl start wg-quick@wgcf >/dev/null 2>&1 -checkwgcf -[[ $wgcfv4 =~ on|plus || $wgcfv6 =~ on|plus ]] && red "原生双栈VPS已安装Wgcf-WARP-IPV4/IPV6,请先卸载。然后安装Socks5-WARP,最后安装Wgcf-WARP-IPV4/IPV6" && bash CFwarp.sh -fi -systemctl start wg-quick@wgcf >/dev/null 2>&1 -checkwgcf -if [[ $wgcfv4 =~ on|plus && $wgcfv6 =~ on|plus ]]; then -red "已安装Wgcf-WARP-IPV4+IPV6,不支持安装Socks5-WARP" && bash CFwarp.sh -fi - -if [[ $release = Centos ]]; then -if [[ ${vsid} =~ 8 ]]; then -cd /etc/yum.repos.d/ && mkdir backup && mv *repo backup/ -curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-8.repo -sed -i -e "s|mirrors.cloud.aliyuncs.com|mirrors.aliyun.com|g " /etc/yum.repos.d/CentOS-* -sed -i -e "s|releasever|releasever-stream|g" /etc/yum.repos.d/CentOS-* -yum clean all && yum makecache -fi -yum -y install epel-release && yum -y install net-tools -rpm -ivh https://pkg.cloudflareclient.com/cloudflare-release-el8.rpm -yum -y install cloudflare-warp -fi -if [[ $release = Debian ]]; then -[[ ! $(type -P gpg) ]] && apt update && apt install gnupg -y -[[ ! $(apt list 2>/dev/null | grep apt-transport-https | grep installed) ]] && apt update && apt install apt-transport-https -y -fi -if [[ $release != Centos ]]; then -apt install net-tools -y -curl https://pkg.cloudflareclient.com/pubkey.gpg | gpg --yes --dearmor --output /usr/share/keyrings/cloudflare-warp-archive-keyring.gpg -echo "deb [arch=amd64 signed-by=/usr/share/keyrings/cloudflare-warp-archive-keyring.gpg] http://pkg.cloudflareclient.com/ $(lsb_release -sc) main" | tee /etc/apt/sources.list.d/cloudflare-client.list -apt update;apt install cloudflare-warp -y -fi -warp-cli --accept-tos register >/dev/null 2>&1 && sleep 2 -warp-cli --accept-tos set-mode proxy >/dev/null 2>&1 -warp-cli --accept-tos enable-always-on >/dev/null 2>&1 -sleep 2 && ShowSOCKS5 -S5menu -} - - start_menu(){ ShowWGCF;ShowSOCKS5 clear @@ -1588,9 +1596,9 @@ esac } if [ $# == 0 ]; then start -if [[ -n $(type -P warp-go) ]] && [[ -f '/root/CFwarp.sh' ]]; then +if [[ $(type -P warp-go) || $(type -P warp-cli) ]] && [[ -f '/root/661.sh' ]]; then ONEWARPGO -elif [[ $(type -P wg-quick) || $(type -P warp-cli) ]] && [[ -f '/root/CFwarp.sh' ]]; then +elif [[ $(type -P wg-quick) || $(type -P warp-cli) ]] && [[ -f '/root/661.sh' ]]; then ONEWGCFWARP else startCFwarp