From 5f3af0444184008aecda44d99cc5241183f0e2d7 Mon Sep 17 00:00:00 2001 From: Jensfrank Date: Fri, 5 Jul 2024 13:51:22 +0800 Subject: [PATCH] Update Nlbench_beta.sh --- Nlbench_beta.sh | 70 ++++++++++++++++++++++++------------------------- 1 file changed, 34 insertions(+), 36 deletions(-) diff --git a/Nlbench_beta.sh b/Nlbench_beta.sh index dea68a0..ae7bd27 100644 --- a/Nlbench_beta.sh +++ b/Nlbench_beta.sh @@ -51,19 +51,16 @@ install_dependencies() { clear } -# 获取IP地址和ISP信息 ip_address_and_isp() { - ipv4_address=$(curl -s --max-time 5 ipv4.ip.sb) - ipv6_address=$(curl -s --max-time 5 ipv6.ip.sb) + ipv4_address=$(curl -s --max-time 5 -4 ip.sb) + ipv6_address=$(curl -s --max-time 5 -6 ip.sb) # 获取ISP信息 isp_info=$(curl -s ipinfo.io/org) - isp=$(echo "$isp_info" | grep -oP '(?<="org":")[^"]*') - asn=$(echo "$isp_info" | grep -oP '(?<="asn":")[^"]*') # 检查是否为WARP或Cloudflare is_warp=false - if echo "$isp $asn" | grep -iq "cloudflare\|warp\|1.1.1.1"; then + if echo "$isp_info" | grep -iq "cloudflare\|warp\|1.1.1.1"; then is_warp=true fi @@ -75,6 +72,7 @@ ip_address_and_isp() { echo "IPv4: $ipv4_address" echo "IPv6: $ipv6_address" + echo "ISP: $isp_info" echo "Is WARP: $is_warp" echo "Use IPv6: $use_ipv6" } @@ -203,32 +201,32 @@ run_script() { sed -i 's/\x1B\[[0-9;]*[JKmsu]//g' "$temp_file" cp "$temp_file" "${output_file}_response" ;; - # 多线程测速 - 6) - echo -e "运行${YELLOW}多线程测速...${NC}" - if [ "$use_ipv6" = true ]; then - echo "使用IPv6测试选项" - bash <(curl -sL bash.icu/speedtest) <<< "3" | tee "$temp_file" - else - echo "使用IPv4测试选项" - bash <(curl -sL bash.icu/speedtest) <<< "1" | tee "$temp_file" - fi +# 多线程测速 +6) + echo -e "运行${YELLOW}多线程测速...${NC}" + if [ "$use_ipv6" = true ]; then + echo "使用IPv6测试选项" + bash <(curl -sL bash.icu/speedtest) <<< "3" | tee "$temp_file" + else + echo "使用IPv4测试选项" + bash <(curl -sL bash.icu/speedtest) <<< "1" | tee "$temp_file" + fi sed -r -i 's/\x1B\[[0-9;]*[JKmsu]//g' "$temp_file" sed -i -r '1,/序号\:/d' "$temp_file" sed -i -r 's/(⠋|⠙|⠹|⠸|⠼|⠴|⠦|⠧|⠇|⠏)/\n/g' "$temp_file" sed -i -r '/测试进行中/d' "$temp_file" cp "$temp_file" "${output_file}_multi_thread" ;; - # 单线程测速 - 7) - echo -e "运行${YELLOW}单线程测速...${NC}" - if [ "$use_ipv6" = true ]; then - echo "使用IPv6测试选项" - bash <(curl -sL bash.icu/speedtest) <<< "17" | tee "$temp_file" - else - echo "使用IPv4测试选项" - bash <(curl -sL bash.icu/speedtest) <<< "2" | tee "$temp_file" - fi +# 单线程测速 +7) + echo -e "运行${YELLOW}单线程测速...${NC}" + if [ "$use_ipv6" = true ]; then + echo "使用IPv6测试选项" + bash <(curl -sL bash.icu/speedtest) <<< "17" | tee "$temp_file" + else + echo "使用IPv4测试选项" + bash <(curl -sL bash.icu/speedtest) <<< "2" | tee "$temp_file" + fi sed -r -i 's/\x1B\[[0-9;]*[JKmsu]//g' "$temp_file" sed -i -r '1,/序号\:/d' "$temp_file" sed -i -r 's/(⠋|⠙|⠹|⠸|⠼|⠴|⠦|⠧|⠇|⠏)/\n/g' "$temp_file" @@ -243,16 +241,16 @@ run_script() { sed -i -r '1,/\[ ID\] /d' "$temp_file" cp "$temp_file" "${output_file}_iperf3" ;; - # 回程路由 - 9) - echo -e "运行${YELLOW}回程路由测试...${NC}" - if [ "$use_ipv6" = true ]; then - echo "使用IPv6测试选项" - wget -N --no-check-certificate https://raw.githubusercontent.com/Chennhaoo/Shell_Bash/master/AutoTrace.sh && chmod +x AutoTrace.sh && bash AutoTrace.sh <<< "3" | tee "$temp_file" - else - echo "使用IPv4测试选项" - wget -N --no-check-certificate https://raw.githubusercontent.com/Chennhaoo/Shell_Bash/master/AutoTrace.sh && chmod +x AutoTrace.sh && bash AutoTrace.sh <<< "1" | tee "$temp_file" - fi +# 回程路由 +9) + echo -e "运行${YELLOW}回程路由测试...${NC}" + if [ "$use_ipv6" = true ]; then + echo "使用IPv6测试选项" + wget -N --no-check-certificate https://raw.githubusercontent.com/Chennhaoo/Shell_Bash/master/AutoTrace.sh && chmod +x AutoTrace.sh && bash AutoTrace.sh <<< "3" | tee "$temp_file" + else + echo "使用IPv4测试选项" + wget -N --no-check-certificate https://raw.githubusercontent.com/Chennhaoo/Shell_Bash/master/AutoTrace.sh && chmod +x AutoTrace.sh && bash AutoTrace.sh <<< "1" | tee "$temp_file" + fi sed -i -e 's/\x1B\[[0-9;]*[JKmsu]//g' -e '/测试项/,+9d' -e '/信息/d' -e '/^\s*$/d' "$temp_file" cp "$temp_file" "${output_file}_route" ;;