Skip to content

Instantly share code, notes, and snippets.

@toooonyy
Created August 20, 2015 03:07
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save toooonyy/90d64eba2df5b2b10fd0 to your computer and use it in GitHub Desktop.
Save toooonyy/90d64eba2df5b2b10fd0 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
# this use ip.cn and ip.com
ip=`mtr -rn $1 -c 1|awk '$2 ~ "[12]?[0-9]?[0-9]\.[12]?[0-9]?[0-9]\.[12]?[0-9]?[0-9]\.[12]?[0-9]?[0-9]"{print $2}'`
echo -e 'IP\t\t\tip.cn\t\t\tip.com'
for i in $ip
do
echo -e $i'\t\t\c'
curl -s "http://ip.cn/index.php?ip="$i | awk -F "来自:" '{printf $2"\t\t"}'
curl -s "ip138.com/ips138.asp?ip="$i | iconv -f gbk -t utf-8 | grep class=\"ul1\" |awk -F "本站主数据:" '{print $2}'| awk -F "<" '{print $1}'
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment