From 36585243a1b9d97bca775fea7e7e95950aa2984a Mon Sep 17 00:00:00 2001 From: fscarmen <62703343+fscarmen@users.noreply.github.com> Date: Thu, 22 Jun 2023 14:19:36 +0800 Subject: [PATCH] Update CFwarp.sh --- CFwarp.sh | 73 ++++++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 59 insertions(+), 14 deletions(-) diff --git a/CFwarp.sh b/CFwarp.sh index ca6e621..2cf4c73 100644 --- a/CFwarp.sh +++ b/CFwarp.sh @@ -452,8 +452,7 @@ first4(){ } docker(){ if [[ -n $(ip a | grep docker) ]]; then -red "检测到VPS已安装docker,如继续安装方案一的WARP,docker就会失效" -red "为避免docker失效,建议使用方案二或者方案三" && sleep 3s +red "检测到VPS已安装docker,请确保docker为host运行模式,否则docker就会失效" && sleep 3s echo yellow "6秒后继续安装方案一的WARP,退出安装请按Ctrl+c" && sleep 6s fi @@ -506,8 +505,12 @@ green "1. 实时查看WARP在线监测情况(进入前请注意:退出且继 green "2. 重启WARP在线监测功能" green "3. 重置并自定义WARP在线监测时间间隔" green "4. 查看当天WARP在线监测日志" -green "5. 刷warp+流量" -green "6. 更改Socks5+WARP端口" +echo "-----------------------------------------------" +green "5. 更改Socks5+WARP端口" +echo "-----------------------------------------------" +green "6. 用自备的warp密钥,慢慢刷warp+流量" +green "7. 一键生成2000多万GB流量的warp+密钥" +echo "-----------------------------------------------" green "0. 退出" readp "请选择:" warptools if [[ $warptools == 1 ]]; then @@ -536,15 +539,21 @@ elif [[ $warptools == 4 ]]; then [[ -z $(type -P warp-go) && -z $(type -P wg-quick) ]] && red "未安装方案一,脚本退出" && exit cat /root/warpip/warp_log.txt # find /root/warpip/warp_log.txt -mtime -1 -exec cat {} \; -elif [[ $warptools == 5 ]]; then +elif [[ $warptools == 6 ]]; then green "也可以在线网页端刷:https://replit.com/@ygkkkk/Warp" && sleep 2 wget -N https://gitlab.com/rwkgyg/CFwarp/raw/main/wp-plus.py sed -i "27 s/[(][^)]*[)]//g" wp-plus.py readp "客户端配置ID(36个字符):" ID sed -i "27 s/input/'$ID'/" wp-plus.py python3 wp-plus.py -elif [[ $warptools == 6 ]]; then +elif [[ $warptools == 5 ]]; then SOCKS5WARPPORT +elif [[ $warptools == 7 ]]; then +wppluskey && rm -rf warpplus.sh +green "当前脚本累计已生成的warp+密钥已放置在/root/WARP+Keys.txt文件内" +green "每重新执行一次的新密钥将放置在文件末尾(包括方案一与方案二)" +blue "$(cat /root/WARP+Keys.txt)" +echo else cf fi @@ -580,7 +589,7 @@ if [[ $release = Centos ]]; then elif [[ $release = Ubuntu ]]; then [[ ! ${vsid} =~ 20|22 ]] && yellow "当前系统版本号:Ubuntu $vsid \nSocks5-WARP仅支持 Ubuntu 20.04/22.04系统 " && exit elif [[ $release = Debian ]]; then -[[ ! ${vsid} =~ 10|11 ]] && yellow "当前系统版本号:Debian $vsid \nSocks5-WARP仅支持 Debian 10/11系统 " && exit +[[ ! ${vsid} =~ 10|11|12 ]] && yellow "当前系统版本号:Debian $vsid \nSocks5-WARP仅支持 Debian 10/11/12系统 " && exit fi [[ $(warp-cli --accept-tos status 2>/dev/null) =~ 'Connected' ]] && red "当前Socks5-WARP已经在运行中" && cf systemctl stop wg-quick@wgcf >/dev/null 2>&1 @@ -612,7 +621,9 @@ if [[ ${vsid} =~ 8 ]]; then 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 +curl -fsSl https://pkg.cloudflareclient.com/cloudflare-warp-ascii.repo | tee /etc/yum.repos.d/cloudflare-warp.repo +yum update +#rpm -ivh https://pkg.cloudflareclient.com/cloudflare-release-el8.rpm yum -y install cloudflare-warp fi if [[ $release = Debian ]]; then @@ -629,13 +640,24 @@ warpip 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 set-custom-endpoint "$endpoint" >/dev/null 2>&1 +warp-cli --accept-tos connect >/dev/null 2>&1 warp-cli --accept-tos enable-always-on >/dev/null 2>&1 -sleep 2 && ShowSOCKS5 && S5menu && lncf && reswarp +wppluskey >/dev/null 2>&1 +ID=$(tail -n1 /root/WARP+Keys.txt | cut -d' ' -f1 2>/dev/null) +if [[ -n $ID ]]; then +green "使用warp+密钥" +green "$(tail -n1 /root/WARP+Keys.txt | cut -d' ' -f1)" +warp-cli --accept-tos set-license $ID >/dev/null 2>&1 +fi +rm -rf warpplus.sh +if [[ $(warp-cli --accept-tos account) =~ 'Limited' ]]; then +green "已升级为Socks5-WARP+账户\nSocks5-WARP+账户剩余流量:$((`warp-cli --accept-tos account | grep Quota | awk '{ print $(NF) }'`/1000000000)) GB" +fi +sleep 2 && lncf && reswarp && cf } SOCKS5WARPUP(){ [[ ! $(type -P warp-cli) ]] && red "未安装Socks5-WARP,无法升级到Socks5-WARP+账户" && exit [[ $(warp-cli --accept-tos account) =~ 'Limited' ]] && red "当前已是Socks5-WARP+账户,无须再升级" && exit -mkdir -p /etc/wireguard/ >/dev/null 2>&1 readp "按键许可证秘钥(26个字符):" ID [[ -n $ID ]] && warp-cli --accept-tos set-license $ID >/dev/null 2>&1 || (red "未输入按键许可证秘钥(26个字符)" && exit) yellow "如提示Error: Too many devices.可能绑定设备已超过5台的限制或者密钥输入错误" @@ -702,6 +724,15 @@ sed -i '/warp_log.txt/d' /tmp/crontab.tmp crontab /tmp/crontab.tmp rm /tmp/crontab.tmp } +wppluskey(){ +if [[ $cpu = amd64 ]]; then +curl -sSL -o warpplus.sh --insecure https://gitlab.com/rwkgyg/CFwarp/-/raw/main/point/warpplus.sh >/dev/null 2>&1 +elif [[ $cpu = arm64 ]]; then +curl -sSL -o warpplus.sh --insecure https://gitlab.com/rwkgyg/CFwarp/-/raw/main/point/warpplusa.sh >/dev/null 2>&1 +fi +chmod +x warpplus.sh +./warpplus.sh +} ONEWARPGO(){ yellow "\n 请稍等,当前为warp-go核心安装模式,检测出站及解锁情况……" warpip @@ -1224,7 +1255,7 @@ start_menu(){ ShowWGCF;ShowSOCKS5 clear green "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" -echo -e "${bblue} ░██ ░██ ░██ ██ ██ ░█${plain}█ ░██ ░██ ���██ ░█${red}█ ░██${plain} " +echo -e "${bblue} ░██ ░██ ░██ ██ ██ ░█${plain}█ ░██ ░██ ░██ ░█${red}█ ░██${plain} " echo -e "${bblue} ░██ ░██ ░██ ░░██${plain} ░██ ░██ ░██ ░██${red} ░██ ░██${plain} " echo -e "${bblue} ░██ ░██ ░██ ${plain} ░██ ██ ░██ █${red}█ ░██ ██ ${plain} " echo -e "${bblue} ░██ ░${plain}██ ░██ ██ ░██ ██ ░█${red}█ ██ ░██ ██ ${plain} " @@ -1545,9 +1576,9 @@ yum install epel-release -y;yum install iproute iptables wireguard-tools -y elif [[ $release = Debian ]]; then apt install lsb-release -y echo "deb http://deb.debian.org/debian $(lsb_release -sc)-backports main" | tee /etc/apt/sources.list.d/backports.list -apt update -y;apt install iproute2 openresolv dnsutils iptables -y;apt install wireguard-tools --no-install-recommends -y +apt update -y;apt install iproute2 openresolv dnsutils iptables iputils-ping -y;apt install wireguard-tools --no-install-recommends -y elif [[ $release = Ubuntu ]]; then -apt update -y;apt install iproute2 openresolv dnsutils iptables -y;apt install wireguard-tools --no-install-recommends -y +apt update -y;apt install iproute2 openresolv dnsutils iptables iputils-ping -y;apt install wireguard-tools --no-install-recommends -y fi wget -N https://gitlab.com/rwkgyg/cfwarp/raw/main/wgcf_2.2.18_$cpu -O /usr/local/bin/wgcf && chmod +x /usr/local/bin/wgcf if [[ $main -lt 5 || $minor -lt 6 ]] || [[ $vi =~ lxc|openvz ]]; then @@ -1561,6 +1592,7 @@ echo | wgcf register --accept-tos done wgcf generate mtuwarp +wppluskey >/dev/null 2>&1 sed -i "s/MTU.*/MTU = $MTU/g" wgcf-profile.conf cp -f wgcf-profile.conf /etc/wireguard/wgcf.conf >/dev/null 2>&1 cp -f wgcf-account.toml /etc/wireguard/buckup-account.toml >/dev/null 2>&1 @@ -1568,6 +1600,19 @@ cp -f wgcf-profile.conf /etc/wireguard/buckup-profile.conf >/dev/null 2>&1 ABC mv -f wgcf-profile.conf /etc/wireguard >/dev/null 2>&1 mv -f wgcf-account.toml /etc/wireguard >/dev/null 2>&1 +ID=$(tail -n1 /root/WARP+Keys.txt | cut -d' ' -f1 2>/dev/null) +if [[ -n $ID ]]; then +green "使用warp+密钥" +green "$(tail -n1 /root/WARP+Keys.txt | cut -d' ' -f1)" +sed -i "s/license_key.*/license_key = '$ID'/g" /etc/wireguard/wgcf-account.toml +sbmc=warp+$(date +%s%N |md5sum | cut -c 1-3) +SBID="--name $(echo $sbmc | sed s/[[:space:]]/_/g)" +rm -rf warpplus.sh +cd /etc/wireguard && wgcf update $SBID > /etc/wireguard/wgcf+p.log 2>&1 +wgcf generate && cd +sed -i "2s#.*#$(sed -ne 2p /etc/wireguard/wgcf-profile.conf)#;4s#.*#$(sed -ne 4p /etc/wireguard/wgcf-profile.conf)#" /etc/wireguard/wgcf.conf +sed -i "2s#.*#$(sed -ne 2p /etc/wireguard/wgcf-profile.conf)#;4s#.*#$(sed -ne 4p /etc/wireguard/wgcf-profile.conf)#" /etc/wireguard/buckup-profile.conf +fi systemctl enable wg-quick@wgcf cat /etc/wireguard/wgcf.conf && sleep 2 CheckWARP && ShowWGCF && lncf && reswarp @@ -1695,7 +1740,7 @@ $yumapt autoremove dig9 sed -i '/^precedence ::ffff:0:0\/96 100/d' /etc/gai.conf 2>/dev/null rm -rf /usr/local/bin/wgcf /usr/bin/wg-quick /etc/wireguard/wgcf.conf /etc/wireguard/wgcf-profile.conf /etc/wireguard/buckup-account.toml /etc/wireguard/wgcf-account.toml /etc/wireguard/wgcf+p.log /etc/wireguard/ID /usr/bin/wireguard-go /usr/bin/wgcf wgcf-account.toml wgcf-profile.conf /etc/wireguard/buckup-profile.conf /root/WARP-UP.sh -rm -rf /root/warpip +rm -rf /root/warpip /root/WARP+Keys.txt } warpinscha(){ yellow "提示:VPS的本地出站IP将被你选择的warp的IP所接管,如VPS本地无该出站IP,则被另外生成warp的IP所接管"