批量查看ip归属地 不指定

kangyang , 2014/07/22 10:48 , SHELL脚本 , 评论(0) , 阅读(2311) , Via 本站原创 | |

#!/bin/bash
#get ip souce
SAVEFILE=ipaddress.txt

for i in `cat ip.txt`
do
wget http://www.ip168.com/ip/?ip=$i &>/dev/null
address=`cat index.html\?ip\=$i | grep 本站主数据|sed 's/<div>.*:\(.*\)<.*>/\1/'`

if [ "$address" == "" ];then
   echo -n "Failed get $i source,please check..."
fi
echo "$i$address" >> $SAVEFILE
rm -rf index.html\?ip\=$i
done

echo "All work done."
发表评论

昵称

网址

电邮

打开HTML 打开UBB 打开表情 隐藏 记住我 [登入] [注册]