domain list ip check 도메인 리스트 아이피 조회 스크립트
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
#!/bin/bash # domain list -> ip check # jsh # mail to : jsh@xinet.kr function validateIP() { local ip=$1 local stat=1 if [[ $ip =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then OIFS=$IFS IFS='.' ip=($ip) IFS=$OIFS [[ ${ip[0]} -le 255 && ${ip[1]} -le 255 \ && ${ip[2]} -le 255 && ${ip[3]} -le 255 ]] stat=$? fi return $stat } for i in `cat domain_list.txt` do IP=`ping -c 1 -w 1 $i | head -n 1 | awk '{print $3}' | sed -e s/\)//g | sed -e s/\(//g` validateIP $IP if [[ $? -ne 0 ]] then echo "$i is IP = NONE " else echo "$i is IP = $IP " fi echo "----------------------------" done |