#!/usr/bin/env bash # 颜色 -------------------------------------------------------------------------------------------------------- black=$(tput setaf 0) ; red=$(tput setaf 1) ; green=$(tput setaf 2) ; yellow=$(tput setaf 3); bold=$(tput bold) blue=$(tput setaf 4) ; magenta=$(tput setaf 5) ; cyan=$(tput setaf 6) ; white=$(tput setaf 7) ; normal=$(tput sgr0) on_black=$(tput setab 0); on_red=$(tput setab 1) ; on_green=$(tput setab 2); on_yellow=$(tput setab 3) on_blue=$(tput setab 4) ; on_magenta=$(tput setab 5) ; on_cyan=$(tput setab 6) ; on_white=$(tput setab 7) shanshuo=$(tput blink) ; wuguangbiao=$(tput civis) ; guangbiao=$(tput cnorm) ; jiacu=${normal}${bold} underline=$(tput smul) ; reset_underline=$(tput rmul) ; dim=$(tput dim) standout=$(tput smso) ; reset_standout=$(tput rmso) ; title=${standout} baihuangse=${white}${on_yellow}; bailanse=${white}${on_blue} ; bailvse=${white}${on_green} baiqingse=${white}${on_cyan} ; baihongse=${white}${on_red} ; baizise=${white}${on_magenta} heibaise=${black}${on_white} ; heihuangse=${on_yellow}${black} CW="${bold}${baihongse} ERROR ${jiacu}";ZY="${baihongse}${bold} ATTENTION ${jiacu}";JG="${baihongse}${bold} WARNING ${jiacu}" #安装JQ function InstallJQ() { if [ -e "/etc/redhat-release" ];then echo -e "${green}正在安装依赖: epel-release${jiacu}"; yum install epel-release -y -q > /dev/null; echo -e "${green}正在安装依赖: jq${jiacu}"; yum install jq -y -q > /dev/null; elif [[ $(cat /etc/os-release | grep '^ID=') =~ ubuntu ]] || [[ $(cat /etc/os-release | grep '^ID=') =~ debian ]];then echo -e "${green}正在更新软件包列表...${jiacu}"; apt-get update -y > /dev/null; echo -e "${green}正在安装依赖: jq${jiacu}"; apt-get install jq -y > /dev/null; else echo -e "${red}请手动安装jq${jiacu}"; exit; fi } #安装Curl function InstallCurl() { if [ -e "/etc/redhat-release" ];then echo -e "${green}正在安装依赖: curl${jiacu}"; yum install curl -y > /dev/null; elif [[ $(cat /etc/os-release | grep '^ID=') =~ ubuntu ]] || [[ $(cat /etc/os-release | grep '^ID=') =~ debian ]];then echo -e "${green}正在更新软件包列表...${jiacu}"; apt-get update -y > /dev/null; echo -e "${green}正在安装依赖: curl${jiacu}"; apt-get install curl -y > /dev/null; else echo -e "${red}请手动安装curl${jiacu}"; exit; fi } #安装traceroute function InstallTraceroute() { if [ -e "/etc/redhat-release" ];then echo -e "${green}正在安装依赖: epel-release${jiacu}"; yum install epel-release -y -q > /dev/null; echo -e "${green}正在安装依赖: traceroute${jiacu}"; yum install traceroute -y -q > /dev/null; elif [[ $(cat /etc/os-release | grep '^ID=') =~ ubuntu ]] || [[ $(cat /etc/os-release | grep '^ID=') =~ debian ]];then echo -e "${green}正在更新软件包列表...${jiacu}"; apt-get update -y > /dev/null; echo -e "${green}正在安装依赖: traceroute${jiacu}"; apt-get install traceroute -y > /dev/null; elif [[ $(cat /etc/issue | grep '^ID=') =~ alpine ]];then apk update > /dev/null; echo -e "${green}正在安装依赖: traceroute${jiacu}"; apk add traceroute > /dev/null; else echo -e "${red}请手动安装traceroute${jiacu}"; exit; fi } #IO检测 io_test() { (LANG=C dd if=/dev/zero of=test_file_$$ bs=512K count=$1 conv=fdatasync && rm -f test_file_$$ ) 2>&1 | awk -F, '{io=$NF} END { print io}' | sed 's/^[ \t]*//;s/[ \t]*$//' } freedisk() { freespace=$( df -m . | awk 'NR==2 {print $4}' ) if [[ $freespace == "" ]]; then $freespace=$( df -m . | awk 'NR==3 {print $3}' ) fi if [[ $freespace -gt 1024 ]]; then printf "%s" $((1024*2)) elif [[ $freespace -gt 512 ]]; then printf "%s" $((512*2)) elif [[ $freespace -gt 256 ]]; then printf "%s" $((256*2)) elif [[ $freespace -gt 128 ]]; then printf "%s" $((128*2)) else printf "1" fi } print_io() { if [[ $1 == "fast" ]]; then writemb=$((128*2)) else writemb=$(freedisk) fi writemb_size="$(( writemb / 2 ))MB" if [[ $writemb_size == "1024MB" ]]; then writemb_size="1.0GB" fi if [[ $writemb != "1" ]]; then echo -n " IO写入测试($writemb_size) " | tee -a $log io1=$( io_test $writemb ) echo -e "${yellow}$io1${jiacu}" | tee -a $log echo -n " IO写入测试($writemb_size) " | tee -a $log io2=$( io_test $writemb ) echo -e "${yellow}$io2${jiacu}" | tee -a $log echo -n " IO写入测试($writemb_size) " | tee -a $log io3=$( io_test $writemb ) echo -e "${yellow}$io3${jiacu}" | tee -a $log ioraw1=$( echo $io1 | awk 'NR==1 {print $1}' ) [ "`echo $io1 | awk 'NR==1 {print $2}'`" == "GB/s" ] && ioraw1=$( awk 'BEGIN{print '$ioraw1' * 1024}' ) ioraw2=$( echo $io2 | awk 'NR==1 {print $1}' ) [ "`echo $io2 | awk 'NR==1 {print $2}'`" == "GB/s" ] && ioraw2=$( awk 'BEGIN{print '$ioraw2' * 1024}' ) ioraw3=$( echo $io3 | awk 'NR==1 {print $1}' ) [ "`echo $io3 | awk 'NR==1 {print $2}'`" == "GB/s" ] && ioraw3=$( awk 'BEGIN{print '$ioraw3' * 1024}' ) ioall=$( awk 'BEGIN{print '$ioraw1' + '$ioraw2' + '$ioraw3'}' ) ioavg=$( awk 'BEGIN{printf "%.1f", '$ioall' / 3}' ) echo -e " 平均 I/O 速度 ${yellow}$ioavg MB/s${jiacu}" | tee -a $log rm -f test_file_* else echo -e " ${red}没有足够的空间!${jiacu}" fi } #IO检测结束 #系统信息 ip_ipapi() { mkdir -p $HOME/.abench wget --no-check-certificate -t1 -T6 -qO- https://ipapi.co/json > $HOME/.abench/ipapi 2>&1 ccoodde=$( cat $HOME/.abench/ipapi | grep \"country\" | awk -F '"' '{print $4}' ) 2>/dev/null country=$( cat $HOME/.abench/ipapi | grep \"country_name\" | awk -F '"' '{print $4}' ) 2>/dev/null regionn=$( cat $HOME/.abench/ipapi | grep \"region\" | awk -F '"' '{print $4}' ) 2>/dev/null cityyyy=$( cat $HOME/.abench/ipapi | grep \"city\" | awk -F '"' '{print $4}' ) 2>/dev/null isppppp=$( cat $HOME/.abench/ipapi | grep \"org\" | awk -F '"' '{print $4}' ) 2>/dev/null asnnnnn=$( cat $HOME/.abench/ipapi | grep \"asn\" | awk -F '"' '{print $4}' ) 2>/dev/null [[ $cityyyy == Singapore ]] && unset cityyyy [[ -z $isppppp ]] && isp="No ISP detected" [[ -z $asnnnnn ]] && isp="No ASN detected" } ip_ipinfo_aniverse() { mkdir -p $HOME/.abench wget -t1 -T6 -qO- ipinfo.io > $HOME/.abench/ipinfo 2>&1 asnnnnn="$(cat $HOME/.abench/ipinfo | grep \"org\" | awk -F '"' '{print $4}')" cityyyy="$(cat $HOME/.abench/ipinfo | grep \"city\" | awk -F '"' '{print $4}')" country="$(cat $HOME/.abench/ipinfo | grep \"country\" | awk -F '"' '{print $4}')" regionn="$(cat $HOME/.abench/ipinfo | grep \"region\" | awk -F '"' '{print $4}')" [[ $cityyyy == Singapore ]] && unset cityyyy [[ -z $asnnnnn ]] && isp="No ASN detected" } virt_check(){ if hash ifconfig 2>/dev/null; then eth=$(ifconfig) fi virtualx=$(dmesg) 2>/dev/null if [ $(which dmidecode) ]; then sys_manu=$(dmidecode -s system-manufacturer) 2>/dev/null sys_product=$(dmidecode -s system-product-name) 2>/dev/null sys_ver=$(dmidecode -s system-version) 2>/dev/null else sys_manu="" sys_product="" sys_ver="" fi if grep docker /proc/1/cgroup -qa; then virtual="Docker" elif grep lxc /proc/1/cgroup -qa; then virtual="Lxc" elif grep -qa container=lxc /proc/1/environ; then virtual="Lxc" elif [[ -f /proc/user_beancounters ]]; then virtual="OpenVZ" elif [[ "$virtualx" == *kvm-clock* ]]; then virtual="KVM" elif [[ "$cname" == *KVM* ]]; then virtual="KVM" elif [[ "$cname" == *QEMU* ]]; then virtual="KVM" elif [[ "$virtualx" == *"VMware Virtual Platform"* ]]; then virtual="VMware" elif [[ "$virtualx" == *"Parallels Software International"* ]]; then virtual="Parallels" elif [[ "$virtualx" == *VirtualBox* ]]; then virtual="VirtualBox" elif [[ -e /proc/xen ]]; then virtual="Xen" elif [[ "$sys_manu" == *"Microsoft Corporation"* ]]; then if [[ "$sys_product" == *"Virtual Machine"* ]]; then if [[ "$sys_ver" == *"7.0"* || "$sys_ver" == *"Hyper-V" ]]; then virtual="Hyper-V" else virtual="Microsoft Virtual Machine" fi fi else virtual="Dedicated" fi } get_opsy() { [ -f /etc/redhat-release ] && awk '{print ($1,$3~/^[0-9]/?$3:$4)}' /etc/redhat-release && return [ -f /etc/os-release ] && awk -F'[= "]' '/PRETTY_NAME/{print $3,$4,$5}' /etc/os-release && return [ -f /etc/lsb-release ] && awk -F'[="]+' '/DESCRIPTION/{print $2}' /etc/lsb-release && return } calc_disk() { local total_size=0 local array=$@ for size in ${array[@]} do [ "${size}" == "0" ] && size_t=0 || size_t=`echo ${size:0:${#size}-1}` [ "`echo ${size:(-1)}`" == "K" ] && size=0 [ "`echo ${size:(-1)}`" == "M" ] && size=$( awk 'BEGIN{printf "%.1f", '$size_t' / 1024}' ) [ "`echo ${size:(-1)}`" == "T" ] && size=$( awk 'BEGIN{printf "%.1f", '$size_t' * 1024}' ) [ "`echo ${size:(-1)}`" == "G" ] && size=${size_t} total_size=$( awk 'BEGIN{printf "%.1f", '$total_size' + '$size'}' ) done echo ${total_size} } get_system_info() { cname=$( awk -F: '/model name/ {name=$2} END {print name}' /proc/cpuinfo | sed 's/^[ \t]*//;s/[ \t]*$//' ) cores=$( awk -F: '/model name/ {core++} END {print core}' /proc/cpuinfo ) freq=$( awk -F: '/cpu MHz/ {freq=$2} END {print freq}' /proc/cpuinfo | sed 's/^[ \t]*//;s/[ \t]*$//' ) corescache=$( awk -F: '/cache size/ {cache=$2} END {print cache}' /proc/cpuinfo | sed 's/^[ \t]*//;s/[ \t]*$//' ) tram=$( free -m | awk '/Mem/ {print $2}' ) uram=$( free -m | awk '/Mem/ {print $3}' ) bram=$( free -m | awk '/Mem/ {print $6}' ) swap=$( free -m | awk '/Swap/ {print $2}' ) uswap=$( free -m | awk '/Swap/ {print $3}' ) up=$( awk '{a=$1/86400;b=($1%86400)/3600;c=($1%3600)/60} {printf("%d days %d hour %d min\n",a,b,c)}' /proc/uptime ) load=$( w | head -1 | awk -F'load average:' '{print $2}' | sed 's/^[ \t]*//;s/[ \t]*$//' ) opsy=$( get_opsy ) arch=$( uname -m ) lbit=$( getconf LONG_BIT ) kern=$( uname -r ) disk_size1=$( LANG=C df -hPl | grep -wvE '\-|none|tmpfs|overlay|shm|udev|devtmpfs|by-uuid|chroot|Filesystem' | awk '{print $2}' ) disk_size2=$( LANG=C df -hPl | grep -wvE '\-|none|tmpfs|overlay|shm|udev|devtmpfs|by-uuid|chroot|Filesystem' | awk '{print $3}' ) disk_total_size=$( calc_disk ${disk_size1[@]} ) disk_used_size=$( calc_disk ${disk_size2[@]} ) tcpctrl=$( sysctl net.ipv4.tcp_congestion_control | awk -F ' ' '{print $3}' ) virt_check ip_ipinfo_aniverse ip_ipapi [[ $show_ip == 1 ]] && { ipv4_check ; ipv6_check ; } } #系统信息-结束 #路由检查 trip(){ curl -s --connect-timeout 4 -m 10 http://ip-api.com/json/ | grep -q -i "China" if [[ $? == 0 ]];then echo "${yellow}中国大陆的服务器无需检测,不用看,肯定很优秀!!{jiacu}" else iplise=(219.141.136.10 202.106.196.115 211.136.28.231 202.96.199.132 211.95.72.1 211.136.112.50 61.144.56.100 211.95.193.97 120.196.122.69) iplocal=(北京电信 北京联通 北京移动 上海电信 上海联通 上海移动 广州电信 广州联通 广州移动) echo -e "${yellow}正在检查本服务器到中国北京、上海、广州的[回程网络]类型,请稍等...${jiacu} \n" for i in {0..8}; do traceroute ${iplise[i]} > /root/traceroute_testlog grep -q "59.43" /root/traceroute_testlog if [ $? == 0 ];then grep -q "202.97" /root/traceroute_testlog if [ $? == 0 ];then echo -e "目标:${iplocal[i]}[${iplise[i]}]\t回程线路:\033[1;32m电信CN2 GT ${jiacu}\c " else echo -e "目标:${iplocal[i]}[${iplise[i]}]\t回程线路:\033[1;31m电信CN2 GIA ${jiacu}\c " fi else grep -q "202.97" /root/traceroute_testlog if [ $? == 0 ];then echo -e "目标:${iplocal[i]}[${iplise[i]}]\t回程线路:\033[1;34m电信163 ${jiacu}\c " else grep -q "219.158" /root/traceroute_testlog if [ $? == 0 ];then echo -e "目标:${iplocal[i]}[${iplise[i]}]\t回程线路:\033[1;33m联通169 ${jiacu}\c " else grep -q "223.120" /root/traceroute_testlog if [ $? == 0 ];then echo -e "目标:${iplocal[i]}[${iplise[i]}]\t回程线路:\033[1;35m移动CMI ${jiacu}\c " else grep -q "221.183" /root/traceroute_testlog if [ $? == 0 ];then echo -e "目标:${iplocal[i]}[${iplise[i]}]\t回程线路:\033[1;35m移动cmi ${jiacu}\c " else echo -e "目标:${iplocal[i]}[${iplise[i]}]\t回程线路:其他\c " fi fi fi fi fi echo done rm -rf /root/traceroute_testlog fi } #路由检查-结束 #流媒体 function PharseJSON() { # 使用方法: PharseJSON "要解析的原JSON文本" "要解析的键值" # Example: PharseJSON ""Value":"123456"" "Value" [返回结果: 123456] echo -n $1 | jq -r .$2; } function MediaUnlockTest_HBONow() { echo -n -e " HBO Now:\t\t\t\t->\c"; # 尝试获取成功的结果 local result=`curl --user-agent "${UA_Browser}" -${1} -fsSL --max-time 30 --write-out "%{url_effective}\n" --output /dev/null https://play.hbonow.com/ 2>&1`; if [[ "$result" != "curl"* ]]; then # 下载页面成功,开始解析跳转 if [ "${result}" = "https://play.hbonow.com" ] || [ "${result}" = "https://play.hbonow.com/" ]; then echo -n -e "\r HBO Now:\t\t\t\t${green}Yes${jiacu}\n"; elif [ "${result}" = "http://hbogeo.cust.footprint.net/hbonow/geo.html" ] || [ "${result}" = "http://geocust.hbonow.com/hbonow/geo.html" ]; then echo -n -e "\r HBO Now:\t\t\t\t${red}No${jiacu}\n"; else echo -n -e "\r HBO Now:\t\t\t\t${yellow}Failed (Parse Json)${jiacu}\n"; fi else # 下载页面失败,返回错误代码 echo -e "\r HBO Now:\t\t\t\t${red}Failed (Network Connection)${jiacu}\n"; fi } # 流媒体解锁测试-动画疯 function MediaUnlockTest_BahamutAnime() { echo -n -e " Bahamut Anime:\t\t\t\t->\c"; local tmpresult=`curl -${1} --user-agent "${UA_Browser}" --max-time 30 -fsSL 'https://ani.gamer.com.tw/ajax/token.php?adID=89422&sn=14667' 2>&1`; if [[ "$tmpresult" == "curl"* ]]; then echo -n -e "\r Bahamut Anime:\t\t\t\t${red}Failed (Network Connection)${jiacu}\n"; return; fi local result="$(PharseJSON "$tmpresult" "animeSn")"; if [ "$result" != "null" ]; then resultverify="$(echo $result | grep -oE '[0-9]{1,}')"; if [ "$?" = "0" ]; then echo -n -e "\r Bahamut Anime:\t\t\t\t${green}Yes${jiacu}\n"; else echo -n -e "\r Bahamut Anime:\t\t\t\t${red}Failed (Parse Json)${jiacu}\n"; fi else local result="$(PharseJSON "$tmpresult" "error.code")"; if [ "$result" != "null" ]; then resultverify="$(echo $result | grep -oE '[0-9]{1,}')"; if [ "$?" = "0" ]; then echo -n -e "\r Bahamut Anime:\t\t\t\t${red}No${jiacu}\n"; else echo -n -e "\r Bahamut Anime:\t\t\t\t${red}Failed (Parse Json)${jiacu}\n"; fi else echo -n -e "\r Bahamut Anime:\t\t\t\t${red}Failed (Parse Json)${jiacu}\n"; fi fi } # 流媒体解锁测试-哔哩哔哩大陆限定 function MediaUnlockTest_BilibiliChinaMainland() { echo -n -e " BiliBili China Mainland Only:\t\t->\c"; local randsession="$(cat /dev/urandom | head -n 32 | md5sum | head -c 32)"; # 尝试获取成功的结果 local result=`curl --user-agent "${UA_Browser}" -${1} -fsSL --max-time 30 "https://api.bilibili.com/pgc/player/web/playurl?avid=82846771&qn=0&type=&otype=json&ep_id=307247&fourk=1&fnver=0&fnval=16&session=${randsession}&module=bangumi" 2>&1`; if [[ "$result" != "curl"* ]]; then local result="$(PharseJSON "${result}" "code")"; if [ "$?" = "0" ]; then if [ "${result}" = "0" ]; then echo -n -e "\r BiliBili China Mainland Only:\t\t${green}Yes${jiacu}\n"; elif [ "${result}" = "-10403" ]; then echo -n -e "\r BiliBili China Mainland Only:\t\t${red}No${jiacu}\n"; else echo -n -e "\r BiliBili China Mainland Only:\t\t${red}Failed${jiacu} ${blue}(${result})${jiacu}\n"; fi else echo -n -e "\r BiliBili China Mainland Only:\t\t${red}Failed (Parse Json)${jiacu}\n"; fi else echo -n -e "\r BiliBili China Mainland Only:\t\t${red}Failed (Network Connection)${jiacu}\n"; fi } # 流媒体解锁测试-哔哩哔哩港澳台限定 function MediaUnlockTest_BilibiliHKMCTW() { echo -n -e " BiliBili HongKong/Macau/Taiwan:\t->\c"; local randsession="$(cat /dev/urandom | head -n 32 | md5sum | head -c 32)"; # 尝试获取成功的结果 local result=`curl --user-agent "${UA_Browser}" -${1} -fsSL --max-time 30 "https://api.bilibili.com/pgc/player/web/playurl?avid=18281381&cid=29892777&qn=0&type=&otype=json&ep_id=183799&fourk=1&fnver=0&fnval=16&session=${randsession}&module=bangumi" 2>&1`; if [[ "$result" != "curl"* ]]; then local result="$(PharseJSON "${result}" "code")"; if [ "$?" = "0" ]; then if [ "${result}" = "0" ]; then echo -n -e "\r BiliBili HongKong/Macau/Taiwan:\t${green}Yes${jiacu}\n"; elif [ "${result}" = "-10403" ]; then echo -n -e "\r BiliBili HongKong/Macau/Taiwan:\t${red}No${jiacu}\n"; else echo -n -e "\r BiliBili HongKong/Macau/Taiwan:\t${red}Failed${jiacu} ${blue}(${result})${jiacu}\n"; fi else echo -n -e "\r BiliBili HongKong/Macau/Taiwan:\t${red}Failed (Parse Json)${jiacu}\n"; fi else echo -n -e "\r BiliBili HongKong/Macau/Taiwan:\t${red}Failed (Network Connection)${jiacu}\n"; fi } # 流媒体解锁测试-哔哩哔哩台湾限定 function MediaUnlockTest_BilibiliTW() { echo -n -e " Bilibili Taiwan Only:\t\t\t->\c"; local randsession="$(cat /dev/urandom | head -n 32 | md5sum | head -c 32)"; # 尝试获取成功的结果 local result=`curl --user-agent "${UA_Browser}" -${1} -fsSL --max-time 30 "https://api.bilibili.com/pgc/player/web/playurl?avid=50762638&cid=100279344&qn=0&type=&otype=json&ep_id=268176&fourk=1&fnver=0&fnval=16&session=${randsession}&module=bangumi" 2>&1`; if [[ "$result" != "curl"* ]]; then local result="$(PharseJSON "${result}" "code")"; if [ "$?" = "0" ]; then if [ "${result}" = "0" ]; then echo -n -e "\r Bilibili Taiwan Only:\t\t\t${green}Yes${jiacu}\n"; elif [ "${result}" = "-10403" ]; then echo -n -e "\r Bilibili Taiwan Only:\t\t\t${red}No${jiacu}\n"; else echo -n -e "\r Bilibili Taiwan Only:\t\t\t${red}Failed${jiacu} ${blue}(${result})${jiacu}\n"; fi else echo -n -e "\r Bilibili Taiwan Only:\t\t\t${red}Failed (Parse Json)${jiacu}\n"; fi else echo -n -e "\r Bilibili Taiwan Only:\t\t\t${red}Failed (Network Connection)${jiacu}\n"; fi } # 流媒体解锁测试-Abema.TV # function MediaUnlockTest_AbemaTV_IPTest() { echo -n -e " Abema.TV:\t\t\t\t->\c"; # local result=`curl --user-agent "${UA_Dalvik}" -${1} -fsL --write-out %{http_code} --max-time 30 "https://api.abema.io/v1/ip/check?device=android"`; if [[ "$result" == "000" ]]; then echo -n -e "\r Abema.TV:\t\t\t\t${red}Failed (Network Connection)${jiacu}\n"; return; fi local result=`curl --user-agent "${UA_Dalvik}" -${1} -fsL --max-time 30 "https://api.abema.io/v1/ip/check?device=android"`; local result="$(PharseJSON "${result}" "cdnRegionUrl")"; if [ "$?" = "0" ]; then if [ "${result}" = "https://ds-linear-abematv.akamaized.net/region" ] || [ "${result}" = "https://ds-glb-linear-abematv.akamaized.net/region" ]; then echo -n -e "\r Abema.TV:\t\t\t\t${green}Yes${jiacu}\n"; elif [ "${result}" = "" ] || [ "${result}" = "null" ]; then echo -n -e "\r Abema.TV:\t\t\t\t${red}No${jiacu}\n"; else echo -n -e "\r Abema.TV:\t\t\t\t${red}Failed${jiacu}\n"; fi else echo -n -e "\r Abema.TV:\t\t\t\t${red}Failed (Parse Json)${jiacu}\n"; fi } function MediaUnlockTest_PCRJP() { echo -n -e " Princess Connect Re:Dive Japan:\t->\c"; # 测试,连续请求两次 (单独请求一次可能会返回35, 第二次开始变成0) local result=`curl --user-agent "${UA_Dalvik}" -${1} -fsL --write-out %{http_code} --output /dev/null --max-time 30 https://api-priconne-redive.cygames.jp/`; if [ "$result" = "000" ]; then echo -n -e "\r Princess Connect Re:Dive Japan:\t${red}Failed (Network Connection)${jiacu}\n"; elif [ "$result" = "404" ]; then echo -n -e "\r Princess Connect Re:Dive Japan:\t${green}Yes${jiacu}\n"; elif [ "$result" = "403" ]; then echo -n -e "\r Princess Connect Re:Dive Japan:\t${red}No${jiacu}\n"; else echo -n -e "\r Princess Connect Re:Dive Japan:\t${red}Failed (Unexpected Result: $result)${jiacu}\n"; fi } function MediaUnlockTest_BBC() { echo -n -e " BBC:\t\t\t\t\t->\c"; local result=`curl --user-agent "${UA_Browser}" -${1} -fsL --write-out %{http_code} --output /dev/null --max-time 30 http://ve-dash-uk.live.cf.md.bbci.co.uk/`; if [ "${result}" = "000" ]; then echo -n -e "\r BBC:\t\t\t\t\t${red}Failed (Network Connection)${jiacu}\n"; elif [ "${result}" = "403" ]; then echo -n -e "\r BBC:\t\t\t\t\t${red}No${jiacu}\n"; elif [ "${result}" = "404" ]; then echo -n -e "\r BBC:\t\t\t\t\t${green}Yes${jiacu}\n"; else echo -n -e "\r BBC:\t\t\t\t\t${red}Failed (Unexpected Result: $result)${jiacu}\n"; fi } function MediaUnlockTest_Netflix() { echo -n -e " Netflix:\t\t\t\t->\c"; local result=`curl -${1} --user-agent "${UA_Browser}" -sSL "https://www.netflix.com/" 2>&1`; if [ "$result" == "Not Available" ];then echo -n -e "\r Netflix:\t\t\t\t${red}Unsupport${jiacu}\n" return; fi if [[ "$result" == "curl"* ]];then echo -n -e "\r Netflix:\t\t\t\t${red}Failed (Network Connection)${jiacu}\n" return; fi local result=`curl -${1} --user-agent "${UA_Browser}" -sL "https://www.netflix.com/title/80018499" 2>&1`; if [[ "$result" == *"page-404"* ]] || [[ "$result" == *"NSEZ-403"* ]];then echo -n -e "\r Netflix:\t\t\t\t${red}No${jiacu}\n" return; fi local result1=`curl -${1} --user-agent "${UA_Browser}" -sL "https://www.netflix.com/title/70143836" 2>&1`; local result2=`curl -${1} --user-agent "${UA_Browser}" -sL "https://www.netflix.com/title/80027042" 2>&1`; local result3=`curl -${1} --user-agent "${UA_Browser}" -sL "https://www.netflix.com/title/70140425" 2>&1`; local result4=`curl -${1} --user-agent "${UA_Browser}" -sL "https://www.netflix.com/title/70283261" 2>&1`; local result5=`curl -${1} --user-agent "${UA_Browser}"-sL "https://www.netflix.com/title/70143860" 2>&1`; local result6=`curl -${1} --user-agent "${UA_Browser}" -sL "https://www.netflix.com/title/70202589" 2>&1`; if [[ "$result1" == *"page-404"* ]] && [[ "$result2" == *"page-404"* ]] && [[ "$result3" == *"page-404"* ]] && [[ "$result4" == *"page-404"* ]] && [[ "$result5" == *"page-404"* ]] && [[ "$result6" == *"page-404"* ]];then echo -n -e "\r Netflix:\t\t\t\t${yellow}Only Homemade${jiacu}\n" return; fi local region=`tr [:lower:] [:upper:] <<< $(curl -${1} --user-agent "${UA_Browser}" -fs --write-out %{redirect_url} --output /dev/null "https://www.netflix.com/title/80018499" | cut -d '/' -f4 | cut -d '-' -f1)` ; if [[ ! -n "$region" ]];then region="US"; fi echo -n -e "\r Netflix:\t\t\t\t${green}Yes(Region: ${region})${jiacu}\n" return; } function MediaUnlockTest_YouTube_Region() { echo -n -e " YouTube Region:\t\t\t->\c"; local result=`curl --user-agent "${UA_Browser}" -${1} -sSL "https://www.youtube.com/" 2>&1`; if [[ "$result" == "curl"* ]];then echo -n -e "\r YouTube Region:\t\t\t${red}Failed (Network Connection)${jiacu}\n"; return; fi local result=`curl --user-agent "${UA_Browser}" -${1} -sL "https://www.youtube.com/red" | sed 's/,/\n/g' | grep "countryCode" | cut -d '"' -f4`; if [ -n "$result" ]; then echo -n -e "\r YouTube Region:\t\t\t${green}${result}${jiacu}\n"; return; fi echo -n -e "\r YouTube Region:\t\t\t${red}No${jiacu}\n"; return; } function MediaUnlockTest_DisneyPlus() { echo -n -e " DisneyPlus:\t\t\t\t->\c"; local result=`curl -${1} --user-agent "${UA_Browser}" -sSL "https://www.disneyplus.com/movies/drain-the-titanic/5VNZom2KYtlb" 2>&1`; if [[ "$result" == "curl"* ]];then echo -n -e "\r DisneyPlus:\t\t\t\t${red}Failed (Network Connection)${jiacu}\n"; return; fi if [[ "$result" == *"https://preview.disneyplus.com/unavailable/"* ]];then echo -n -e "\r DisneyPlus:\t\t\t\t${red}Unsupport${jiacu}\n"; return; fi if [[ "$result" == *"releaseYear"* ]];then echo -n -e "\r DisneyPlus:\t\t\t\t${green}Yes${jiacu}\n"; return; fi echo -n -e "\r DisneyPlus:\t\t\t\t${red}No${jiacu}\n"; return; } function MediaUnlockTest() { MediaUnlockTest_Netflix ${1}; MediaUnlockTest_DisneyPlus ${1}; MediaUnlockTest_YouTube_Region ${1}; MediaUnlockTest_HBONow ${1}; MediaUnlockTest_BahamutAnime ${1}; MediaUnlockTest_AbemaTV_IPTest ${1}; MediaUnlockTest_PCRJP ${1}; MediaUnlockTest_BBC ${1}; MediaUnlockTest_BilibiliTW ${1}; MediaUnlockTest_BilibiliChinaMainland ${1}; MediaUnlockTest_BilibiliHKMCTW ${1}; } media(){ check4=`ping 1.1.1.1 -c 1 2>&1`; if [[ "$check4" != *"unreachable"* ]] && [[ "$check4" != *"Unreachable"* ]];then echo "${magenta} ** 正在测试IPv4解锁情况${jiacu}"; MediaUnlockTest 4; else echo -e "${bold}当前主机不支持IPv4,跳过...${jiacu}"; fi echo check6=`ping6 240c::6666 -c 1 2>&1`; if [[ "$check6" != *"unreachable"* ]] && [[ "$check6" != *"Unreachable"* ]];then echo "${magenta} ** 正在测试IPv6解锁情况${jiacu}"; MediaUnlockTest 6; else echo -e "${bold}当前主机不支持IPv6,跳过...${jiacu}"; fi } #流媒体-结束 #展示 next() { printf "%-74s\n" "—" | sed 's/\s/-/g' | tee -a $log } print_system_info() { clear echo -e "${baihongse}\t\t\t服务器信息 By:Dxt\t\t\t\t${jiacu} " next echo -e " CPU 型号 ${green}$cname${jiacu}" | tee -a $log echo -e " CPU 核心 ${green}$cores Cores ${SKYBLUE}$freq MHz $arch${jiacu}" | tee -a $log echo -e " CPU 缓存 ${green}$corescache ${jiacu}" | tee -a $log echo -e " 内存大小 ${green}已用 $uram MB / 总 $tram MB ${blue}(缓冲区 $bram MB)${jiacu}" | tee -a $log echo -e " 交换分区 ${green}已用 $uswap MB / 总 $swap MB${jiacu}" | tee -a $log echo -e " 硬盘大小 ${green}已用 $disk_used_size GB / 总 $disk_total_size GB ${jiacu}" | tee -a $log echo -e " 操作系统 ${green}$opsy ($lbit Bit) ${blue}$virtual${jiacu}" | tee -a $log echo -e " 系统内核 ${green}$kern${jiacu}" | tee -a $log echo -e " 系统负载 ${green}$load${jiacu}" | tee -a $log echo -e " 运行时间 ${green}$up${jiacu}" | tee -a $log echo -e " 运 营 商 ${green}$asnnnnn${jiacu}" | tee -a $log echo -e " TCP 加速 ${green}$tcpctrl${jiacu}" | tee -a $log echo -e " 地理位置 ${green}$country, $regionn, $cityyyy${jiacu}" | tee -a $log next print_io next media next trip next echo -e " ${green}测试完毕!${jiacu}" | tee -a $log } # curl 包测试 if ! curl -V > /dev/null 2>&1;then InstallCurl fi # jq 包测试 if ! jq -V > /dev/null 2>&1;then InstallJQ fi # traceroute 包测试 traceroute -V > /dev/null 2>&1; if [ $? -ne 0 ];then InstallTraceroute fi get_system_info print_system_info