#!/bin/bash case "$(uname -m)" in x86_64 | x64 | amd64 ) cpu=amd64 ;; i386 | i686 ) cpu=386 ;; armv8 | armv8l | arm64 | aarch64 ) cpu=arm64 ;; armv7l ) cpu=arm ;; * ) echo "The current architecture is $(uname -m), which is not supported yet" exit ;; esac cfwarpreg(){ curl -sSL https://raw.githubusercontent.com/MiSaturo/WarpScanner/main/point/acwarp.sh -o acwarp.sh && chmod +x acwarp.sh && ./acwarp.sh } warpendipv4v6(){ echo "1.IPV4 preferred peer IP" echo "2.IPV6 preferred peer IP" echo "0.quit" read -p "please choose: " menu if [ "$menu" == "1" ];then cfwarpIP && endipv4 && endipresult elif [ "$menu" == "2" ];then cfwarpIP && endipv6 && endipresult else exit fi } cfwarpIP(){ echo "Download the warp optimization program ..." if [[ -n $cpu ]]; then curl -L -o warpendpoint -# --retry 2 https://raw.githubusercontent.com/MiSaturo/WarpScanner/main/point/$cpu fi } endipv4(){ n=0 iplist=500 while true do temp[$n]=$(echo 162.159.192.$(($RANDOM%256))) n=$[$n+1] if [ $n -ge $iplist ] then break fi temp[$n]=$(echo 162.159.193.$(($RANDOM%256))) n=$[$n+1] if [ $n -ge $iplist ] then break fi temp[$n]=$(echo 162.159.195.$(($RANDOM%256))) n=$[$n+1] if [ $n -ge $iplist ] then break fi temp[$n]=$(echo 188.114.96.$(($RANDOM%256))) n=$[$n+1] if [ $n -ge $iplist ] then break fi temp[$n]=$(echo 188.114.97.$(($RANDOM%256))) n=$[$n+1] if [ $n -ge $iplist ] then break fi temp[$n]=$(echo 188.114.98.$(($RANDOM%256))) n=$[$n+1] if [ $n -ge $iplist ] then break fi temp[$n]=$(echo 188.114.99.$(($RANDOM%256))) n=$[$n+1] if [ $n -ge $iplist ] then break fi done while true do if [ $(echo ${temp[@]} | sed -e 's/ /\n/g' | sort -u | wc -l) -ge $iplist ] then break else temp[$n]=$(echo 162.159.192.$(($RANDOM%256))) n=$[$n+1] fi if [ $(echo ${temp[@]} | sed -e 's/ /\n/g' | sort -u | wc -l) -ge $iplist ] then break else temp[$n]=$(echo 162.159.193.$(($RANDOM%256))) n=$[$n+1] fi if [ $(echo ${temp[@]} | sed -e 's/ /\n/g' | sort -u | wc -l) -ge $iplist ] then break else temp[$n]=$(echo 162.159.195.$(($RANDOM%256))) n=$[$n+1] fi if [ $(echo ${temp[@]} | sed -e 's/ /\n/g' | sort -u | wc -l) -ge $iplist ] then break else temp[$n]=$(echo 188.114.96.$(($RANDOM%256))) n=$[$n+1] fi if [ $(echo ${temp[@]} | sed -e 's/ /\n/g' | sort -u | wc -l) -ge $iplist ] then break else temp[$n]=$(echo 188.114.97.$(($RANDOM%256))) n=$[$n+1] fi if [ $(echo ${temp[@]} | sed -e 's/ /\n/g' | sort -u | wc -l) -ge $iplist ] then break else temp[$n]=$(echo 188.114.98.$(($RANDOM%256))) n=$[$n+1] fi if [ $(echo ${temp[@]} | sed -e 's/ /\n/g' | sort -u | wc -l) -ge $iplist ] then break else temp[$n]=$(echo 188.114.99.$(($RANDOM%256))) n=$[$n+1] fi done } endipv6(){ n=0 iplist=500 while true do temp[$n]=$(echo [2606:4700:d0::$(printf '%x\n' $(($RANDOM*2+$RANDOM%2))):$(printf '%x\n' $(($RANDOM*2+$RANDOM%2))):$(printf '%x\n' $(($RANDOM*2+$RANDOM%2))):$(printf '%x\n' $(($RANDOM*2+$RANDOM%2)))]) n=$[$n+1] if [ $n -ge $iplist ] then break fi temp[$n]=$(echo [2606:4700:d1::$(printf '%x\n' $(($RANDOM*2+$RANDOM%2))):$(printf '%x\n' $(($RANDOM*2+$RANDOM%2))):$(printf '%x\n' $(($RANDOM*2+$RANDOM%2))):$(printf '%x\n' $(($RANDOM*2+$RANDOM%2)))]) n=$[$n+1] if [ $n -ge $iplist ] then break fi done while true do if [ $(echo ${temp[@]} | sed -e 's/ /\n/g' | sort -u | wc -l) -ge $iplist ] then break else temp[$n]=$(echo [2606:4700:d0::$(printf '%x\n' $(($RANDOM*2+$RANDOM%2))):$(printf '%x\n' $(($RANDOM*2+$RANDOM%2))):$(printf '%x\n' $(($RANDOM*2+$RANDOM%2))):$(printf '%x\n' $(($RANDOM*2+$RANDOM%2)))]) n=$[$n+1] fi if [ $(echo ${temp[@]} | sed -e 's/ /\n/g' | sort -u | wc -l) -ge $iplist ] then break else temp[$n]=$(echo [2606:4700:d1::$(printf '%x\n' $(($RANDOM*2+$RANDOM%2))):$(printf '%x\n' $(($RANDOM*2+$RANDOM%2))):$(printf '%x\n' $(($RANDOM*2+$RANDOM%2))):$(printf '%x\n' $(($RANDOM*2+$RANDOM%2)))]) n=$[$n+1] fi done } endipresult(){ echo ${temp[@]} | sed -e 's/ /\n/g' | sort -u > ip.txt ulimit -n 102400 chmod +x warpendpoint ./warpendpoint clear cat result.csv | awk -F, '$3!="timeout ms" {print} ' | sort -t, -nk2 -nk3 | uniq | head -100 | awk -F, '{print "endpoint "$1" Packet loss rate "$2" average latency "$3}' rm -rf ip.txt warpendpoint exit } echo "------------------------------------------------------" echo "Yongge Github project :github.com/yonggekkk" echo "Yongge blogger blog :ygkkk.blogspot.com" echo "Yongge YouTube Channel :www.youtube.com/@ygkkk" echo "The script supports WARP preferred IP and WARP configuration file generation, thanks to CF netizens for development" echo "------------------------------------------------------" echo echo "1. WARP-V4V6 preferred peer IP" echo "2. Register to generate WARP-Wireguard configuration files and QR codes" echo "0. Exit" read -p "please choose: " menu if [ "$menu" == "1" ];then warpendipv4v6 elif [ "$menu" == "2" ];then cfwarpreg else exit fi