Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#!/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
You can’t perform that action at this time.