2019年9月21日 星期六

查看目前v2ray server的連接數目

查看目前v2ray server的連接數目的bash 腳本

get_IP_address(){
 IP=$1 
 IP_address=`wget -qO- -t1 -T2 http://freeapi.ipip.net/${IP}|sed 's/\"//g;s/,//g;s/\[//g;s/\]//g'`
 user_IP="${IP}(${IP_address})"
 echo "${user_IP}"
 sleep 1s
}

debian_View_user_connection_info(){

 IP_total=`netstat -anp |grep 'ESTABLISHED' |grep 'v2ray' |grep 'tcp6' |awk '{print $5}' \
  |awk -F ":" '{print $1}' |sort -u |grep -E -o "([0-9]{1,3}[\.]){3}[0-9]{1,3}"`

 for x in ${IP_total}
 do 
  c=$((c+1))
 done
 echo "# of connection : $c" 

 for x in ${IP_total}
 do 
  get_IP_address $x
 done
}

debian_View_user_connection_info

沒有留言:

張貼留言