├── warp.exe ├── WIN端warp自选IP-v23.11.15.zip ├── version ├── ygkkkkeys.txt ├── README.md ├── english.md └── CFwarp.sh /warp.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yonggekkk/warp-yg/HEAD/warp.exe -------------------------------------------------------------------------------- /WIN端warp自选IP-v23.11.15.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yonggekkk/warp-yg/HEAD/WIN端warp自选IP-v23.11.15.zip -------------------------------------------------------------------------------- /version: -------------------------------------------------------------------------------- 1 | 24.3.22 v1.9.4 更新内容: 2 | 1:修正netflix的检测问题 3 | 详见:https://ygkkk.blogspot.com/2022/09/cfwarp-script.html 4 | -------------------------------------------------------------------------------- /ygkkkkeys.txt: -------------------------------------------------------------------------------- 1 | 95oBms28-7T5DK8o4-I7YG34i6 2 | R49D8i0Q-30Q8z1XO-L856j0ia 3 | tqL5964h-Q4his835-v6Ea9d73 4 | 27TN1uR6-6280OrQE-Vtw5D907 5 | Gf2rJ017-y469xnG7-32zCoe87 6 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ### 相关说明及注意点请查看[warp系列视频说明](https://www.youtube.com/playlist?list=PLMgly2AulGG-WqPXPkHlqWVSfQ3XjHNw8) [更新日志](https://ygkkk.blogspot.com/2022/09/cfwarp-script.html) 2 | 3 | ### 一、WARP多功能一键脚本,支持纯IPV4、纯IPV6的VPS直接安装,主流linux系统均支持 4 | ``` 5 | bash <(wget -qO- https://raw.githubusercontent.com/yonggekkk/warp-yg/main/CFwarp.sh) 6 | ``` 7 | 或者 8 | ``` 9 | bash <(curl -Ls https://raw.githubusercontent.com/yonggekkk/warp-yg/main/CFwarp.sh) 10 | ``` 11 | 12 | #### 千万要注意:如出现IP丢失、VPS运行卡顿、脚本运行下载失败、无法进入脚本界面等现象,请用以下命令终止warp,再重启或者重装warp 13 | 14 | 1、终止warp-go: 15 | ```kill -15 $(pgrep warp-go)``` 16 | 17 | 2、终止wgcf: 18 | ```systemctl stop wg-quick@wgcf``` 19 | 20 | 21 | --------------------------------------------------------------------- 22 | 23 | ### 二、多平台优选WARP对端IP + 无限生成WARP-Wireguard配置 一键脚本,建议苹果手机与安卓手机在本地网络使用 24 | ``` 25 | curl -sSL https://gitlab.com/rwkgyg/CFwarp/raw/main/point/endip.sh -o endip.sh && chmod +x endip.sh && bash endip.sh 26 | ``` 27 | 28 | Replit平台一键无限生成WARP-Wireguard配置(须登录fork后才可运行):https://replit.com/@yonggekkk/WARP-Wireguard-Register 29 | 30 | -------------------------------------------------------------- 31 | ### 三、Windows平台warp官方客户端优选对端IP应用程序 32 | 33 | 注意:默认只能在C盘或者桌面操作 34 | 35 | 使用方法:解压下载的(WIN端warp自选IP-v23.11.15.zip)文件,参考使用方法及视频教程 36 | 37 | ----------------------------------------------------------- 38 | ### WARP多功能VPS一键脚本界面图 39 | ![43bb749b327c7e3bd5c03f927f3a69d](https://github.com/yonggekkk/warp-yg/assets/121604513/61d2d6c0-9594-4799-9188-084bad886a66) 40 | 41 | ----------------------------------------------------- 42 | ### 交流平台:[甬哥博客地址](https://ygkkk.blogspot.com)、[甬哥YouTube频道](https://www.youtube.com/@ygkkk)、[甬哥TG电报群组](https://t.me/+jZHc6-A-1QQ5ZGVl)、[甬哥TG电报频道](https://t.me/+DkC9ZZUgEFQzMTZl) 43 | ----------------------------------------------------- 44 | ### 感谢支持!微信打赏甬哥侃侃侃ygkkk 45 | ![41440820a366deeb8109db5610313a1](https://github.com/user-attachments/assets/6ca29e1e-4db7-4669-964a-8b8d4a8d2997) 46 | 47 | ----------------------------------------------------- 48 | ### 感谢你右上角的star🌟 49 | [![Stargazers over time](https://starchart.cc/yonggekkk/warp-yg.svg)](https://starchart.cc/yonggekkk/warp-yg) 50 | 51 | -------------------------------------------------------------- 52 | #### 感谢WGCF源项目代码地址:https://github.com/ViRb3/wgcf 53 | #### 感谢CoiaPrant,WARP-GO源项目代码地址:https://gitlab.com/ProjectWARP/warp-go 54 | #### 相关功能参考来源: [P3terx](https://github.com/P3TERX/warp.sh)、[fscarmen](https://github.com/fscarmen/warp)、[热心的CF网友](https://github.com/badafans)提供的warp endpoint优选IP脚本及注册程序 55 | 56 | --------------------------------------- 57 | #### 声明: 58 | #### 所有代码来源于Github社区与ChatGPT的整合 59 | -------------------------------------------------------------------------------- /english.md: -------------------------------------------------------------------------------- 1 | ### Relevant Instructions and Notes: [WARP Series Video Instructions](https://www.youtube.com/playlist?list=PLMgly2AulGG-WqPXPkHlqWVSfQ3XjHNw8) [Changelog](https://ygkkk.blogspot.com/2022/09/cfwarp-script.html) 2 | 3 | ### I. WARP Multifunctional One-click Script, Supports Direct Installation on VPS with Pure IPv4 or Pure IPv6, Compatible with Mainstream Linux Systems 4 | ```bash 5 | bash <(wget -qO- https://gitlab.com/rwkgyg/CFwarp/raw/main/CFwarp.sh 2> /dev/null) 6 | ``` 7 | or 8 | ```bash 9 | bash <(curl -Ls https://gitlab.com/rwkgyg/CFwarp/raw/main/CFwarp.sh) 10 | ``` 11 | 12 | #### Please Note: If IP Loss, VPS Lagging, Script Download Failure, or Inability to Enter Script Interface Occurs, Terminate warp with the Following Commands, Then Restart or Reinstall warp 13 | 14 | 1. Terminate warp-go: 15 | ```bash 16 | kill -15 $(pgrep warp-go) 17 | ``` 18 | 19 | 2. Terminate wgcf: 20 | ```bash 21 | systemctl stop wg-quick@wgcf 22 | ``` 23 | 24 | --------------------------------------------------------------------- 25 | 26 | ### II. Cross-platform Preferred WARP Peer IP + Unlimited WARP-Wireguard Configuration Generation One-click Script, Recommended for Use on Local Networks with Apple and Android Phones 27 | ```bash 28 | curl -sSL https://gitlab.com/rwkgyg/CFwarp/raw/main/point/endip.sh -o endip.sh && chmod +x endip.sh && bash endip.sh 29 | ``` 30 | 31 | Replit Platform One-click Unlimited WARP-Wireguard Configuration Generation (Requires Login and Fork to Run): [Replit WARP-Wireguard Register](https://replit.com/@yonggekkk/WARP-Wireguard-Register) 32 | 33 | -------------------------------------------------------------- 34 | ### III. Windows Platform WARP Official Client Preferred Peer IP Application 35 | 36 | Note: Can Only Operate on C Drive or Desktop by Default 37 | 38 | Usage: Unzip the downloaded (WIN-end-warp-optional-IP-v23.11.15.zip) file, Refer to Usage Instructions and Video Tutorial 39 | 40 | ----------------------------------------------------------- 41 | ### WARP Multifunctional VPS One-click Script Interface Image 42 | ![Script Interface](https://github.com/yonggekkk/warp-yg/assets/121604513/61d2d6c0-9594-4799-9188-084bad886a66) 43 | 44 | ----------------------------------------------------- 45 | ### Thank You for Your Star in the Upper Right Corner 🌟 46 | [![Stargazers Over Time](https://starchart.cc/yonggekkk/warp-yg.svg)](https://starchart.cc/yonggekkk/warp-yg) 47 | 48 | -------------------------------------------------------------- 49 | #### Thanks to WGCF Source Project Code Address: [WGCF Repository](https://github.com/ViRb3/wgcf) 50 | #### Thanks to CoiaPrant, WARP-GO Source Project Code Address: [WARP-GO Repository](https://gitlab.com/ProjectWARP/warp-go) 51 | #### Related Function References: [P3terx](https://github.com/P3TERX/warp.sh), [fscarmen](https://github.com/fscarmen/warp), End-User IP Script and Registration Program Provided by Enthusiastic CF Netizens 52 | 53 | --------------------------------------- 54 | #### Disclaimer: 55 | 56 | #### This project uses base64 encryption, which can be decrypted by oneself. Those who mind, please do not use it. [Reasons for Encryption](https://ygkkk.blogspot.com/2022/06/github.html) 57 | 58 | #### All code comes from the GitHub community and ChatGPT integration; If you need open source code, please provide your contact email by raising Issues. 59 | -------------------------------------------------------------------------------- /CFwarp.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin 3 | export LANG=en_US.UTF-8 4 | endpoint= 5 | red='\033[0;31m' 6 | bblue='\033[0;34m' 7 | yellow='\033[0;33m' 8 | green='\033[0;32m' 9 | plain='\033[0m' 10 | red(){ echo -e "\033[31m\033[01m$1\033[0m";} 11 | green(){ echo -e "\033[32m\033[01m$1\033[0m";} 12 | yellow(){ echo -e "\033[33m\033[01m$1\033[0m";} 13 | blue(){ echo -e "\033[36m\033[01m$1\033[0m";} 14 | white(){ echo -e "\033[37m\033[01m$1\033[0m";} 15 | bblue(){ echo -e "\033[34m\033[01m$1\033[0m";} 16 | rred(){ echo -e "\033[35m\033[01m$1\033[0m";} 17 | readtp(){ read -t5 -n26 -p "$(yellow "$1")" $2;} 18 | readp(){ read -p "$(yellow "$1")" $2;} 19 | [[ $EUID -ne 0 ]] && yellow "请以root模式运行脚本" && exit 20 | #[[ -e /etc/hosts ]] && grep -qE '^ *172.65.251.78 gitlab.com' /etc/hosts || echo -e '\n172.65.251.78 gitlab.com' >> /etc/hosts 21 | if [[ -f /etc/redhat-release ]]; then 22 | release="Centos" 23 | elif cat /etc/issue | grep -q -E -i "debian"; then 24 | release="Debian" 25 | elif cat /etc/issue | grep -q -E -i "ubuntu"; then 26 | release="Ubuntu" 27 | elif cat /etc/issue | grep -q -E -i "centos|red hat|redhat"; then 28 | release="Centos" 29 | elif cat /proc/version | grep -q -E -i "debian"; then 30 | release="Debian" 31 | elif cat /proc/version | grep -q -E -i "ubuntu"; then 32 | release="Ubuntu" 33 | elif cat /proc/version | grep -q -E -i "centos|red hat|redhat"; then 34 | release="Centos" 35 | else 36 | red "不支持当前的系统,请选择使用Ubuntu,Debian,Centos系统。" && exit 37 | fi 38 | vsid=$(grep -i version_id /etc/os-release | cut -d \" -f2 | cut -d . -f1) 39 | op=$(cat /etc/redhat-release 2>/dev/null || cat /etc/os-release 2>/dev/null | grep -i pretty_name | cut -d \" -f2) 40 | version=$(uname -r | cut -d "-" -f1) 41 | main=$(uname -r | cut -d "." -f1) 42 | minor=$(uname -r | cut -d "." -f2) 43 | vi=$(systemd-detect-virt) 44 | case "$release" in 45 | "Centos") yumapt='yum -y';; 46 | "Ubuntu"|"Debian") yumapt="apt-get -y";; 47 | esac 48 | cpujg(){ 49 | case $(uname -m) in 50 | aarch64) cpu=arm64;; 51 | x86_64) cpu=amd64;; 52 | *) red "目前脚本不支持$(uname -m)架构" && exit;; 53 | esac 54 | } 55 | 56 | cfwarpshow(){ 57 | insV=$(cat /root/warpip/v 2>/dev/null) 58 | latestV=$(curl -sL https://raw.githubusercontent.com/yonggekkk/warp-yg/main/version | awk -F "更新内容" '{print $1}' | head -n 1) 59 | if [[ -f /root/warpip/v ]]; then 60 | if [ "$insV" = "$latestV" ]; then 61 | echo -e " 当前 CFwarp-yg 脚本版本号:${bblue}${insV}${plain} 已是最新版本" 62 | else 63 | echo -e " 当前 CFwarp-yg 脚本版本号:${bblue}${insV}${plain}" 64 | echo -e " 检测到最新 CFwarp-yg 脚本版本号:${yellow}${latestV}${plain} (可选择8进行更新)" 65 | echo -e "${yellow}$(curl -sL https://raw.githubusercontent.com/yonggekkk/warp-yg/main/version)${plain}" 66 | fi 67 | else 68 | echo -e " 当前 CFwarp-yg 脚本版本号:${bblue}${latestV}${plain}" 69 | echo -e " 请先选择方案(1、2、3) ,安装想要的warp模式" 70 | fi 71 | } 72 | 73 | tun(){ 74 | if [[ $vi = openvz ]]; then 75 | TUN=$(cat /dev/net/tun 2>&1) 76 | if [[ ! $TUN =~ 'in bad state' ]] && [[ ! $TUN =~ '处于错误状态' ]] && [[ ! $TUN =~ 'Die Dateizugriffsnummer ist in schlechter Verfassung' ]]; then 77 | red "检测到未开启TUN,现尝试添加TUN支持" && sleep 4 78 | cd /dev && mkdir net && mknod net/tun c 10 200 && chmod 0666 net/tun 79 | TUN=$(cat /dev/net/tun 2>&1) 80 | if [[ ! $TUN =~ 'in bad state' ]] && [[ ! $TUN =~ '处于错误状态' ]] && [[ ! $TUN =~ 'Die Dateizugriffsnummer ist in schlechter Verfassung' ]]; then 81 | green "添加TUN支持失败,建议与VPS厂商沟通或后台设置开启" && exit 82 | else 83 | echo '#!/bin/bash' > /root/tun.sh && echo 'cd /dev && mkdir net && mknod net/tun c 10 200 && chmod 0666 net/tun' >> /root/tun.sh && chmod +x /root/tun.sh 84 | grep -qE "^ *@reboot root bash /root/tun.sh >/dev/null 2>&1" /etc/crontab || echo "@reboot root bash /root/tun.sh >/dev/null 2>&1" >> /etc/crontab 85 | green "TUN守护功能已启动" 86 | fi 87 | fi 88 | fi 89 | } 90 | 91 | nf4(){ 92 | UA_Browser="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.87 Safari/537.36" 93 | result=$(curl -4fsL --user-agent "${UA_Browser}" --write-out %{http_code} --output /dev/null --max-time 10 "https://www.netflix.com/title/70143836" 2>&1) 94 | if [[ "$result" == "404" ]]; then 95 | NF="遗憾,当前IP仅解锁Netflix自制剧" 96 | elif [[ "$result" == "403" ]]; then 97 | NF="杯具,当前IP不能看Netflix" 98 | elif [[ "$result" == "200" ]]; then 99 | NF="恭喜,当前IP完整解锁Netflix非自制剧" 100 | else 101 | NF="死心吧,Netflix不服务当前IP地区" 102 | fi 103 | } 104 | 105 | nf6(){ 106 | UA_Browser="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.87 Safari/537.36" 107 | result=$(curl -6fsL --user-agent "${UA_Browser}" --write-out %{http_code} --output /dev/null --max-time 10 "https://www.netflix.com/title/70143836" 2>&1) 108 | if [[ "$result" == "404" ]]; then 109 | NF="遗憾,当前IP仅解锁Netflix自制剧" 110 | elif [[ "$result" == "403" ]]; then 111 | NF="杯具,当前IP不能看Netflix" 112 | elif [[ "$result" == "200" ]]; then 113 | NF="恭喜,当前IP完整解锁Netflix非自制剧" 114 | else 115 | NF="死心吧,Netflix不服务当前IP地区" 116 | fi 117 | } 118 | 119 | nfs5() { 120 | UA_Browser="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.87 Safari/537.36" 121 | result=$(curl --user-agent "${UA_Browser}" --write-out %{http_code} --output /dev/null --max-time 10 -sx socks5h://localhost:$mport -4sL "https://www.netflix.com/title/70143836" 2>&1) 122 | if [[ "$result" == "404" ]]; then 123 | NF="遗憾,当前IP仅解锁Netflix自制剧" 124 | elif [[ "$result" == "403" ]]; then 125 | NF="杯具,当前IP不能看Netflix" 126 | elif [[ "$result" == "200" ]]; then 127 | NF="恭喜,当前IP完整解锁Netflix非自制剧" 128 | else 129 | NF="死心吧,Netflix不服务当前IP地区" 130 | fi 131 | } 132 | 133 | v4v6(){ 134 | v4=$(curl -s4m5 icanhazip.com -k) 135 | v6=$(curl -s6m5 icanhazip.com -k) 136 | } 137 | 138 | checkwgcf(){ 139 | wgcfv6=$(curl -s6m5 https://www.cloudflare.com/cdn-cgi/trace -k | grep warp | cut -d= -f2) 140 | wgcfv4=$(curl -s4m5 https://www.cloudflare.com/cdn-cgi/trace -k | grep warp | cut -d= -f2) 141 | } 142 | 143 | warpip(){ 144 | mkdir -p /root/warpip 145 | v4v6 146 | if [[ -z $v4 ]]; then 147 | endpoint=[2606:4700:d0::a29f:c001]:2408 148 | else 149 | endpoint=162.159.192.1:2408 150 | fi 151 | } 152 | 153 | dig9(){ 154 | if [[ -n $(grep 'DiG 9' /etc/hosts) ]]; then 155 | echo -e "search blue.kundencontroller.de\noptions rotate\nnameserver 2a02:180:6:5::1c\nnameserver 2a02:180:6:5::4\nnameserver 2a02:180:6:5::1e\nnameserver 2a02:180:6:5::1d" > /etc/resolv.conf 156 | fi 157 | } 158 | 159 | mtuwarp(){ 160 | v4v6 161 | yellow "开始自动设置warp的MTU最佳网络吞吐量值,以优化WARP网络!" 162 | MTUy=1500 163 | MTUc=10 164 | if [[ -n $v6 && -z $v4 ]]; then 165 | ping='ping6' 166 | IP1='2606:4700:4700::1111' 167 | IP2='2001:4860:4860::8888' 168 | else 169 | ping='ping' 170 | IP1='1.1.1.1' 171 | IP2='8.8.8.8' 172 | fi 173 | while true; do 174 | if ${ping} -c1 -W1 -s$((${MTUy} - 28)) -Mdo ${IP1} >/dev/null 2>&1 || ${ping} -c1 -W1 -s$((${MTUy} - 28)) -Mdo ${IP2} >/dev/null 2>&1; then 175 | MTUc=1 176 | MTUy=$((${MTUy} + ${MTUc})) 177 | else 178 | MTUy=$((${MTUy} - ${MTUc})) 179 | [[ ${MTUc} = 1 ]] && break 180 | fi 181 | [[ ${MTUy} -le 1360 ]] && MTUy='1360' && break 182 | done 183 | MTU=$((${MTUy} - 80)) 184 | green "MTU最佳网络吞吐量值= $MTU 已设置完毕" 185 | } 186 | 187 | WGproxy(){ 188 | curl -sSL https://gitlab.com/rwkgyg/CFwarp/-/raw/main/point/acwarp.sh -o acwarp.sh && chmod +x acwarp.sh && bash acwarp.sh 189 | } 190 | 191 | xyz(){ 192 | if [[ -n $(screen -ls | grep '(Attached)' | awk '{print $1}' | awk -F "." '{print $1}') ]]; then 193 | until [[ -z $(screen -ls | grep '(Attached)' | awk '{print $1}' | awk -F "." '{print $1}' | awk 'NR==1{print}') ]] 194 | do 195 | Attached=`screen -ls | grep '(Attached)' | awk '{print $1}' | awk -F "." '{print $1}' | awk 'NR==1{print}'` 196 | screen -d $Attached 197 | done 198 | fi 199 | screen -ls | awk '/\.up/ {print $1}' | cut -d "." -f 1 | xargs kill 2>/dev/null 200 | rm -rf /root/WARP-UP.sh 201 | cat>/root/WARP-UP.sh<<-\EOF 202 | #!/bin/bash 203 | red(){ echo -e "\033[31m\033[01m$1\033[0m";} 204 | green(){ echo -e "\033[32m\033[01m$1\033[0m";} 205 | sleep 2 206 | checkwgcf(){ 207 | wgcfv6=$(curl -s6m5 https://www.cloudflare.com/cdn-cgi/trace -k | grep warp | cut -d= -f2) 208 | wgcfv4=$(curl -s4m5 https://www.cloudflare.com/cdn-cgi/trace -k | grep warp | cut -d= -f2) 209 | } 210 | warpclose(){ 211 | wg-quick down wgcf >/dev/null 2>&1;systemctl stop wg-quick@wgcf >/dev/null 2>&1;systemctl disable wg-quick@wgcf >/dev/null 2>&1;kill -15 $(pgrep warp-go) >/dev/null 2>&1;systemctl stop warp-go >/dev/null 2>&1;systemctl disable warp-go >/dev/null 2>&1 212 | } 213 | warpopen(){ 214 | wg-quick down wgcf >/dev/null 2>&1;systemctl enable wg-quick@wgcf >/dev/null 2>&1;systemctl start wg-quick@wgcf >/dev/null 2>&1;systemctl restart wg-quick@wgcf >/dev/null 2>&1;kill -15 $(pgrep warp-go) >/dev/null 2>&1;systemctl stop warp-go >/dev/null 2>&1;systemctl enable warp-go >/dev/null 2>&1;systemctl start warp-go >/dev/null 2>&1;systemctl restart warp-go >/dev/null 2>&1 215 | } 216 | warpre(){ 217 | i=0 218 | while [ $i -le 4 ]; do let i++ 219 | warpopen 220 | checkwgcf 221 | if [[ $wgcfv4 =~ on|plus || $wgcfv6 =~ on|plus ]]; then 222 | green "中断后的warp尝试获取IP成功!" 223 | echo -e "[$(date '+%Y-%m-%d %H:%M:%S')] 中断后的warp尝试获取IP成功!" >> /root/warpip/warp_log.txt 224 | break 225 | else 226 | red "中断后的warp尝试获取IP失败!" 227 | echo -e "[$(date '+%Y-%m-%d %H:%M:%S')] 中断后的warp尝试获取IP失败!" >> /root/warpip/warp_log.txt 228 | fi 229 | done 230 | checkwgcf 231 | if [[ ! $wgcfv4 =~ on|plus && ! $wgcfv6 =~ on|plus ]]; then 232 | warpclose 233 | red "由于5次尝试获取warp的IP失败,现执行停止并关闭warp,VPS恢复原IP状态" 234 | echo -e "[$(date '+%Y-%m-%d %H:%M:%S')] 由于5次尝试获取warp的IP失败,现执行停止并关闭warp,VPS恢复原IP状态" >> /root/warpip/warp_log.txt 235 | fi 236 | } 237 | while true; do 238 | green "检测warp是否启动中…………" 239 | wp=$(cat /root/warpip/wp.log) 240 | if [[ $wp = w4 ]]; then 241 | checkwgcf 242 | if [[ $wgcfv4 =~ on|plus ]]; then 243 | green "恭喜!WARP IPV4状态为运行中!下轮检测将在600秒后自动执行" 244 | echo -e "[$(date '+%Y-%m-%d %H:%M:%S')] 恭喜!WARP IPV4状态为运行中!下轮检测将在600秒后自动执行" >> /root/warpip/warp_log.txt 245 | sleep 600s 246 | else 247 | warpre ; green "下轮检测将在500秒后自动执行" 248 | echo -e "[$(date '+%Y-%m-%d %H:%M:%S')] 下轮检测将在500秒后自动执行" >> /root/warpip/warp_log.txt 249 | sleep 500s 250 | fi 251 | elif [[ $wp = w6 ]]; then 252 | checkwgcf 253 | if [[ $wgcfv6 =~ on|plus ]]; then 254 | green "恭喜!WARP IPV6状态为运行中!下轮检测将在600秒后自动执行" 255 | echo -e "[$(date '+%Y-%m-%d %H:%M:%S')] 恭喜!WARP IPV6状态为运行中!下轮检测将在600秒后自动执行" >> /root/warpip/warp_log.txt 256 | sleep 600s 257 | else 258 | warpre ; green "下轮检测将在500秒后自动执行" 259 | echo -e "[$(date '+%Y-%m-%d %H:%M:%S')] 下轮检测将在500秒后自动执行" >> /root/warpip/warp_log.txt 260 | sleep 500s 261 | fi 262 | else 263 | checkwgcf 264 | if [[ $wgcfv4 =~ on|plus && $wgcfv6 =~ on|plus ]]; then 265 | green "恭喜!WARP IPV4+IPV6状态为运行中!下轮检测将在600秒后自动执行" 266 | echo -e "[$(date '+%Y-%m-%d %H:%M:%S')] 恭喜!WARP IPV4+IPV6状态为运行中!下轮检测将在600秒后自动执行" >> /root/warpip/warp_log.txt 267 | sleep 600s 268 | else 269 | warpre ; green "下轮检测将在500秒后自动执行" 270 | echo -e "[$(date '+%Y-%m-%d %H:%M:%S')] 下轮检测将在500秒后自动执行" >> /root/warpip/warp_log.txt 271 | sleep 500s 272 | fi 273 | fi 274 | done 275 | EOF 276 | [[ -e /root/WARP-UP.sh ]] && screen -ls | awk '/\.up/ {print $1}' | cut -d "." -f 1 | xargs kill 2>/dev/null ; screen -UdmS up bash -c '/bin/bash /root/WARP-UP.sh' 277 | } 278 | 279 | first4(){ 280 | [[ -e /etc/gai.conf ]] && grep -qE '^ *precedence ::ffff:0:0/96 100' /etc/gai.conf || echo 'precedence ::ffff:0:0/96 100' >> /etc/gai.conf 2>/dev/null 281 | } 282 | 283 | docker(){ 284 | if [[ -n $(ip a | grep docker) ]]; then 285 | red "检测到VPS已安装docker,请确保docker为host运行模式,否则docker就会失效" && sleep 3s 286 | echo 287 | yellow "6秒后继续安装方案一的WARP,退出安装请按Ctrl+c" && sleep 6s 288 | fi 289 | } 290 | 291 | lncf(){ 292 | curl -sSL -o /usr/bin/cf -L https://raw.githubusercontent.com/yonggekkk/warp-yg/main/CFwarp.sh 293 | chmod +x /usr/bin/cf 294 | } 295 | 296 | UPwpyg(){ 297 | if [[ ! -f '/usr/bin/cf' ]]; then 298 | red "未正常安装CFwarp脚本!" && exit 299 | fi 300 | lncf 301 | curl -sL https://raw.githubusercontent.com/yonggekkk/warp-yg/main/version | awk -F "更新内容" '{print $1}' | head -n 1 > /root/warpip/v 302 | green "CFwarp脚本升级成功" && cf 303 | } 304 | 305 | restwarpgo(){ 306 | kill -15 $(pgrep warp-go) >/dev/null 2>&1 && sleep 2 307 | systemctl restart warp-go >/dev/null 2>&1 308 | systemctl enable warp-go >/dev/null 2>&1 309 | systemctl start warp-go >/dev/null 2>&1 310 | } 311 | 312 | cso(){ 313 | warp-cli --accept-tos disconnect >/dev/null 2>&1 314 | warp-cli --accept-tos disable-always-on >/dev/null 2>&1 315 | warp-cli --accept-tos delete >/dev/null 2>&1 316 | if [[ $release = Centos ]]; then 317 | yum autoremove cloudflare-warp -y 318 | else 319 | apt purge cloudflare-warp -y 320 | rm -f /etc/apt/sources.list.d/cloudflare-client.list /usr/share/keyrings/cloudflare-warp-archive-keyring.gpg 321 | fi 322 | $yumapt autoremove 323 | } 324 | 325 | WARPun(){ 326 | readp "1.仅卸载方案一 WARP\n2.仅卸载方案二 Socks5-WARP\n3.彻底清理并卸载WARP相关所有方案(1+2)\n 请选择:" cd 327 | case "$cd" in 328 | 1 ) cwg && green "warp卸载完成";; 329 | 2 ) cso && green "socks5-warp卸载完成";; 330 | 3 ) cwg && cso && unreswarp && green "warp与socks5-warp都已彻底卸载完成" && rm -rf /usr/bin/cf warp_update 331 | esac 332 | } 333 | 334 | WARPtools(){ 335 | wppluskey(){ 336 | if [[ $cpu = amd64 ]]; then 337 | curl -sSL -o warpplus.sh --insecure https://gitlab.com/rwkgyg/CFwarp/-/raw/main/point/warp_plus.sh >/dev/null 2>&1 338 | elif [[ $cpu = arm64 ]]; then 339 | curl -sSL -o warpplus.sh --insecure https://gitlab.com/rwkgyg/CFwarp/-/raw/main/point/warpplusa.sh >/dev/null 2>&1 340 | fi 341 | chmod +x warpplus.sh 342 | timeout 60s ./warpplus.sh 343 | } 344 | green "1. 实时查看WARP在线监测情况(进入前请注意:退出且继续执行监测命令:ctrl+a+d,退出且关闭监测命令:ctrl+c )" 345 | green "2. 重启WARP在线监测功能" 346 | green "3. 重置并自定义WARP在线监测时间间隔" 347 | green "4. 查看当天WARP在线监测日志" 348 | echo "-----------------------------------------------" 349 | green "5. 更改Socks5+WARP端口" 350 | echo "-----------------------------------------------" 351 | green "6. 用自备的warp密钥,慢慢刷warp+流量" 352 | green "7. 一键生成2000多万GB流量的warp+密钥" 353 | echo "-----------------------------------------------" 354 | green "0. 退出" 355 | readp "请选择:" warptools 356 | if [[ $warptools == 1 ]]; then 357 | [[ -z $(type -P warp-go) && -z $(type -P wg-quick) ]] && red "未安装方案一,脚本退出" && exit 358 | name=`screen -ls | grep '(Detached)' | awk '{print $1}' | awk -F "." '{print $2}'` 359 | if [[ $name =~ "up" ]]; then 360 | screen -Ur up 361 | else 362 | red "未启动WARP监测功能,请选择 2 重启" && WARPtools 363 | fi 364 | elif [[ $warptools == 2 ]]; then 365 | [[ -z $(type -P warp-go) && -z $(type -P wg-quick) ]] && red "未安装方案一,脚本退出" && exit 366 | xyz 367 | name=`screen -ls | grep '(Detached)' | awk '{print $1}' | awk -F "." '{print $2}'` 368 | [[ $name =~ "up" ]] && green "WARP在线监测启动成功" || red "WARP在线监测启动失败,查看screen是否安装成功" 369 | elif [[ $warptools == 3 ]]; then 370 | [[ -z $(type -P warp-go) && -z $(type -P wg-quick) ]] && red "未安装方案一,脚本退出" && exit 371 | xyz 372 | readp "warp状态为运行时,重新检测warp状态间隔时间(回车默认600秒),请输入间隔时间(例:50秒,输入50):" stop 373 | [[ -n $stop ]] && sed -i "s/600s/${stop}s/g;s/600秒/${stop}秒/g" /root/WARP-UP.sh || green "默认间隔600秒" 374 | readp "warp状态为中断时(连续5次失败自动关闭warp,恢复原VPS的IP),继续检测WARP状态间隔时间(回车默认500秒),请输入间隔时间(例:50秒,输入50):" goon 375 | [[ -n $goon ]] && sed -i "s/500s/${goon}s/g;s/500秒/${goon}秒/g" /root/WARP-UP.sh || green "默认间隔500秒" 376 | [[ -e /root/WARP-UP.sh ]] && screen -ls | awk '/\.up/ {print $1}' | cut -d "." -f 1 | xargs kill 2>/dev/null ; screen -UdmS up bash -c '/bin/bash /root/WARP-UP.sh' 377 | green "设置完成,可在选项1查看监测时间间隔" 378 | elif [[ $warptools == 4 ]]; then 379 | [[ -z $(type -P warp-go) && -z $(type -P wg-quick) ]] && red "未安装方案一,脚本退出" && exit 380 | cat /root/warpip/warp_log.txt 381 | # find /root/warpip/warp_log.txt -mtime -1 -exec cat {} \; 382 | elif [[ $warptools == 6 ]]; then 383 | green "也可以在线网页端刷:https://replit.com/@ygkkkk/Warp" && sleep 2 384 | wget -N https://gitlab.com/rwkgyg/CFwarp/raw/main/wp-plus.py 385 | sed -i "27 s/[(][^)]*[)]//g" wp-plus.py 386 | readp "客户端配置ID(36个字符):" ID 387 | sed -i "27 s/input/'$ID'/" wp-plus.py 388 | python3 wp-plus.py 389 | elif [[ $warptools == 5 ]]; then 390 | SOCKS5WARPPORT 391 | elif [[ $warptools == 7 ]]; then 392 | wppluskey && rm -rf warpplus.sh 393 | green "当前脚本累计已生成的warp+密钥已放置在/root/WARP+Keys.txt文件内" 394 | green "每重新执行一次的新密钥将放置在文件末尾(包括方案一与方案二)" 395 | blue "$(cat /root/WARP+Keys.txt)" 396 | echo 397 | else 398 | cf 399 | fi 400 | } 401 | 402 | chatgpt4(){ 403 | gpt1=$(curl -s4 https://chat.openai.com 2>&1) 404 | gpt2=$(curl -s4 https://ios.chat.openai.com 2>&1) 405 | } 406 | chatgpt6(){ 407 | gpt1=$(curl -s6 https://chat.openai.com 2>&1) 408 | gpt2=$(curl -s6 https://ios.chat.openai.com 2>&1) 409 | } 410 | checkgpt(){ 411 | #if [[ $gpt1 == *location* ]]; then 412 | if [[ $gpt2 == *VPN* ]]; then 413 | chat='遗憾,当前IP仅解锁ChatGPT网页,未解锁客户端' 414 | elif [[ $gpt2 == *Request* ]]; then 415 | chat='恭喜,当前IP完整解锁ChatGPT (网页+客户端)' 416 | else 417 | chat='杯具,当前IP无法解锁ChatGPT服务' 418 | fi 419 | #else 420 | #chat='杯具,当前IP无法解锁ChatGPT服务' 421 | #fi 422 | } 423 | 424 | ShowSOCKS5(){ 425 | if [[ $(systemctl is-active warp-svc) = active ]]; then 426 | mport=`warp-cli --accept-tos settings 2>/dev/null | grep 'WarpProxy on port' | awk -F "port " '{print $2}'` 427 | s5ip=`curl -sx socks5h://localhost:$mport icanhazip.com -k` 428 | nfs5 429 | gpt1=$(curl -sx socks5h://localhost:$mport https://chat.openai.com 2>&1) 430 | gpt2=$(curl -sx socks5h://localhost:$mport https://android.chat.openai.com 2>&1) 431 | checkgpt 432 | #NF=$(./nf -proxy socks5h://localhost:$mport | awk '{print $1}' | sed -n '3p') 433 | nonf=$(curl -sx socks5h://localhost:$mport --user-agent "${UA_Browser}" http://ip-api.com/json/$s5ip?lang=zh-CN -k | cut -f2 -d"," | cut -f4 -d '"') 434 | #sunf=$(./nf | awk '{print $1}' | sed -n '4p') 435 | #snnf=$(curl -sx socks5h://localhost:$mport ip.p3terx.com -k | sed -n 2p | awk '{print $3}') 436 | country=$nonf 437 | socks5=$(curl -sx socks5h://localhost:$mport www.cloudflare.com/cdn-cgi/trace -k --connect-timeout 2 | grep warp | cut -d= -f2) 438 | case ${socks5} in 439 | plus) 440 | S5Status=$(white "Socks5 WARP+状态:\c" ; rred "运行中,WARP+账户(剩余WARP+流量:$((`warp-cli --accept-tos account | grep Quota | awk '{ print $(NF) }'`/1000000000)) GB)" ; white " Socks5 端口:\c" ; rred "$mport" ; white " 服务商 Cloudflare 获取IPV4地址:\c" ; rred "$s5ip $country" ; white " 奈飞NF解锁情况:\c" ; rred "$NF" ; white " ChatGPT解锁情况:\c" ; rred "$chat");; 441 | on) 442 | 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");; 443 | *) 444 | S5Status=$(white "Socks5 WARP状态:\c" ; yellow "已安装Socks5-WARP客户端,但端口处于关闭状态") 445 | esac 446 | else 447 | S5Status=$(white "Socks5 WARP状态:\c" ; red "未安装Socks5-WARP客户端") 448 | fi 449 | } 450 | 451 | SOCKS5ins(){ 452 | yellow "检测Socks5-WARP安装环境中……" 453 | if [[ $release = Centos ]]; then 454 | [[ ! ${vsid} =~ 8 ]] && yellow "当前系统版本号:Centos $vsid \nSocks5-WARP仅支持Centos 8 " && exit 455 | elif [[ $release = Ubuntu ]]; then 456 | [[ ! ${vsid} =~ 20|22|24 ]] && yellow "当前系统版本号:Ubuntu $vsid \nSocks5-WARP仅支持 Ubuntu 20.04/22.04/24.04系统 " && exit 457 | elif [[ $release = Debian ]]; then 458 | [[ ! ${vsid} =~ 10|11|12|13 ]] && yellow "当前系统版本号:Debian $vsid \nSocks5-WARP仅支持 Debian 10/11/12/13系统 " && exit 459 | fi 460 | [[ $(warp-cli --accept-tos status 2>/dev/null) =~ 'Connected' ]] && red "当前Socks5-WARP已经在运行中" && cf 461 | 462 | systemctl stop wg-quick@wgcf >/dev/null 2>&1 463 | kill -15 $(pgrep warp-go) >/dev/null 2>&1 && sleep 2 464 | v4v6 465 | if [[ -n $v6 && -z $v4 ]]; then 466 | systemctl start wg-quick@wgcf >/dev/null 2>&1 467 | restwarpgo 468 | red "纯IPV6的VPS目前不支持安装Socks5-WARP" && sleep 2 && exit 469 | else 470 | systemctl start wg-quick@wgcf >/dev/null 2>&1 471 | restwarpgo 472 | #elif [[ -n $v4 && -z $v6 ]]; then 473 | #systemctl start wg-quick@wgcf >/dev/null 2>&1 474 | #checkwgcf 475 | #[[ $wgcfv4 =~ on|plus ]] && red "纯IPV4的VPS已安装Wgcf-WARP-IPV4,不支持安装Socks5-WARP" && cf 476 | #elif [[ -n $v4 && -n $v6 ]]; then 477 | #systemctl start wg-quick@wgcf >/dev/null 2>&1 478 | #checkwgcf 479 | #[[ $wgcfv4 =~ on|plus || $wgcfv6 =~ on|plus ]] && red "原生双栈VPS已安装Wgcf-WARP-IPV4/IPV6,请先卸载。然后安装Socks5-WARP,最后安装Wgcf-WARP-IPV4/IPV6" && cf 480 | fi 481 | #systemctl start wg-quick@wgcf >/dev/null 2>&1 482 | #checkwgcf 483 | #if [[ $wgcfv4 =~ on|plus && $wgcfv6 =~ on|plus ]]; then 484 | #red "已安装Wgcf-WARP-IPV4+IPV6,不支持安装Socks5-WARP" && cf 485 | #fi 486 | if [[ $release = Centos ]]; then 487 | yum -y install epel-release && yum -y install net-tools 488 | curl -fsSl https://pkg.cloudflareclient.com/cloudflare-warp-ascii.repo | tee /etc/yum.repos.d/cloudflare-warp.repo 489 | yum update 490 | #rpm -ivh https://pkg.cloudflareclient.com/cloudflare-release-el8.rpm 491 | yum -y install cloudflare-warp 492 | fi 493 | if [[ $release = Debian ]]; then 494 | [[ ! $(type -P gpg) ]] && apt update && apt install gnupg -y 495 | [[ ! $(apt list 2>/dev/null | grep apt-transport-https | grep installed) ]] && apt update && apt install apt-transport-https -y 496 | fi 497 | if [[ $release != Centos ]]; then 498 | apt install net-tools -y 499 | curl -fsSL https://pkg.cloudflareclient.com/pubkey.gpg | gpg --yes --dearmor --output /usr/share/keyrings/cloudflare-warp-archive-keyring.gpg 500 | echo "deb [signed-by=/usr/share/keyrings/cloudflare-warp-archive-keyring.gpg] https://pkg.cloudflareclient.com/ $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/cloudflare-client.list 501 | sudo apt-get update && sudo apt-get install cloudflare-warp 502 | fi 503 | warpip 504 | echo y | warp-cli registration new 505 | warp-cli mode proxy 506 | warp-cli proxy port 40000 507 | warp-cli connect 508 | #wppluskey >/dev/null 2>&1 509 | #ID=$(tail -n1 /root/WARP+Keys.txt | cut -d' ' -f1 2>/dev/null) 510 | #if [[ -n $ID ]]; then 511 | #green "使用warp+密钥" 512 | #green "$(tail -n1 /root/WARP+Keys.txt | cut -d' ' -f1)" 513 | #warp-cli --accept-tos set-license $ID >/dev/null 2>&1 514 | #fi 515 | #rm -rf warpplus.sh 516 | #if [[ $(warp-cli --accept-tos account) =~ 'Limited' ]]; then 517 | #green "已升级为Socks5-WARP+账户\nSocks5-WARP+账户剩余流量:$((`warp-cli --accept-tos account | grep Quota | awk '{ print $(NF) }'`/1000000000)) GB" 518 | #fi 519 | green "安装结束,回到菜单" 520 | sleep 2 && lncf && reswarp && cf 521 | } 522 | 523 | SOCKS5WARPUP(){ 524 | [[ ! $(type -P warp-cli) ]] && red "未安装Socks5-WARP,无法升级到Socks5-WARP+账户" && exit 525 | [[ $(warp-cli --accept-tos account) =~ 'Limited' ]] && red "当前已是Socks5-WARP+账户,无须再升级" && exit 526 | readp "按键许可证秘钥(26个字符):" ID 527 | [[ -n $ID ]] && warp-cli --accept-tos set-license $ID >/dev/null 2>&1 || (red "未输入按键许可证秘钥(26个字符)" && exit) 528 | yellow "如提示Error: Too many devices.可能绑定设备已超过5台的限制或者密钥输入错误" 529 | if [[ $(warp-cli --accept-tos account) =~ 'Limited' ]]; then 530 | green "已升级为Socks5-WARP+账户\nSocks5-WARP+账户剩余流量:$((`warp-cli --accept-tos account | grep Quota | awk '{ print $(NF) }'`/1000000000)) GB" 531 | else 532 | red "升级Socks5-WARP+账户失败" && exit 533 | fi 534 | sleep 2 && ShowSOCKS5 && S5menu 535 | } 536 | 537 | SOCKS5WARPPORT(){ 538 | [[ ! $(type -P warp-cli) ]] && red "未安装Socks5-WARP(+),无法更改端口" && exit 539 | readp "请输入自定义socks5端口[2000~65535](回车跳过为2000-65535之间的随机端口):" port 540 | if [[ -z $port ]]; then 541 | port=$(shuf -i 2000-65535 -n 1) 542 | until [[ -z $(ss -ntlp | awk '{print $4}' | sed 's/.*://g' | grep -w "$port") ]] 543 | do 544 | [[ -n $(ss -ntlp | awk '{print $4}' | sed 's/.*://g' | grep -w "$port") ]] && yellow "\n端口被占用,请重新输入端口" && readp "自定义socks5端口:" port 545 | done 546 | else 547 | until [[ -z $(ss -ntlp | awk '{print $4}' | sed 's/.*://g' | grep -w "$port") ]] 548 | do 549 | [[ -n $(ss -ntlp | awk '{print $4}' | sed 's/.*://g' | grep -w "$port") ]] && yellow "\n端口被占用,请重新输入端口" && readp "自定义socks5端口:" port 550 | done 551 | fi 552 | [[ -n $port ]] && warp-cli --accept-tos set-proxy-port $port >/dev/null 2>&1 553 | green "当前socks5端口:$port" 554 | sleep 2 && ShowSOCKS5 && S5menu 555 | } 556 | 557 | WGCFmenu(){ 558 | name=`screen -ls | grep '(Detached)' | awk '{print $1}' | awk -F "." '{print $2}'` 559 | [[ $name =~ "up" ]] && keepup="WARP监测已开启" || keepup="WARP监测关闭中" 560 | white "------------------------------------------------------------------------------------" 561 | white " 方案一:当前 IPV4 接管VPS出站情况如下($keepup)" 562 | white " ${WARPIPv4Status}" 563 | white "------------------------------------------------------------------------------------" 564 | white " 方案一:当前 IPV6 接管VPS出站情况如下($keepup)" 565 | white " ${WARPIPv6Status}" 566 | white "------------------------------------------------------------------------------------" 567 | if [[ "$WARPIPv4Status" == *不存在* && "$WARPIPv6Status" == *不存在* ]]; then 568 | yellow "IPV4与IPV6都为不存在,建议如下:" 569 | red "1、原来安装wgcf的,选择9切换到warp-go重装warp" 570 | red "2、原来安装warp-go的,选择10切换到wgcf重装warp" 571 | red "切记:如依旧如此,建议卸载并重启VPS,再重装方案一" 572 | fi 573 | } 574 | S5menu(){ 575 | white "------------------------------------------------------------------------------------------------" 576 | white " 方案二:当前 Socks5-WARP 官方客户端本地代理情况如下" 577 | blue " ${S5Status}" 578 | white "------------------------------------------------------------------------------------------------" 579 | } 580 | 581 | reswarp(){ 582 | unreswarp 583 | crontab -l > /tmp/crontab.tmp 584 | echo "0 4 * * * systemctl stop warp-go;systemctl restart warp-go;systemctl restart wg-quick@wgcf;systemctl restart warp-svc" >> /tmp/crontab.tmp 585 | echo "@reboot screen -UdmS up /bin/bash /root/WARP-UP.sh" >> /tmp/crontab.tmp 586 | echo "0 0 * * * rm -f /root/warpip/warp_log.txt" >> /tmp/crontab.tmp 587 | crontab /tmp/crontab.tmp 588 | rm /tmp/crontab.tmp 589 | } 590 | 591 | unreswarp(){ 592 | crontab -l > /tmp/crontab.tmp 593 | sed -i '/systemctl stop warp-go;systemctl restart warp-go;systemctl restart wg-quick@wgcf;systemctl restart warp-svc/d' /tmp/crontab.tmp 594 | sed -i '/@reboot screen/d' /tmp/crontab.tmp 595 | sed -i '/warp_log.txt/d' /tmp/crontab.tmp 596 | crontab /tmp/crontab.tmp 597 | rm /tmp/crontab.tmp 598 | } 599 | 600 | ONEWARPGO(){ 601 | if [[ $(echo "$op" | grep -i -E "arch|alpine") ]]; then 602 | red "脚本不支持当前的 $op 系统,请选择使用Ubuntu,Debian,Centos系统。" && exit 603 | fi 604 | yellow "\n 请稍等,当前为warp-go核心安装模式,检测对端IP与出站情况……" 605 | warpip 606 | 607 | wgo1='sed -i "s#.*AllowedIPs.*#AllowedIPs = 0.0.0.0/0#g" /usr/local/bin/warp.conf' 608 | wgo2='sed -i "s#.*AllowedIPs.*#AllowedIPs = ::/0#g" /usr/local/bin/warp.conf' 609 | wgo3='sed -i "s#.*AllowedIPs.*#AllowedIPs = 0.0.0.0/0,::/0#g" /usr/local/bin/warp.conf' 610 | wgo4='sed -i "/Endpoint6/d" /usr/local/bin/warp.conf && sed -i "/Endpoint/s/.*/Endpoint = '"$endpoint"'/" /usr/local/bin/warp.conf' 611 | wgo5='sed -i "/Endpoint6/d" /usr/local/bin/warp.conf && sed -i "/Endpoint/s/.*/Endpoint = '"$endpoint"'/" /usr/local/bin/warp.conf' 612 | wgo6='sed -i "/\[Script\]/a PostUp = ip -4 rule add from $(ip route get 162.159.192.1 | grep -oP "src \K\S+") lookup main\n" /usr/local/bin/warp.conf && sed -i "/\[Script\]/a PostDown = ip -4 rule delete from $(ip route get 162.159.192.1 | grep -oP "src \K\S+") lookup main\n" /usr/local/bin/warp.conf' 613 | wgo7='sed -i "/\[Script\]/a PostUp = ip -6 rule add from $(ip route get 2606:4700:d0::a29f:c001 | grep -oP "src \K\S+") lookup main\n" /usr/local/bin/warp.conf && sed -i "/\[Script\]/a PostDown = ip -6 rule delete from $(ip route get 2606:4700:d0::a29f:c001 | grep -oP "src \K\S+") lookup main\n" /usr/local/bin/warp.conf' 614 | wgo8='sed -i "/\[Script\]/a PostUp = ip -4 rule add from $(ip route get 162.159.192.1 | grep -oP "src \K\S+") lookup main\n" /usr/local/bin/warp.conf && sed -i "/\[Script\]/a PostDown = ip -4 rule delete from $(ip route get 162.159.192.1 | grep -oP "src \K\S+") lookup main\n" /usr/local/bin/warp.conf && sed -i "/\[Script\]/a PostUp = ip -6 rule add from $(ip route get 2606:4700:d0::a29f:c001 | grep -oP "src \K\S+") lookup main\n" /usr/local/bin/warp.conf && sed -i "/\[Script\]/a PostDown = ip -6 rule delete from $(ip route get 2606:4700:d0::a29f:c001 | grep -oP "src \K\S+") lookup main\n" /usr/local/bin/warp.conf' 615 | 616 | STOPwgcf(){ 617 | if [[ -n $(type -P warp-cli) ]]; then 618 | red "已安装Socks5-WARP,不支持当前选择的WARP安装方案" 619 | systemctl restart warp-go && cf 620 | fi 621 | } 622 | 623 | ShowWGCF(){ 624 | UA_Browser="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.87 Safari/537.36" 625 | v4v6 626 | warppflow=$((`grep -oP '"quota":\K\d+' <<< $(curl -sm4 "https://api.cloudflareclient.com/v0a884/reg/$(grep 'Device' /usr/local/bin/warp.conf 2>/dev/null | cut -d= -f2 | sed 's# ##g')" -H "User-Agent: okhttp/3.12.1" -H "Authorization: Bearer $(grep 'Token' /usr/local/bin/warp.conf 2>/dev/null | cut -d= -f2 | sed 's# ##g')")`)) 627 | flow=`echo "scale=2; $warppflow/1000000000" | bc` 628 | [[ -e /usr/local/bin/warpplus.log ]] && cfplus="WARP+账户(有限WARP+流量:$flow GB),设备名称:$(sed -n 1p /usr/local/bin/warpplus.log)" || cfplus="WARP+Teams账户(无限WARP+流量)" 629 | if [[ -n $v4 ]]; then 630 | nf4 631 | chatgpt4 632 | checkgpt 633 | wgcfv4=$(curl -s4 https://www.cloudflare.com/cdn-cgi/trace -k | grep warp | cut -d= -f2) 634 | isp4a=`curl -sm3 --user-agent "${UA_Browser}" http://ip-api.com/json/$v4?lang=zh-CN -k | cut -f13 -d ":" | cut -f2 -d '"'` 635 | isp4b=`curl -sm3 --user-agent "${UA_Browser}" https://api.ip.sb/geoip/$v4 -k | awk -F "isp" '{print $2}' | awk -F "offset" '{print $1}' | sed "s/[,\":]//g"` 636 | [[ -n $isp4a ]] && isp4=$isp4a || isp4=$isp4b 637 | nonf=$(curl -sm3 --user-agent "${UA_Browser}" http://ip-api.com/json/$v4?lang=zh-CN -k | cut -f2 -d"," | cut -f4 -d '"') 638 | #sunf=$(./nf | awk '{print $1}' | sed -n '4p') 639 | #snnf=$(curl -s4m6 ip.p3terx.com -k | sed -n 2p | awk '{print $3}') 640 | country=$nonf 641 | case ${wgcfv4} in 642 | plus) 643 | WARPIPv4Status=$(white "WARP+状态:\c" ; rred "运行中,$cfplus" ; white " 服务商 Cloudflare 获取IPV4地址:\c" ; rred "$v4 $country" ; white " 奈飞NF解锁情况:\c" ; rred "$NF" ; white " ChatGPT解锁情况:\c" ; rred "$chat");; 644 | on) 645 | WARPIPv4Status=$(white "WARP状态:\c" ; green "运行中,WARP普通账户(无限WARP流量)" ; white " 服务商 Cloudflare 获取IPV4地址:\c" ; green "$v4 $country" ; white " 奈飞NF解锁情况:\c" ; green "$NF" ; white " ChatGPT解锁情况:\c" ; green "$chat");; 646 | off) 647 | WARPIPv4Status=$(white "WARP状态:\c" ; yellow "关闭中" ; white " 服务商 $isp4 获取IPV4地址:\c" ; yellow "$v4 $country" ; white " 奈飞NF解锁情况:\c" ; yellow "$NF" ; white " ChatGPT解锁情况:\c" ; yellow "$chat");; 648 | esac 649 | else 650 | WARPIPv4Status=$(white "IPV4状态:\c" ; red "不存在IPV4地址 ") 651 | fi 652 | if [[ -n $v6 ]]; then 653 | nf6 654 | chatgpt6 655 | checkgpt 656 | wgcfv6=$(curl -s6 https://www.cloudflare.com/cdn-cgi/trace -k | grep warp | cut -d= -f2) 657 | isp6a=`curl -sm3 --user-agent "${UA_Browser}" http://ip-api.com/json/$v6?lang=zh-CN -k | cut -f13 -d":" | cut -f2 -d '"'` 658 | isp6b=`curl -sm3 --user-agent "${UA_Browser}" https://api.ip.sb/geoip/$v6 -k | awk -F "isp" '{print $2}' | awk -F "offset" '{print $1}' | sed "s/[,\":]//g"` 659 | [[ -n $isp6a ]] && isp6=$isp6a || isp6=$isp6b 660 | nonf=$(curl -sm3 --user-agent "${UA_Browser}" http://ip-api.com/json/$v6?lang=zh-CN -k | cut -f2 -d"," | cut -f4 -d '"') 661 | #sunf=$(./nf | awk '{print $1}' | sed -n '8p') 662 | #snnf=$(curl -s6m6 ip.p3terx.com -k | sed -n 2p | awk '{print $3}') 663 | country=$nonf 664 | case ${wgcfv6} in 665 | plus) 666 | WARPIPv6Status=$(white "WARP+状态:\c" ; rred "运行中,$cfplus" ; white " 服务商 Cloudflare 获取IPV6地址:\c" ; rred "$v6 $country" ; white " 奈飞NF解锁情况:\c" ; rred "$NF" ; white " ChatGPT解锁情况:\c" ; rred "$chat");; 667 | on) 668 | WARPIPv6Status=$(white "WARP状态:\c" ; green "运行中,WARP普通账户(无限WARP流量)" ; white " 服务商 Cloudflare 获取IPV6地址:\c" ; green "$v6 $country" ; white " 奈飞NF解锁情况:\c" ; green "$NF" ; white " ChatGPT解锁情况:\c" ; green "$chat");; 669 | off) 670 | WARPIPv6Status=$(white "WARP状态:\c" ; yellow "关闭中" ; white " 服务商 $isp6 获取IPV6地址:\c" ; yellow "$v6 $country" ; white " 奈飞NF解锁情况:\c" ; yellow "$NF" ; white " ChatGPT解锁情况:\c" ; yellow "$chat");; 671 | esac 672 | else 673 | WARPIPv6Status=$(white "IPV6状态:\c" ; red "不存在IPV6地址 ") 674 | fi 675 | } 676 | 677 | CheckWARP(){ 678 | i=0 679 | while [ $i -le 9 ]; do let i++ 680 | yellow "共执行10次,第$i次获取warp的IP中……" 681 | restwarpgo 682 | checkwgcf 683 | if [[ $wgcfv4 =~ on|plus || $wgcfv6 =~ on|plus ]]; then 684 | green "恭喜!warp的IP获取成功!" && dns 685 | break 686 | else 687 | red "遗憾!warp的IP获取失败" 688 | fi 689 | done 690 | if [[ ! $wgcfv4 =~ on|plus && ! $wgcfv6 =~ on|plus ]]; then 691 | red "安装WARP失败,还原VPS,卸载WARP" 692 | cwg 693 | echo 694 | [[ $release = Centos && ${vsid} -lt 7 ]] && yellow "当前系统版本号:Centos $vsid \n建议使用 Centos 7 以上系统 " 695 | [[ $release = Ubuntu && ${vsid} -lt 18 ]] && yellow "当前系统版本号:Ubuntu $vsid \n建议使用 Ubuntu 18 以上系统 " 696 | [[ $release = Debian && ${vsid} -lt 10 ]] && yellow "当前系统版本号:Debian $vsid \n建议使用 Debian 10 以上系统 " 697 | yellow "提示:" 698 | red "你或许可以使用方案二或方案三来实现WARP" 699 | red "也可以选择WGCF核心来安装WARP方案一" 700 | exit 701 | else 702 | green "ok" && systemctl restart warp-go 703 | fi 704 | } 705 | 706 | nat4(){ 707 | [[ -n $(ip route get 1.1.1.1 2>/dev/null | grep -oP 'src \K\S+') ]] && wpgo4=$wgo6 || wpgo4=echo 708 | } 709 | 710 | WGCFv4(){ 711 | yellow "稍等3秒,检测VPS内warp环境" 712 | docker && checkwgcf 713 | if [[ ! $wgcfv4 =~ on|plus && ! $wgcfv6 =~ on|plus ]]; then 714 | v4v6 715 | if [[ -n $v4 && -n $v6 ]]; then 716 | green "当前原生v4+v6双栈vps首次安装warp-go\n现添加WARP IPV4(IP出站表现:原生 IPV6 + WARP IPV4)" && sleep 2 717 | wpgo1=$wgo1 && wpgo2=$wgo4 && wpgo3=$wgo8 && WGCFins 718 | fi 719 | if [[ -n $v6 && -z $v4 ]]; then 720 | green "当前原生v6单栈vps首次安装warp-go\n现添加WARP IPV4(IP出站表现:原生 IPV6 + WARP IPV4)" && sleep 2 721 | wpgo1=$wgo1 && wpgo2=$wgo5 && wpgo3=$wgo7 && nat4 && WGCFins 722 | fi 723 | if [[ -z $v6 && -n $v4 ]]; then 724 | green "当前原生v4单栈vps首次安装warp-go\n现添加WARP IPV4(IP出站表现:仅WARP IPV4)" && sleep 2 725 | wpgo1=$wgo1 && wpgo2=$wgo4 && wpgo3=$wgo6 && WGCFins 726 | fi 727 | echo 'w4' > /root/warpip/wp.log && xyz && WGCFmenu 728 | first4 729 | else 730 | kill -15 $(pgrep warp-go) >/dev/null 2>&1 731 | sleep 2 && v4v6 732 | if [[ -n $v4 && -n $v6 ]]; then 733 | green "当前原生v4+v6双栈vps已安装warp-go\n现快速切换WARP IPV4(IP出站表现:原生 IPV6 + WARP IPV4)" && sleep 2 734 | wpgo1=$wgo1 && ABC 735 | fi 736 | if [[ -n $v6 && -z $v4 ]]; then 737 | green "当前原生v6单栈vps已安装warp-go\n现快速切换WARP IPV4(IP出站表现:原生 IPV6 + WARP IPV4)" && sleep 2 738 | wpgo1=$wgo1 && ABC 739 | fi 740 | if [[ -z $v6 && -n $v4 ]]; then 741 | green "当前原生v4单栈vps已安装warp-go\n现快速切换WARP IPV4(IP出站表现:仅WARP IPV4)" && sleep 2 742 | wpgo1=$wgo1 && ABC 743 | fi 744 | echo 'w4' > /root/warpip/wp.log 745 | cat /usr/local/bin/warp.conf && sleep 2 746 | CheckWARP && first4 && ShowWGCF && WGCFmenu 747 | fi 748 | } 749 | 750 | WGCFv6(){ 751 | yellow "稍等3秒,检测VPS内warp环境" 752 | docker && checkwgcf 753 | if [[ ! $wgcfv4 =~ on|plus && ! $wgcfv6 =~ on|plus ]]; then 754 | v4v6 755 | if [[ -n $v4 && -n $v6 ]]; then 756 | green "当前原生v4+v6双栈vps首次安装warp-go\n现添加WARP IPV6(IP出站表现:原生 IPV4 + WARP IPV6)" && sleep 2 757 | wpgo1=$wgo2 && wpgo2=$wgo4 && wpgo3=$wgo8 && WGCFins 758 | fi 759 | if [[ -n $v6 && -z $v4 ]]; then 760 | green "当前原生v6单栈vps首次安装warp-go\n现添加WARP IPV6(IP出站表现:仅WARP IPV6)" && sleep 2 761 | wpgo1=$wgo2 && wpgo2=$wgo5 && wpgo3=$wgo7 && nat4 && WGCFins 762 | fi 763 | if [[ -z $v6 && -n $v4 ]]; then 764 | green "当前原生v4单栈vps首次安装warp-go\n现添加WARP IPV6(IP出站表现:原生 IPV4 + WARP IPV6)" && sleep 2 765 | wpgo1=$wgo2 && wpgo2=$wgo4 && wpgo3=$wgo6 && WGCFins 766 | fi 767 | echo 'w6' > /root/warpip/wp.log && xyz && WGCFmenu 768 | first4 769 | else 770 | kill -15 $(pgrep warp-go) >/dev/null 2>&1 771 | sleep 2 && v4v6 772 | if [[ -n $v4 && -n $v6 ]]; then 773 | green "当前原生v4+v6双栈vps已安装warp-go\n现快速切换WARP IPV6(IP出站表现:原生 IPV4 + WARP IPV6)" && sleep 2 774 | wpgo1=$wgo2 && ABC 775 | fi 776 | if [[ -n $v6 && -z $v4 ]]; then 777 | green "当前原生v6单栈vps已安装warp-go\n现快速切换WARP IPV6(IP出站表现:仅WARP IPV6)" && sleep 2 778 | wpgo1=$wgo2 && ABC 779 | fi 780 | if [[ -z $v6 && -n $v4 ]]; then 781 | green "当前原生v4单栈vps已安装warp-go\n现快速切换WARP IPV6(IP出站表现:原生 IPV4 + WARP IPV6)" && sleep 2 782 | wpgo1=$wgo2 && ABC 783 | fi 784 | echo 'w6' > /root/warpip/wp.log 785 | cat /usr/local/bin/warp.conf && sleep 2 786 | CheckWARP && first4 && ShowWGCF && WGCFmenu 787 | fi 788 | } 789 | 790 | WGCFv4v6(){ 791 | yellow "稍等3秒,检测VPS内warp环境" 792 | docker && checkwgcf 793 | if [[ ! $wgcfv4 =~ on|plus && ! $wgcfv6 =~ on|plus ]]; then 794 | v4v6 795 | if [[ -n $v4 && -n $v6 ]]; then 796 | green "当前原生v4+v6双栈vps首次安装warp-go\n现添加WARP IPV4+IPV6(IP出站表现:WARP双栈 IPV4 + IPV6)" && sleep 2 797 | wpgo1=$wgo3 && wpgo2=$wgo4 && wpgo3=$wgo8 && WGCFins 798 | fi 799 | if [[ -n $v6 && -z $v4 ]]; then 800 | green "当前原生v6单栈vps首次安装warp-go\n现添加WARP IPV4+IPV6(IP出站表现:WARP双栈 IPV4 + IPV6)" && sleep 2 801 | wpgo1=$wgo3 && wpgo2=$wgo5 && wpgo3=$wgo7 && nat4 && WGCFins 802 | fi 803 | if [[ -z $v6 && -n $v4 ]]; then 804 | green "当前原生v4单栈vps首次安装warp-go\n现添加WARP IPV4+IPV6(IP出站表现:WARP双栈 IPV4 + IPV6)" && sleep 2 805 | wpgo1=$wgo3 && wpgo2=$wgo4 && wpgo3=$wgo6 && WGCFins 806 | fi 807 | echo 'w64' > /root/warpip/wp.log && xyz && WGCFmenu 808 | first4 809 | else 810 | kill -15 $(pgrep warp-go) >/dev/null 2>&1 811 | sleep 2 && v4v6 812 | if [[ -n $v4 && -n $v6 ]]; then 813 | green "当前原生v4+v6双栈vps已安装warp-go\n现快速切换WARP IPV4+IPV6(IP出站表现:WARP双栈 IPV4 + IPV6)" && sleep 2 814 | wpgo1=$wgo3 && ABC 815 | fi 816 | if [[ -n $v6 && -z $v4 ]]; then 817 | green "当前原生v6单栈vps已安装warp-go\n现快速切换WARP IPV4+IPV6(IP出站表现:WARP双栈 IPV4 + IPV6)" && sleep 2 818 | wpgo1=$wgo3 && ABC 819 | fi 820 | if [[ -z $v6 && -n $v4 ]]; then 821 | green "当前原生v4单栈vps已安装warp-go\n现快速切换WARP IPV4+IPV6(IP出站表现:WARP双栈 IPV4 + IPV6)" && sleep 2 822 | wpgo1=$wgo3 && ABC 823 | fi 824 | echo 'w64' > /root/warpip/wp.log 825 | cat /usr/local/bin/warp.conf && sleep 2 826 | CheckWARP && first4 && ShowWGCF && WGCFmenu 827 | fi 828 | } 829 | 830 | ABC(){ 831 | echo $wpgo1 | sh 832 | echo $wpgo2 | sh 833 | echo $wpgo3 | sh 834 | echo $wpgo4 | sh 835 | } 836 | 837 | dns(){ 838 | if [[ ! -f /etc/resolv.conf.bak ]]; then 839 | mv /etc/resolv.conf /etc/resolv.conf.bak 840 | rm -rf /etc/resolv.conf 841 | cp -f /etc/resolv.conf.bak /etc/resolv.conf 842 | chattr +i /etc/resolv.conf >/dev/null 2>&1 843 | else 844 | chattr +i /etc/resolv.conf >/dev/null 2>&1 845 | fi 846 | } 847 | 848 | WGCFins(){ 849 | if [[ $release = Centos ]]; then 850 | yum install epel-release -y;yum install iproute iputils -y 851 | elif [[ $release = Debian ]]; then 852 | apt install lsb-release -y 853 | echo "deb http://deb.debian.org/debian $(lsb_release -sc)-backports main" | tee /etc/apt/sources.list.d/backports.list 854 | apt update -y;apt install iproute2 openresolv dnsutils iputils-ping -y 855 | elif [[ $release = Ubuntu ]]; then 856 | apt update -y;apt install iproute2 openresolv dnsutils iputils-ping -y 857 | fi 858 | wget -N https://gitlab.com/rwkgyg/CFwarp/-/raw/main/warp-go_1.0.8_linux_${cpu} -O /usr/local/bin/warp-go && chmod +x /usr/local/bin/warp-go 859 | yellow "正在申请WARP普通账户,请稍等!" 860 | if [[ ! -s /usr/local/bin/warp.conf ]]; then 861 | cpujg 862 | curl -L -o warpapi -# --retry 2 https://gitlab.com/rwkgyg/CFwarp/-/raw/main/point/cpu1/$cpu 863 | chmod +x warpapi 864 | output=$(./warpapi) 865 | private_key=$(echo "$output" | awk -F ': ' '/private_key/{print $2}') 866 | device_id=$(echo "$output" | awk -F ': ' '/device_id/{print $2}') 867 | warp_token=$(echo "$output" | awk -F ': ' '/token/{print $2}') 868 | rm -rf warpapi 869 | cat > /usr/local/bin/warp.conf < /lib/systemd/system/warp-go.service << EOF 892 | [Unit] 893 | Description=warp-go service 894 | After=network.target 895 | Documentation=https://gitlab.com/ProjectWARP/warp-go 896 | [Service] 897 | WorkingDirectory=/root/ 898 | ExecStart=/usr/local/bin/warp-go --config=/usr/local/bin/warp.conf 899 | Environment="LOG_LEVEL=verbose" 900 | RemainAfterExit=yes 901 | Restart=always 902 | [Install] 903 | WantedBy=multi-user.target 904 | EOF 905 | ABC 906 | systemctl daemon-reload 907 | systemctl enable warp-go 908 | systemctl start warp-go 909 | restwarpgo 910 | cat /usr/local/bin/warp.conf && sleep 2 911 | checkwgcf 912 | if [[ $wgcfv4 =~ on|plus || $wgcfv6 =~ on|plus ]]; then 913 | green "恭喜!warp的IP获取成功!" && dns 914 | else 915 | CheckWARP 916 | fi 917 | ShowWGCF && lncf && reswarp 918 | curl -sL https://raw.githubusercontent.com/yonggekkk/warp-yg/main/version | awk -F "更新内容" '{print $1}' | head -n 1 > /root/warpip/v 919 | } 920 | 921 | warpinscha(){ 922 | yellow "提示:VPS的本地出站IP将被你选择的warp的IP所接管,如VPS本地无该出站IP,则被另外生成warp的IP所接管" 923 | echo 924 | green "1. 安装/切换WARP单栈IPV4(回车默认)" 925 | green "2. 安装/切换WARP单栈IPV6" 926 | green "3. 安装/切换WARP双栈IPV4+IPV6" 927 | readp "\n请选择:" wgcfwarp 928 | if [ -z "${wgcfwarp}" ] || [ $wgcfwarp == "1" ];then 929 | WGCFv4 930 | elif [ $wgcfwarp == "2" ];then 931 | WGCFv6 932 | elif [ $wgcfwarp == "3" ];then 933 | WGCFv4v6 934 | else 935 | red "输入错误,请重新选择" && warpinscha 936 | fi 937 | echo 938 | } 939 | 940 | WARPup(){ 941 | freewarp(){ 942 | kill -15 $(pgrep warp-go) >/dev/null 2>&1 && sleep 2 943 | v4v6 944 | allowips=$(cat /usr/local/bin/warp.conf | grep AllowedIPs) 945 | if [[ -n $v4 && -n $v6 ]]; then 946 | endp=$wgo4 947 | post=$wgo8 948 | elif [[ -n $v6 && -z $v4 ]]; then 949 | endp=$wgo5 950 | [[ -n $(ip route get 1.1.1.1 2>/dev/null | grep -oP 'src \K\S+') ]] && post=$wgo8 || post=$wgo7 951 | elif [[ -z $v6 && -n $v4 ]]; then 952 | endp=$wgo4 953 | post=$wgo6 954 | fi 955 | yellow "当前执行:申请WARP普通账户" 956 | echo 957 | yellow "正在申请WARP普通账户,请稍等!" 958 | rm -rf /usr/local/bin/warp.conf /usr/local/bin/warp.conf.bak /usr/local/bin/warpplus.log 959 | curl -Ls -o /usr/local/bin/warp.conf --retry 2 https://api.zeroteam.top/warp?format=warp-go 960 | if [[ ! -s /usr/local/bin/warp.conf ]]; then 961 | cpujg 962 | curl -Ls -o warpapi --retry 2 https://gitlab.com/rwkgyg/CFwarp/-/raw/main/point/cpu1/$cpu 963 | chmod +x warpapi 964 | output=$(./warpapi) 965 | private_key=$(echo "$output" | awk -F ': ' '/private_key/{print $2}') 966 | device_id=$(echo "$output" | awk -F ': ' '/device_id/{print $2}') 967 | warp_token=$(echo "$output" | awk -F ': ' '/token/{print $2}') 968 | rm -rf warpapi 969 | cat > /usr/local/bin/warp.conf <> /usr/local/bin/warpplus.log && echo "$ID" >> /usr/local/bin/warpplus.log 1031 | green "WARP+ 账户升级成功!" && ShowWGCF && WGCFmenu && break 1032 | else 1033 | red "WARP+账户升级失败!" && sleep 1 1034 | fi 1035 | done 1036 | if [[ ! $wgcfv4 = plus && ! $wgcfv6 = plus ]]; then 1037 | green "建议如下:" 1038 | yellow "1. 检查1.1.1.1 APP中的WARP+账户或网络分享的秘钥是否有流量" 1039 | yellow "2. 检查当前WARP许可证密钥绑定的设备超过5台,请进入手机端进行设备移除再尝试升级WARP+账户" && sleep 2 1040 | freewarp 1041 | fi 1042 | fi 1043 | 1044 | if [[ $warpup == 3 ]]; then 1045 | [[ ! $(type -P warp-go) ]] && red "未安装warp-go" && exit 1046 | green "Zero Trust团队Token获取地址:https://web--public--warp-team-api--coia-mfs4.code.run/" 1047 | readp "请输入团队账户Token: " token 1048 | curl -Ls -o /usr/local/bin/warp.conf.bak --retry 2 https://api.zeroteam.top/warp?format=warp-go 1049 | if [[ ! -s /usr/local/bin/warp.conf.bak ]]; then 1050 | cpujg 1051 | curl -Ls -o warpapi --retry 2 https://gitlab.com/rwkgyg/CFwarp/-/raw/main/point/cpu1/$cpu 1052 | chmod +x warpapi 1053 | output=$(./warpapi) 1054 | private_key=$(echo "$output" | awk -F ': ' '/private_key/{print $2}') 1055 | device_id=$(echo "$output" | awk -F ': ' '/device_id/{print $2}') 1056 | warp_token=$(echo "$output" | awk -F ': ' '/token/{print $2}') 1057 | rm -rf warpapi 1058 | cat > /usr/local/bin/warp.conf.bak </dev/null 2>&1 1077 | sed -i "4s#.*#$(sed -ne 4p /usr/local/bin/warp.conf.bak)#;5s#.*#$(sed -ne 5p /usr/local/bin/warp.conf.bak)#" /usr/local/bin/warp.conf >/dev/null 2>&1 1078 | i=0 1079 | while [ $i -le 9 ]; do let i++ 1080 | yellow "共执行10次,第$i次获取warp的IP中……" 1081 | restwarpgo 1082 | checkwgcf 1083 | if [[ $wgcfv4 = plus || $wgcfv6 = plus ]]; then 1084 | rm -rf /usr/local/bin/warp.conf.bak /usr/local/bin/warpplus.log 1085 | green "WARP Teams账户升级成功!" && ShowWGCF && WGCFmenu && break 1086 | else 1087 | red "WARP Teams账户升级失败!" && sleep 1 1088 | fi 1089 | done 1090 | if [[ ! $wgcfv4 = plus && ! $wgcfv6 = plus ]]; then 1091 | freewarp 1092 | fi 1093 | fi 1094 | } 1095 | 1096 | WARPonoff(){ 1097 | [[ ! $(type -P warp-go) ]] && red "WARP未安装,建议重新安装" && exit 1098 | readp "1. 关闭WARP功能(关闭WARP在线监测)\n2. 开启/重启WARP功能(启动WARP在线监测)\n0. 返回上一层\n 请选择:" unwp 1099 | if [ "$unwp" == "1" ]; then 1100 | kill -15 $(pgrep warp-go) >/dev/null 2>&1 && sleep 2 1101 | systemctl disable warp-go 1102 | screen -ls | awk '/\.up/ {print $1}' | cut -d "." -f 1 | xargs kill 2>/dev/null 1103 | unreswarp 1104 | checkwgcf 1105 | [[ ! $wgcfv4 =~ on|plus && ! $wgcfv6 =~ on|plus ]] && green "关闭WARP成功" || red "关闭WARP失败" 1106 | elif [ "$unwp" == "2" ]; then 1107 | CheckWARP 1108 | xyz 1109 | name=`screen -ls | grep '(Detached)' | awk '{print $1}' | awk -F "." '{print $2}'` 1110 | [[ $name =~ "up" ]] && green "WARP在线监测启动成功" || red "WARP在线监测启动失败,查看screen是否安装成功" 1111 | reswarp 1112 | checkwgcf 1113 | [[ $wgcfv4 =~ on|plus || $wgcfv6 =~ on|plus ]] && green "开启warp成功" || red "开启warp失败" 1114 | else 1115 | cf 1116 | fi 1117 | } 1118 | 1119 | cwg(){ 1120 | screen -ls | awk '/\.up/ {print $1}' | cut -d "." -f 1 | xargs kill 2>/dev/null 1121 | systemctl disable warp-go >/dev/null 2>&1 1122 | kill -15 $(pgrep warp-go) >/dev/null 2>&1 1123 | chattr -i /etc/resolv.conf >/dev/null 2>&1 1124 | sed -i '/^precedence ::ffff:0:0\/96 100/d' /etc/gai.conf 2>/dev/null 1125 | rm -rf /usr/local/bin/warp-go /usr/local/bin/warpplus.log /usr/local/bin/warp.conf /usr/local/bin/wgwarp.conf /usr/local/bin/sbwarp.json /usr/bin/warp-go /lib/systemd/system/warp-go.service /root/WARP-UP.sh 1126 | rm -rf /root/warpip 1127 | } 1128 | 1129 | changewarp(){ 1130 | cwg && ONEWGCFWARP 1131 | } 1132 | 1133 | upwarpgo(){ 1134 | kill -15 $(pgrep warp-go) >/dev/null 2>&1 && sleep 2 1135 | wget -N https://gitlab.com/rwkgyg/CFwarp/-/raw/main/warp-go_1.0.8_linux_${cpu} -O /usr/local/bin/warp-go && chmod +x /usr/local/bin/warp-go 1136 | restwarpgo 1137 | loVERSION="$(/usr/local/bin/warp-go -v | sed -n 1p | awk '{print $1}' | awk -F"/" '{print $NF}')" 1138 | green " 当前 WARP-GO 已安装内核版本号:${loVERSION} ,已是最新版本" 1139 | } 1140 | 1141 | start_menu(){ 1142 | ShowWGCF;ShowSOCKS5 1143 | clear 1144 | green "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" 1145 | echo -e "${bblue} ░██ ░██ ░██ ██ ██ ░█${plain}█ ░██ ░██ ░██ ░█${red}█ ░██${plain} " 1146 | echo -e "${bblue} ░██ ░██ ░██ ░░██${plain} ░██ ░██ ░██ ░██${red} ░██ ░██${plain} " 1147 | echo -e "${bblue} ░██ ░██ ░██ ${plain} ░██ ██ ░██ █${red}█ ░██ ██ ${plain} " 1148 | echo -e "${bblue} ░██ ░${plain}██ ░██ ██ ░██ ██ ░█${red}█ ██ ░██ ██ ${plain} " 1149 | echo -e "${bblue} ░██ ${plain} ░██ ░░██ ░██ ░██ ░${red}██ ░██ ░██ ░██ ${plain} " 1150 | echo -e "${bblue} ░█${plain}█ ░██ ██ ██ ░██ ░░${red}██ ░██ ░░██ ░██ ░░██ ${plain} " 1151 | echo 1152 | white "甬哥Github项目 :github.com/yonggekkk" 1153 | white "甬哥Blogger博客 :ygkkk.blogspot.com" 1154 | white "甬哥YouTube频道 :www.youtube.com/@ygkkk" 1155 | green "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" 1156 | yellow " 任意选择适合自己的warp现实方案(选项1、2、3,可单选,可多选共存)" 1157 | yellow " 进入脚本快捷方式:cf" 1158 | white " =================================================================" 1159 | green " 1. 方案一:安装/切换WARP-GO" 1160 | green " 2. 方案二:安装Socks5-WARP" 1161 | green " 3. 方案三:生成WARP-Wireguard配置文件、二维码" 1162 | green " 4. 卸载WARP" 1163 | white " -----------------------------------------------------------------" 1164 | green " 5. 关闭、开启/重启WARP" 1165 | green " 6. WARP其他选项" 1166 | green " 7. WARP三类账户升级/切换" 1167 | green " 8. 更新CFwarp安装脚本" 1168 | green " 9. 更新WARP-GO内核" 1169 | green " 10. 将当前WARP-GO内核替换为WGCF-WARP内核" 1170 | green " 0. 退出脚本 " 1171 | red "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" 1172 | cfwarpshow 1173 | red "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" 1174 | white " VPS系统信息如下:" 1175 | white " 操作系统: $(blue "$op") \c" && white " 内核版本: $(blue "$version") \c" && white " CPU架构 : $(blue "$cpu") \c" && white " 虚拟化类型: $(blue "$vi")" 1176 | WGCFmenu 1177 | S5menu 1178 | echo 1179 | readp " 请输入数字:" Input 1180 | case "$Input" in 1181 | 1 ) warpinscha;; 1182 | 2 ) SOCKS5ins;; 1183 | 3 ) WGproxy;; 1184 | 4 ) WARPun;; 1185 | 5 ) WARPonoff;; 1186 | 6 ) WARPtools;; 1187 | 7 ) WARPup;; 1188 | 8 ) UPwpyg;; 1189 | 9 ) upwarpgo;; 1190 | 10 ) changewarp;; 1191 | * ) exit 1192 | esac 1193 | } 1194 | if [ $# == 0 ]; then 1195 | bit=`uname -m` 1196 | [[ $bit = aarch64 ]] && cpu=arm64 1197 | if [[ $bit = x86_64 ]]; then 1198 | amdv=$(cat /proc/cpuinfo | grep flags | head -n 1 | cut -d: -f2) 1199 | case "$amdv" in 1200 | *avx512*) cpu=amd64v4;; 1201 | *avx2*) cpu=amd64v3;; 1202 | *sse3*) cpu=amd64v2;; 1203 | *) cpu=amd64;; 1204 | esac 1205 | fi 1206 | start_menu 1207 | fi 1208 | } 1209 | 1210 | ONEWGCFWARP(){ 1211 | if [[ $(echo "$op" | grep -i -E "arch|alpine") ]]; then 1212 | red "脚本不支持当前的 $op 系统,请选择使用Ubuntu,Debian,Centos系统。" && exit 1213 | fi 1214 | yellow "\n 请稍等,当前为wgcf核心安装模式,检测对端IP与出站情况……" 1215 | warpip 1216 | 1217 | ud4='sed -i "7 s/^/PostUp = ip -4 rule add from $(ip route get 162.159.192.1 | grep -oP '"'src \K\S+') lookup main\n/"'" /etc/wireguard/wgcf.conf && sed -i "7 s/^/PostDown = ip -4 rule delete from $(ip route get 162.159.192.1 | grep -oP '"'src \K\S+') lookup main\n/"'" /etc/wireguard/wgcf.conf' 1218 | ud6='sed -i "7 s/^/PostUp = ip -6 rule add from $(ip route get 2606:4700:d0::a29f:c001 | grep -oP '"'src \K\S+') lookup main\n/"'" /etc/wireguard/wgcf.conf && sed -i "7 s/^/PostDown = ip -6 rule delete from $(ip route get 2606:4700:d0::a29f:c001 | grep -oP '"'src \K\S+') lookup main\n/"'" /etc/wireguard/wgcf.conf' 1219 | ud4ud6='sed -i "7 s/^/PostUp = ip -4 rule add from $(ip route get 162.159.192.1 | grep -oP '"'src \K\S+') lookup main\n/"'" /etc/wireguard/wgcf.conf && sed -i "7 s/^/PostDown = ip -4 rule delete from $(ip route get 162.159.192.1 | grep -oP '"'src \K\S+') lookup main\n/"'" /etc/wireguard/wgcf.conf && sed -i "7 s/^/PostUp = ip -6 rule add from $(ip route get 2606:4700:d0::a29f:c001 | grep -oP '"'src \K\S+') lookup main\n/"'" /etc/wireguard/wgcf.conf && sed -i "7 s/^/PostDown = ip -6 rule delete from $(ip route get 2606:4700:d0::a29f:c001 | grep -oP '"'src \K\S+') lookup main\n/"'" /etc/wireguard/wgcf.conf' 1220 | c1="sed -i '/0\.0\.0\.0\/0/d' /etc/wireguard/wgcf.conf" 1221 | c2="sed -i '/\:\:\/0/d' /etc/wireguard/wgcf.conf" 1222 | c3="sed -i "s/engage.cloudflareclient.com:2408/$endpoint/g" /etc/wireguard/wgcf.conf" 1223 | c4="sed -i "s/engage.cloudflareclient.com:2408/$endpoint/g" /etc/wireguard/wgcf.conf" 1224 | c5="sed -i 's/1.1.1.1/1.1.1.1,8.8.8.8,8.8.4.4,2606:4700:4700::1111,2001:4860:4860::8888,2001:4860:4860::8844/g' /etc/wireguard/wgcf.conf" 1225 | c6="sed -i 's/1.1.1.1/2606:4700:4700::1111,2001:4860:4860::8888,2001:4860:4860::8844,1.1.1.1,8.8.8.8,8.8.4.4/g' /etc/wireguard/wgcf.conf" 1226 | 1227 | ShowWGCF(){ 1228 | UA_Browser="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.87 Safari/537.36" 1229 | v4v6 1230 | warppflow=$((`grep -oP '"quota":\K\d+' <<< $(curl -sm4 "https://api.cloudflareclient.com/v0a884/reg/$(grep 'device_id' /etc/wireguard/wgcf-account.toml 2>/dev/null | cut -d \' -f2)" -H "User-Agent: okhttp/3.12.1" -H "Authorization: Bearer $(grep 'access_token' /etc/wireguard/wgcf-account.toml 2>/dev/null | cut -d \' -f2)")`)) 1231 | flow=`echo "scale=2; $warppflow/1000000000" | bc` 1232 | [[ -e /etc/wireguard/wgcf+p.log ]] && cfplus="WARP+账户(有限WARP+流量:$flow GB),设备名称:$(grep -s 'Device name' /etc/wireguard/wgcf+p.log | awk '{ print $NF }')" || cfplus="WARP+Teams账户(无限WARP+流量)" 1233 | if [[ -n $v4 ]]; then 1234 | nf4 1235 | chatgpt4 1236 | checkgpt 1237 | wgcfv4=$(curl -s4 https://www.cloudflare.com/cdn-cgi/trace -k | grep warp | cut -d= -f2) 1238 | isp4a=`curl -sm3 --user-agent "${UA_Browser}" http://ip-api.com/json/$v4?lang=zh-CN -k | cut -f13 -d ":" | cut -f2 -d '"'` 1239 | isp4b=`curl -sm3 --user-agent "${UA_Browser}" https://api.ip.sb/geoip/$v4 -k | awk -F "isp" '{print $2}' | awk -F "offset" '{print $1}' | sed "s/[,\":]//g"` 1240 | [[ -n $isp4a ]] && isp4=$isp4a || isp4=$isp4b 1241 | nonf=$(curl -sm3 --user-agent "${UA_Browser}" http://ip-api.com/json/$v4?lang=zh-CN -k | cut -f2 -d"," | cut -f4 -d '"') 1242 | #sunf=$(./nf | awk '{print $1}' | sed -n '4p') 1243 | #snnf=$(curl -s4m6 ip.p3terx.com -k | sed -n 2p | awk '{print $3}') 1244 | country=$nonf 1245 | case ${wgcfv4} in 1246 | plus) 1247 | WARPIPv4Status=$(white "WARP+状态:\c" ; rred "运行中,$cfplus" ; white " 服务商 Cloudflare 获取IPV4地址:\c" ; rred "$v4 $country" ; white " 奈飞NF解锁情况:\c" ; rred "$NF" ; white " ChatGPT解锁情况:\c" ; rred "$chat");; 1248 | on) 1249 | WARPIPv4Status=$(white "WARP状态:\c" ; green "运行中,WARP普通账户(无限WARP流量)" ; white " 服务商 Cloudflare 获取IPV4地址:\c" ; green "$v4 $country" ; white " 奈飞NF解锁情况:\c" ; green "$NF" ; white " ChatGPT解锁情况:\c" ; green "$chat");; 1250 | off) 1251 | WARPIPv4Status=$(white "WARP状态:\c" ; yellow "关闭中" ; white " 服务商 $isp4 获取IPV4地址:\c" ; yellow "$v4 $country" ; white " 奈飞NF解锁情况:\c" ; yellow "$NF" ; white " ChatGPT解锁情况:\c" ; yellow "$chat");; 1252 | esac 1253 | else 1254 | WARPIPv4Status=$(white "IPV4状态:\c" ; red "不存在IPV4地址 ") 1255 | fi 1256 | if [[ -n $v6 ]]; then 1257 | nf6 1258 | chatgpt6 1259 | checkgpt 1260 | wgcfv6=$(curl -s6 https://www.cloudflare.com/cdn-cgi/trace -k | grep warp | cut -d= -f2) 1261 | isp6a=`curl -sm3 --user-agent "${UA_Browser}" http://ip-api.com/json/$v6?lang=zh-CN -k | cut -f13 -d":" | cut -f2 -d '"'` 1262 | isp6b=`curl -sm3 --user-agent "${UA_Browser}" https://api.ip.sb/geoip/$v6 -k | awk -F "isp" '{print $2}' | awk -F "offset" '{print $1}' | sed "s/[,\":]//g"` 1263 | [[ -n $isp6a ]] && isp6=$isp6a || isp6=$isp6b 1264 | nonf=$(curl -sm3 --user-agent "${UA_Browser}" http://ip-api.com/json/$v6?lang=zh-CN -k | cut -f2 -d"," | cut -f4 -d '"') 1265 | #sunf=$(./nf | awk '{print $1}' | sed -n '8p') 1266 | #snnf=$(curl -s6m6 ip.p3terx.com -k | sed -n 2p | awk '{print $3}') 1267 | country=$nonf 1268 | case ${wgcfv6} in 1269 | plus) 1270 | WARPIPv6Status=$(white "WARP+状态:\c" ; rred "运行中,$cfplus" ; white " 服务商 Cloudflare 获取IPV6地址:\c" ; rred "$v6 $country" ; white " 奈飞NF解锁情况:\c" ; rred "$NF" ; white " ChatGPT解锁情况:\c" ; rred "$chat");; 1271 | on) 1272 | WARPIPv6Status=$(white "WARP状态:\c" ; green "运行中,WARP普通账户(无限WARP流量)" ; white " 服务商 Cloudflare 获取IPV6地址:\c" ; green "$v6 $country" ; white " 奈飞NF解锁情况:\c" ; green "$NF" ; white " ChatGPT解锁情况:\c" ; green "$chat");; 1273 | off) 1274 | WARPIPv6Status=$(white "WARP状态:\c" ; yellow "关闭中" ; white " 服务商 $isp6 获取IPV6地址:\c" ; yellow "$v6 $country" ; white " 奈飞NF解锁情况:\c" ; yellow "$NF" ; white " ChatGPT解锁情况:\c" ; yellow "$chat");; 1275 | esac 1276 | else 1277 | WARPIPv6Status=$(white "IPV6状态:\c" ; red "不存在IPV6地址 ") 1278 | fi 1279 | } 1280 | 1281 | STOPwgcf(){ 1282 | if [[ $(type -P warp-cli) ]]; then 1283 | red "已安装Socks5-WARP,不支持当前选择的wgcf-warp安装方案" 1284 | systemctl restart wg-quick@wgcf && cf 1285 | fi 1286 | } 1287 | 1288 | fawgcf(){ 1289 | rm -f /etc/wireguard/wgcf+p.log 1290 | ID=$(cat /etc/wireguard/buckup-account.toml | grep license_key | awk '{print $3}') 1291 | sed -i "s/license_key.*/license_key = $ID/g" /etc/wireguard/wgcf-account.toml 1292 | cd /etc/wireguard && wgcf update >/dev/null 2>&1 1293 | wgcf generate >/dev/null 2>&1 && cd 1294 | sed -i "2s#.*#$(sed -ne 2p /etc/wireguard/wgcf-profile.conf)#;4s#.*#$(sed -ne 4p /etc/wireguard/wgcf-profile.conf)#" /etc/wireguard/wgcf.conf 1295 | CheckWARP && ShowWGCF && WGCFmenu 1296 | } 1297 | 1298 | ABC(){ 1299 | echo $ABC1 | sh 1300 | echo $ABC2 | sh 1301 | echo $ABC3 | sh 1302 | echo $ABC4 | sh 1303 | echo $ABC5 | sh 1304 | } 1305 | 1306 | conf(){ 1307 | rm -rf /etc/wireguard/wgcf.conf 1308 | cp -f /etc/wireguard/buckup-profile.conf /etc/wireguard/wgcf.conf >/dev/null 2>&1 1309 | cp -f /etc/wireguard/wgcf-profile.conf /etc/wireguard/buckup-profile.conf >/dev/null 2>&1 1310 | } 1311 | 1312 | nat4(){ 1313 | [[ -n $(ip route get 162.159.192.1 2>/dev/null | grep -oP 'src \K\S+') ]] && ABC4=$ud4 || ABC4=echo 1314 | } 1315 | 1316 | WGCFv4(){ 1317 | yellow "稍等3秒,检测VPS内warp环境" 1318 | docker && checkwgcf 1319 | if [[ ! $wgcfv4 =~ on|plus && ! $wgcfv6 =~ on|plus ]]; then 1320 | v4v6 1321 | if [[ -n $v4 && -n $v6 ]]; then 1322 | green "当前原生v4+v6双栈vps首次安装wgcf-warp\n现添加IPV4单栈wgcf-warp模式" && sleep 2 1323 | ABC1=$c5 && ABC2=$c2 && ABC3=$ud4 && ABC4=$c3 && WGCFins 1324 | fi 1325 | if [[ -n $v6 && -z $v4 ]]; then 1326 | green "当前原生v6单栈vps首次安装wgcf-warp\n现添加IPV4单栈wgcf-warp模式" && sleep 2 1327 | ABC1=$c5 && ABC2=$c4 && ABC3=$c2 && nat4 && WGCFins 1328 | fi 1329 | if [[ -z $v6 && -n $v4 ]]; then 1330 | green "当前原生v4单栈vps首次安装wgcf-warp\n现添加IPV4单栈wgcf-warp模式" && sleep 2 1331 | ABC1=$c5 && ABC2=$c2 && ABC3=$c3 && ABC4=$ud4 && WGCFins 1332 | fi 1333 | echo 'w4' > /root/warpip/wp.log && xyz && WGCFmenu 1334 | first4 1335 | else 1336 | wg-quick down wgcf >/dev/null 2>&1 1337 | sleep 1 && v4v6 1338 | if [[ -n $v4 && -n $v6 ]]; then 1339 | green "当前原生v4+v6双栈vps已安装wgcf-warp\n现快速切换IPV4单栈wgcf-warp模式" && sleep 2 1340 | conf && ABC1=$c5 && ABC2=$c2 && ABC3=$ud4 && ABC4=$c3 && ABC 1341 | fi 1342 | if [[ -n $v6 && -z $v4 ]]; then 1343 | green "当前原生v6单栈vps已安装wgcf-warp\n现快速切换IPV4单栈wgcf-warp模式" && sleep 2 1344 | conf && ABC1=$c5 && ABC2=$c4 && ABC3=$c2 && nat4 && ABC 1345 | fi 1346 | if [[ -z $v6 && -n $v4 ]]; then 1347 | green "当前原生v4单栈vps已安装wgcf-warp\n现快速切换IPV4单栈wgcf-warp模式" && sleep 2 1348 | conf && ABC1=$c5 && ABC2=$c2 && ABC3=$c3 && ABC4=$ud4 && ABC 1349 | fi 1350 | echo 'w4' > /root/warpip/wp.log 1351 | cat /etc/wireguard/wgcf.conf && sleep 2 1352 | CheckWARP && first4 && ShowWGCF && WGCFmenu 1353 | fi 1354 | } 1355 | 1356 | WGCFv6(){ 1357 | yellow "稍等3秒,检测VPS内warp环境" 1358 | docker && checkwgcf 1359 | if [[ ! $wgcfv4 =~ on|plus && ! $wgcfv6 =~ on|plus ]]; then 1360 | v4v6 1361 | if [[ -n $v4 && -n $v6 ]]; then 1362 | green "当前原生v4+v6双栈vps首次安装wgcf-warp\n现添加IPV6单栈wgcf-warp模式" && sleep 2 1363 | ABC1=$c5 && ABC2=$c1 && ABC3=$ud6 && ABC4=$c3 && WGCFins 1364 | fi 1365 | if [[ -n $v6 && -z $v4 ]]; then 1366 | green "当前原生v6单栈vps首次安装wgcf-warp\n现添加IPV6单栈wgcf-warp模式(无IPV4!!!)" && sleep 2 1367 | ABC1=$c6 && ABC2=$c1 && ABC3=$c4 && nat4 && ABC5=$ud6 && WGCFins 1368 | fi 1369 | if [[ -z $v6 && -n $v4 ]]; then 1370 | green "当前原生v4单栈vps首次安装wgcf-warp\n现添加IPV6单栈wgcf-warp模式" && sleep 2 1371 | ABC1=$c5 && ABC2=$c3 && ABC3=$c1 && WGCFins 1372 | fi 1373 | echo 'w6' > /root/warpip/wp.log && xyz && WGCFmenu 1374 | first4 1375 | else 1376 | wg-quick down wgcf >/dev/null 2>&1 1377 | sleep 1 && v4v6 1378 | if [[ -n $v4 && -n $v6 ]]; then 1379 | green "当前原生v4+v6双栈vps已安装wgcf-warp\n现快速切换IPV6单栈wgcf-warp模式" && sleep 2 1380 | conf && ABC1=$c5 && ABC2=$c1 && ABC3=$ud6 && ABC4=$c3 && ABC 1381 | fi 1382 | if [[ -n $v6 && -z $v4 ]]; then 1383 | green "当前原生v6单栈vps已安装wgcf-warp\n现快速切换IPV6单栈wgcf-warp模式(无IPV4!!!)" && sleep 2 1384 | conf && ABC1=$c6 && ABC2=$c1 && ABC3=$c4 && nat4 && ABC5=$ud6 && ABC 1385 | fi 1386 | if [[ -z $v6 && -n $v4 ]]; then 1387 | green "当前原生v4单栈vps已安装wgcf-warp\n现快速切换IPV6单栈wgcf-warp模式" && sleep 2 1388 | conf && ABC1=$c5 && ABC2=$c3 && ABC3=$c1 && ABC 1389 | fi 1390 | echo 'w6' > /root/warpip/wp.log 1391 | cat /etc/wireguard/wgcf.conf && sleep 2 1392 | CheckWARP && first4 && ShowWGCF && WGCFmenu 1393 | fi 1394 | } 1395 | 1396 | WGCFv4v6(){ 1397 | yellow "稍等3秒,检测VPS内warp环境" 1398 | docker && checkwgcf 1399 | if [[ ! $wgcfv4 =~ on|plus && ! $wgcfv6 =~ on|plus ]]; then 1400 | v4v6 1401 | if [[ -n $v4 && -n $v6 ]]; then 1402 | green "当前原生v4+v6双栈vps首次安装wgcf-warp\n现添加IPV4+IPV6双栈wgcf-warp模式" && sleep 2 1403 | ABC1=$c5 && ABC2=$ud4ud6 && ABC3=$c3 && WGCFins 1404 | fi 1405 | if [[ -n $v6 && -z $v4 ]]; then 1406 | green "当前原生v6单栈vps首次安装wgcf-warp\n现添加IPV4+IPV6双栈wgcf-warp模式" && sleep 2 1407 | ABC1=$c5 && ABC2=$c4 && ABC3=$ud6 && nat4 && WGCFins 1408 | fi 1409 | if [[ -z $v6 && -n $v4 ]]; then 1410 | green "当前原生v4单栈vps首次安装wgcf-warp\n现添加IPV4+IPV6双栈wgcf-warp模式" && sleep 2 1411 | ABC1=$c5 && ABC2=$c3 && ABC3=$ud4 && WGCFins 1412 | fi 1413 | echo 'w64' > /root/warpip/wp.log && xyz && WGCFmenu 1414 | first4 1415 | else 1416 | wg-quick down wgcf >/dev/null 2>&1 1417 | sleep 1 && v4v6 1418 | if [[ -n $v4 && -n $v6 ]]; then 1419 | green "当前原生v4+v6双栈vps已安装wgcf-warp\n现快速切换IPV4+IPV6双栈wgcf-warp模式" && sleep 2 1420 | conf && ABC1=$c5 && ABC2=$ud4ud6 && ABC3=$c3 && ABC 1421 | fi 1422 | if [[ -n $v6 && -z $v4 ]]; then 1423 | green "当前原生v6单栈vps已安装wgcf-warp\n现快速切换IPV4+IPV6双栈wgcf-warp模式" && sleep 2 1424 | conf && ABC1=$c5 && ABC2=$c4 && ABC3=$ud6 && nat4 && ABC 1425 | fi 1426 | if [[ -z $v6 && -n $v4 ]]; then 1427 | green "当前原生v4单栈vps已安装wgcf-warp\n现快速切换IPV4+IPV6双栈wgcf-warp模式" && sleep 2 1428 | conf && ABC1=$c5 && ABC2=$c3 && ABC3=$ud4 && ABC 1429 | fi 1430 | echo 'w64' > /root/warpip/wp.log 1431 | cat /etc/wireguard/wgcf.conf && sleep 2 1432 | CheckWARP && first4 && ShowWGCF && WGCFmenu 1433 | fi 1434 | } 1435 | 1436 | CheckWARP(){ 1437 | i=0 1438 | wg-quick down wgcf >/dev/null 2>&1 1439 | while [ $i -le 9 ]; do let i++ 1440 | yellow "共执行10次,第$i次获取warp的IP中……" 1441 | systemctl restart wg-quick@wgcf >/dev/null 2>&1 1442 | checkwgcf 1443 | [[ $wgcfv4 =~ on|plus || $wgcfv6 =~ on|plus ]] && green "恭喜!warp的IP获取成功!" && break || red "遗憾!warp的IP获取失败" 1444 | done 1445 | checkwgcf 1446 | if [[ ! $wgcfv4 =~ on|plus && ! $wgcfv6 =~ on|plus ]]; then 1447 | red "安装WARP失败,还原VPS,卸载Wgcf-WARP组件中……" 1448 | cwg 1449 | echo 1450 | [[ $release = Centos && ${vsid} -lt 7 ]] && yellow "当前系统版本号:Centos $vsid \n建议使用 Centos 7 以上系统 " 1451 | [[ $release = Ubuntu && ${vsid} -lt 18 ]] && yellow "当前系统版本号:Ubuntu $vsid \n建议使用 Ubuntu 18 以上系统 " 1452 | [[ $release = Debian && ${vsid} -lt 10 ]] && yellow "当前系统版本号:Debian $vsid \n建议使用 Debian 10 以上系统 " 1453 | yellow "提示:" 1454 | red "你或许可以使用方案二或方案三来实现WARP" 1455 | red "也可以选择WARP-GO核心来安装WARP方案一" 1456 | exit 1457 | else 1458 | green "ok" 1459 | fi 1460 | } 1461 | 1462 | WGCFins(){ 1463 | rm -rf /usr/local/bin/wgcf /etc/wireguard/wgcf.conf /etc/wireguard/wgcf-profile.conf /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 1464 | if [[ $release = Centos ]]; then 1465 | yum install epel-release -y;yum install iproute iptables wireguard-tools -y 1466 | elif [[ $release = Debian ]]; then 1467 | apt install lsb-release -y 1468 | echo "deb http://deb.debian.org/debian $(lsb_release -sc)-backports main" | tee /etc/apt/sources.list.d/backports.list 1469 | apt update -y;apt install iproute2 openresolv dnsutils iptables iputils-ping -y;apt install wireguard-tools --no-install-recommends -y 1470 | elif [[ $release = Ubuntu ]]; then 1471 | apt update -y;apt install iproute2 openresolv dnsutils iptables iputils-ping -y;apt install wireguard-tools --no-install-recommends -y 1472 | fi 1473 | wget -N https://gitlab.com/rwkgyg/cfwarp/raw/main/wgcf_2.2.22_$cpu -O /usr/local/bin/wgcf && chmod +x /usr/local/bin/wgcf 1474 | if [[ $main -lt 5 || $minor -lt 6 ]] || [[ $vi =~ lxc|openvz ]]; then 1475 | [[ -e /usr/bin/wireguard-go ]] || wget -N https://gitlab.com/rwkgyg/cfwarp/raw/main/wireguard-go -O /usr/bin/wireguard-go && chmod +x /usr/bin/wireguard-go 1476 | fi 1477 | echo | wgcf register 1478 | until [[ -e wgcf-account.toml ]] 1479 | do 1480 | yellow "申请warp普通账户过程中可能会多次提示:429 Too Many Requests,请等待30秒" && sleep 1 1481 | echo | wgcf register --accept-tos 1482 | done 1483 | wgcf generate 1484 | mtuwarp 1485 | 1486 | #blue "检测能否自动生成并使用warp+账户,请稍等10秒" 1487 | #wppluskey >/dev/null 2>&1 1488 | sed -i "s/MTU.*/MTU = $MTU/g" wgcf-profile.conf 1489 | cp -f wgcf-profile.conf /etc/wireguard/wgcf.conf >/dev/null 2>&1 1490 | cp -f wgcf-account.toml /etc/wireguard/buckup-account.toml >/dev/null 2>&1 1491 | cp -f wgcf-profile.conf /etc/wireguard/buckup-profile.conf >/dev/null 2>&1 1492 | ABC 1493 | mv -f wgcf-profile.conf /etc/wireguard >/dev/null 2>&1 1494 | mv -f wgcf-account.toml /etc/wireguard >/dev/null 2>&1 1495 | #ID=$(tail -n1 /root/WARP+Keys.txt | cut -d' ' -f1 2>/dev/null) 1496 | #if [[ -n $ID ]]; then 1497 | #green "使用warp+密钥" 1498 | #green "$(tail -n1 /root/WARP+Keys.txt | cut -d' ' -f1 2>/dev/null)" 1499 | #sed -i "s/license_key.*/license_key = '$ID'/g" /etc/wireguard/wgcf-account.toml 1500 | #sbmc=warp+$(date +%s%N |md5sum | cut -c 1-3) 1501 | #SBID="--name $(echo $sbmc | sed s/[[:space:]]/_/g)" 1502 | #rm -rf warpplus.sh 1503 | #cd /etc/wireguard && wgcf update $SBID > /etc/wireguard/wgcf+p.log 2>&1 1504 | #wgcf generate && cd 1505 | #sed -i "2s#.*#$(sed -ne 2p /etc/wireguard/wgcf-profile.conf)#;4s#.*#$(sed -ne 4p /etc/wireguard/wgcf-profile.conf)#" /etc/wireguard/wgcf.conf 1506 | #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 1507 | #else 1508 | #yellow "warp+无法自动生成,直接生成warp普通账户" 1509 | #fi 1510 | systemctl enable wg-quick@wgcf 1511 | cat /etc/wireguard/wgcf.conf && sleep 2 1512 | CheckWARP && ShowWGCF && lncf && reswarp 1513 | curl -sL https://raw.githubusercontent.com/yonggekkk/warp-yg/main/version | awk -F "更新内容" '{print $1}' | head -n 1 > /root/warpip/v 1514 | } 1515 | 1516 | WARPup(){ 1517 | backconf(){ 1518 | red "升级失败,自动恢复warp普通账户" 1519 | sed -i "2s#.*#$(sed -ne 2p /etc/wireguard/wgcf-profile.conf)#;4s#.*#$(sed -ne 4p /etc/wireguard/wgcf-profile.conf)#" /etc/wireguard/wgcf.conf 1520 | CheckWARP && ShowWGCF && WGCFmenu 1521 | } 1522 | readp "1.Teams团队账户\n2.warp+账户\n3.普通warp账户\n4.Socks5+WARP+账户\n0.返回上一层\n 请选择:" cd 1523 | case "$cd" in 1524 | 1 ) 1525 | result(){ 1526 | sed -i "s#PrivateKey.*#PrivateKey = $PRIVATEKEY#g;s#Address.*128#Address = $ADDRESS6/128#g" /etc/wireguard/wgcf.conf 1527 | sed -i "s#PrivateKey.*#PrivateKey = $PRIVATEKEY#g;s#Address.*128#Address = $ADDRESS6/128#g" /etc/wireguard/buckup-profile.conf 1528 | CheckWARP 1529 | checkwgcf 1530 | if [[ $wgcfv4 = plus || $wgcfv6 = plus ]]; then 1531 | rm -rf /etc/wireguard/wgcf+p.log && green "wgcf-warp+Teams账户已生效" && ShowWGCF && WGCFmenu 1532 | else 1533 | backconf 1534 | fi 1535 | } 1536 | [[ ! $(type -P wg-quick) ]] && red "未安装wgcf-warp,安装好wgcf-warp才能执行" && exit 1537 | green "1. 使用Token获取Teams团队账户,Token获取地址:https://web--public--warp-team-api--coia-mfs4.code.run/" 1538 | green "2. 手动复制私钥与IPV6地址" 1539 | green "0. 退出" 1540 | readp "请选择:" up 1541 | if [[ $up == 1 ]]; then 1542 | readp " 请复制团队账户Token: " TEAM_TOKEN 1543 | PRIVATEKEY=$(wg genkey) 1544 | PUBLICKEY=$(wg pubkey <<< "$PRIVATEKEY") 1545 | INSTALL_ID=$(tr -dc 'A-Za-z0-9' /etc/wireguard/wgcf+p.log && green "wgcf-warp+账户已生效" && ShowWGCF && WGCFmenu 1582 | else 1583 | fawgcf 1584 | fi 1585 | } 1586 | [[ ! $(type -P wg-quick) ]] && red "未安装wgcf-warp,安装好wgcf-warp才能执行" && exit 1587 | green "1. 输入密钥方式" 1588 | green "2. 手动复制私钥与IPV6地址" 1589 | green "0. 退出" 1590 | readp "请选择:" up 1591 | if [[ $up == 1 ]]; then 1592 | readp "请复制手机WARP客户端WARP+状态下的按键许可证秘钥 或 网络分享的秘钥(26个字符):" ID 1593 | [[ -n $ID ]] && sed -i "s/license_key.*/license_key = '$ID'/g" /etc/wireguard/wgcf-account.toml && readp "设备名称重命名(直接回车随机命名):" sbmc || (red "未输入按键许可证秘钥(26个字符)" && cf) 1594 | [[ -n $sbmc ]] && SBID="--name $(echo $sbmc | sed s/[[:space:]]/_/g)" 1595 | cd /etc/wireguard && wgcf update $SBID > /etc/wireguard/wgcf+p.log 2>&1 1596 | wgcf generate && cd 1597 | sed -i "2s#.*#$(sed -ne 2p /etc/wireguard/wgcf-profile.conf)#;4s#.*#$(sed -ne 4p /etc/wireguard/wgcf-profile.conf)#" /etc/wireguard/wgcf.conf 1598 | 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 1599 | CheckWARP && checkwgcf 1600 | if [[ $wgcfv4 = plus || $wgcfv6 = plus ]]; then 1601 | warppflow=$((`grep -oP '"quota":\K\d+' <<< $(curl -s "https://api.cloudflareclient.com/v0a884/reg/$(grep 'device_id' /etc/wireguard/wgcf-account.toml 2>/dev/null | cut -d \' -f2)" -H "User-Agent: okhttp/3.12.1" -H "Authorization: Bearer $(grep 'access_token' /etc/wireguard/wgcf-account.toml 2>/dev/null | cut -d \' -f2)")`)) 1602 | flow=`echo "scale=2; $warppflow/1000000000" | bc` 1603 | green "已升级为wgcf-warp+账户\nwgcf-warp+账户设备名称:$(grep -s 'Device name' /etc/wireguard/wgcf+p.log | awk '{ print $NF }')\nwgcf-warp+账户剩余流量:$flow GB" 1604 | ShowWGCF && WGCFmenu 1605 | else 1606 | red "经IP检测,升级warp+失败,请确保密钥使用的设备不超过5个,建议更换下秘钥再尝试,脚本退出" && exit 1607 | fi 1608 | elif [[ $up == 2 ]]; then 1609 | readp "请复制privateKey(44个字符):" PRIVATEKEY 1610 | readp "请复制IPV6的Address:" ADDRESS6 1611 | result 1612 | else 1613 | exit 1614 | fi 1615 | ;; 1616 | 3 ) 1617 | checkwgcf 1618 | if [[ $wgcfv4 = plus || $wgcfv6 = plus ]]; then 1619 | fawgcf 1620 | else 1621 | yellow "当前已是wgcf-warp普通账号" 1622 | ShowWGCF && WGCFmenu 1623 | fi;; 1624 | 4 ) 1625 | SOCKS5WARPUP;; 1626 | 0 ) cf 1627 | esac 1628 | } 1629 | 1630 | WARPonoff(){ 1631 | [[ ! $(type -P wg-quick) ]] && red "WARP未安装,建议重新安装" && exit 1632 | readp "1. 关闭WARP功能(关闭WARP在线监测)\n2. 开启/重启WARP功能(启动WARP在线监测)\n0. 返回上一层\n 请选择:" unwp 1633 | if [ "$unwp" == "1" ]; then 1634 | wg-quick down wgcf >/dev/null 2>&1 1635 | systemctl stop wg-quick@wgcf >/dev/null 2>&1 1636 | systemctl disable wg-quick@wgcf >/dev/null 2>&1 1637 | screen -ls | awk '/\.up/ {print $1}' | cut -d "." -f 1 | xargs kill 2>/dev/null 1638 | unreswarp 1639 | checkwgcf 1640 | [[ ! $wgcfv4 =~ on|plus && ! $wgcfv6 =~ on|plus ]] && green "关闭warp成功" || red "关闭warp失败" 1641 | elif [ "$unwp" == "2" ]; then 1642 | wg-quick down wgcf >/dev/null 2>&1 1643 | systemctl restart wg-quick@wgcf >/dev/null 2>&1 1644 | xyz 1645 | name=`screen -ls | grep '(Detached)' | awk '{print $1}' | awk -F "." '{print $2}'` 1646 | [[ $name =~ "up" ]] && green "WARP在线监测启动成功" || red "WARP在线监测启动失败,查看screen是否安装成功" 1647 | reswarp 1648 | checkwgcf 1649 | [[ $wgcfv4 =~ on|plus || $wgcfv6 =~ on|plus ]] && green "开启warp成功" || red "开启warp失败" 1650 | else 1651 | cf 1652 | fi 1653 | } 1654 | 1655 | cwg(){ 1656 | screen -ls | awk '/\.up/ {print $1}' | cut -d "." -f 1 | xargs kill 2>/dev/null 1657 | wg-quick down wgcf >/dev/null 2>&1 1658 | systemctl disable wg-quick@wgcf >/dev/null 2>&1 1659 | $yumapt remove wireguard-tools 1660 | $yumapt autoremove 1661 | dig9 1662 | sed -i '/^precedence ::ffff:0:0\/96 100/d' /etc/gai.conf 2>/dev/null 1663 | 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 1664 | rm -rf /root/warpip /root/WARP+Keys.txt 1665 | } 1666 | 1667 | warpinscha(){ 1668 | yellow "提示:VPS的本地出站IP将被你选择的warp的IP所接管,如VPS本地无该出站IP,则被另外生成warp的IP所接管" 1669 | echo 1670 | green "1. 安装/切换wgcf-warp单栈IPV4(回车默认)" 1671 | green "2. 安装/切换wgcf-warp单栈IPV6" 1672 | green "3. 安装/切换wgcf-warp双栈IPV4+IPV6" 1673 | readp "\n请选择:" wgcfwarp 1674 | if [ -z "${wgcfwarp}" ] || [ $wgcfwarp == "1" ];then 1675 | WGCFv4 1676 | elif [ $wgcfwarp == "2" ];then 1677 | WGCFv6 1678 | elif [ $wgcfwarp == "3" ];then 1679 | WGCFv4v6 1680 | else 1681 | red "输入错误,请重新选择" && warpinscha 1682 | fi 1683 | echo 1684 | } 1685 | 1686 | changewarp(){ 1687 | cwg && ONEWARPGO 1688 | } 1689 | 1690 | start_menu(){ 1691 | ShowWGCF;ShowSOCKS5 1692 | clear 1693 | green "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" 1694 | echo -e "${bblue} ░██ ░██ ░██ ██ ██ ░█${plain}█ ░██ ░██ ░██ ░█${red}█ ░██${plain} " 1695 | echo -e "${bblue} ░██ ░██ ░██ ░░██${plain} ░██ ░██ ░██ ░██${red} ░██ ░██${plain} " 1696 | echo -e "${bblue} ░██ ░██ ░██ ${plain} ░██ ██ ░██ █${red}█ ░██ ██ ${plain} " 1697 | echo -e "${bblue} ░██ ░${plain}██ ░██ ██ ░██ ██ ░█${red}█ ██ ░██ ██ ${plain} " 1698 | echo -e "${bblue} ░██ ${plain} ░██ ░░██ ░██ ░██ ░${red}██ ░██ ░██ ░██ ${plain} " 1699 | echo -e "${bblue} ░█${plain}█ ░██ ██ ██ ░██ ░░${red}██ ░██ ░░██ ░██ ░░██ ${plain} " 1700 | echo 1701 | white "甬哥Github项目 :github.com/yonggekkk" 1702 | white "甬哥Blogger博客 :ygkkk.blogspot.com" 1703 | white "甬哥YouTube频道 :www.youtube.com/@ygkkk" 1704 | green "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" 1705 | yellow " 任意选择适合自己的warp现实方案(选项1、2、3,可单选,可多选共存)" 1706 | yellow " 进入脚本快捷方式:cf" 1707 | white " =================================================================" 1708 | green " 1. 方案一:安装/切换WGCF-WARP" 1709 | green " 2. 方案二:安装Socks5-WARP" 1710 | green " 3. 方案三:生成WARP-Wireguard配置文件、二维码" 1711 | green " 4. 卸载WARP" 1712 | white " -----------------------------------------------------------------" 1713 | green " 5. 关闭、开启/重启WARP" 1714 | green " 6. WARP其他选项" 1715 | green " 7. WARP三类账户升级/切换" 1716 | green " 8. 更新CFwarp安装脚本" 1717 | green " 9. 将当前WGCF-WARP内核替换为WARP-GO内核" 1718 | green " 0. 退出脚本 " 1719 | red "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" 1720 | cfwarpshow 1721 | red "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" 1722 | white " VPS系统信息如下:" 1723 | white " 操作系统: $(blue "$op") \c" && white " 内核版本: $(blue "$version") \c" && white " CPU架构 : $(blue "$cpu") \c" && white " 虚拟化类型: $(blue "$vi")" 1724 | WGCFmenu 1725 | S5menu 1726 | echo 1727 | readp " 请输入数字:" Input 1728 | case "$Input" in 1729 | 1 ) warpinscha;; 1730 | 2 ) [[ $cpu = amd64 ]] && SOCKS5ins || exit;; 1731 | 3 ) WGproxy;; 1732 | 4 ) WARPun;; 1733 | 5 ) WARPonoff;; 1734 | 6 ) WARPtools;; 1735 | 7 ) WARPup;; 1736 | 8 ) UPwpyg;; 1737 | 9 ) changewarp;; 1738 | * ) exit 1739 | esac 1740 | } 1741 | 1742 | if [ $# == 0 ]; then 1743 | cpujg 1744 | start_menu 1745 | fi 1746 | } 1747 | 1748 | checkyl(){ 1749 | if [ ! -f warp_update ]; then 1750 | green "首次运行CFwarp-yg脚本,安装必要的依赖……请稍等" 1751 | if [[ $release = Centos && ${vsid} =~ 8 ]]; then 1752 | cd /etc/yum.repos.d/ && mkdir backup && mv *repo backup/ 1753 | curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-8.repo 1754 | sed -i -e "s|mirrors.cloud.aliyuncs.com|mirrors.aliyun.com|g " /etc/yum.repos.d/CentOS-* 1755 | sed -i -e "s|releasever|releasever-stream|g" /etc/yum.repos.d/CentOS-* 1756 | yum clean all && yum makecache 1757 | cd 1758 | fi 1759 | if [ -x "$(command -v apt-get)" ]; then 1760 | apt update -y && apt install curl wget -y 1761 | elif [ -x "$(command -v yum)" ]; then 1762 | yum update && yum install epel-release -y && yum install curl wget -y 1763 | elif [ -x "$(command -v dnf)" ]; then 1764 | dnf update -y && dnf install curl wget -y 1765 | fi 1766 | if [ -x "$(command -v yum)" ] || [ -x "$(command -v dnf)" ]; then 1767 | if ! command -v "cronie" &> /dev/null; then 1768 | if [ -x "$(command -v yum)" ]; then 1769 | yum install -y cronie 1770 | elif [ -x "$(command -v dnf)" ]; then 1771 | dnf install -y cronie 1772 | fi 1773 | fi 1774 | fi 1775 | touch warp_update 1776 | tun 1777 | fi 1778 | } 1779 | 1780 | warpyl(){ 1781 | packages=("curl" "openssl" "bc" "python3" "screen" "qrencode" "wget") 1782 | inspackages=("curl" "openssl" "bc" "python3" "screen" "qrencode" "wget") 1783 | for i in "${!packages[@]}"; do 1784 | package="${packages[$i]}" 1785 | inspackage="${inspackages[$i]}" 1786 | if ! command -v "$package" &> /dev/null; then 1787 | if [ -x "$(command -v apt-get)" ]; then 1788 | apt-get install -y "$inspackage" 1789 | elif [ -x "$(command -v yum)" ]; then 1790 | yum install -y "$inspackage" 1791 | elif [ -x "$(command -v dnf)" ]; then 1792 | dnf install -y "$inspackage" 1793 | fi 1794 | fi 1795 | done 1796 | } 1797 | 1798 | startCFwarp(){ 1799 | checkyl 1800 | clear 1801 | green "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" 1802 | echo -e "${bblue} ░██ ░██ ░██ ██ ██ ░█${plain}█ ░██ ░██ ░██ ░█${red}█ ░██${plain} " 1803 | echo -e "${bblue} ░██ ░██ ░██ ░░██${plain} ░██ ░██ ░██ ░██${red} ░██ ░██${plain} " 1804 | echo -e "${bblue} ░██ ░██ ░██ ${plain} ░██ ██ ░██ █${red}█ ░██ ██ ${plain} " 1805 | echo -e "${bblue} ░██ ░${plain}██ ░██ ██ ░██ ██ ░█${red}█ ██ ░██ ██ ${plain} " 1806 | echo -e "${bblue} ░██ ${plain} ░██ ░░██ ░██ ░██ ░${red}██ ░██ ░██ ░██ ${plain} " 1807 | echo -e "${bblue} ░█${plain}█ ░██ ██ ██ ░██ ░░${red}██ ░██ ░░██ ░██ ░░██ ${plain} " 1808 | echo 1809 | white "甬哥Github项目 :github.com/yonggekkk" 1810 | white "甬哥Blogger博客 :ygkkk.blogspot.com" 1811 | white "甬哥YouTube频道 :www.youtube.com/@ygkkk" 1812 | green "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" 1813 | echo 1814 | yellow "请稍等5秒,检测 Netflix 与 ChatGPT 解锁情况" 1815 | echo 1816 | echo 1817 | v4v6 1818 | UA_Browser="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.87 Safari/537.36" 1819 | if [[ -n $v6 ]]; then 1820 | nonf=$(curl -s6 --user-agent "${UA_Browser}" http://ip-api.com/json/$v6?lang=zh-CN -k | cut -f2 -d"," | cut -f4 -d '"') 1821 | nf6;chatgpt6;checkgpt 1822 | v6Status=$(white "IPV6地址:\c" ; blue "$v6 $nonf" ; white " Netflix: \c" ; blue "$NF" ; white " ChatGPT: \c" ; blue "$chat") 1823 | else 1824 | v6Status=$(white "IPV6地址:\c" ; red "不存在IPV6地址") 1825 | fi 1826 | if [[ -n $v4 ]]; then 1827 | nonf=$(curl -s4 --user-agent "${UA_Browser}" http://ip-api.com/json/$v4?lang=zh-CN -k | cut -f2 -d"," | cut -f4 -d '"') 1828 | nf4;chatgpt4;checkgpt 1829 | v4Status=$(white "IPV4地址:\c" ; blue "$v4 $nonf" ; white " Netflix: \c" ; blue "$NF" ; white " ChatGPT: \c" ; blue "$chat") 1830 | else 1831 | v4Status=$(white "IPV4地址:\c" ; red "不存在IPV4地址") 1832 | fi 1833 | echo "-----------------------------------------------------------------------" 1834 | white " ${v4Status}" 1835 | echo "-----------------------------------------------------------------------" 1836 | white " ${v6Status}" 1837 | echo "-----------------------------------------------------------------------" 1838 | echo 1839 | yellow "以上结果仅检测本地IP解锁情况,无法检测WARP出站分流的解锁情况" 1840 | echo 1841 | echo 1842 | white "==================================================================" 1843 | yellow " warp脚本使用说明:" 1844 | yellow " 一、无限生成WARP-Wireguard配置信息(选项1)" 1845 | yellow " 可用于代理脚本的WARP-Wireguard出站账户更换或者自建节点" 1846 | echo 1847 | yellow " 二、安装WARP脚本(选项2与3)" 1848 | yellow " 作用:有机率全局解锁 Netflix 与 ChatGPT" 1849 | yellow " 提示:在使用支持WARP出站的代理脚本时,不建议再安装warp脚本" 1850 | yellow " 提示:wgcf与warp-go随意选择,哪个能装用哪个" 1851 | echo "-------------------------------------------------------------------" 1852 | green " 1. 生成并提取WARP-Wireguard节点配置文件、二维码" 1853 | green " 2. 选择 wgcf 方案进入WARP安装菜单" 1854 | green " 3. 选择 warp-go 方案进入WARP安装菜单" 1855 | green " 0. 退出脚本" 1856 | white "==================================================================" 1857 | echo 1858 | readp " 请输入数字【0-3】:" Input 1859 | case "$Input" in 1860 | 1 ) WGproxy;; 1861 | 2 ) warpyl && ONEWGCFWARP;; 1862 | 3 ) warpyl && ONEWARPGO;; 1863 | * ) exit 1864 | esac 1865 | } 1866 | if [ $# == 0 ]; then 1867 | if [[ -n $(type -P warp-go) && -z $(type -P wg-quick) ]] && [[ -f '/usr/bin/cf' ]]; then 1868 | ONEWARPGO 1869 | elif [[ -n $(type -P warp-go) && -n $(type -P warp-cli) && -z $(type -P wg-quick) ]] && [[ -f '/usr/bin/cf' ]]; then 1870 | ONEWARPGO 1871 | elif [[ -z $(type -P warp-go) && -z $(type -P wg-quick) && -n $(type -P warp-cli) ]] && [[ -f '/usr/bin/cf' ]]; then 1872 | ONEWARPGO 1873 | elif [[ -n $(type -P wg-quick) && -z $(type -P warp-go) ]] && [[ -f '/usr/bin/cf' ]]; then 1874 | ONEWGCFWARP 1875 | elif [[ -n $(type -P wg-quick) && -n $(type -P warp-cli) && -z $(type -P warp-go) ]] && [[ -f '/usr/bin/cf' ]]; then 1876 | ONEWGCFWARP 1877 | else 1878 | startCFwarp 1879 | fi 1880 | fi 1881 | --------------------------------------------------------------------------------