Last active
March 23, 2016 09:45
-
-
Save kenzo0107/126e687ebc0a4b1747c7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# IP から HOST 情報取得 | |
# IP一覧 | |
IP_LIST_TXT=ip_list.txt | |
# 94.23.2.218 | |
# 81.143.127.209 | |
# 188.121.41.145 | |
# 結果出力 | |
RES=result_ip2hostinfo.txt | |
cp /dev/null ${RES} | |
while read IP | |
do | |
COUNTRY_CODE=$(curl -s curl -s ipinfo.io/${IP}/country) | |
CITY=$(curl -s curl -s ipinfo.io/${IP}/city) | |
ORG=$(curl -s curl -s ipinfo.io/${IP}/org) | |
HOSTNAME=$(curl -s curl -s ipinfo.io/${IP}/hostname) | |
echo "${IP}\t${COUNTRY_CODE}\t${CITY}\t${ORG}\t${HOSTNAME}" >> ${RES} | |
done < ${IP_LIST_TXT} | |
echo "FINISH !" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment