Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #! /bin/bash
- ip_lookup="$*"
- url="http://geoiplookup.net/ip"
- prog=`basename $0`
- usage="USAGE: $prog IP IP2 .... IPn"
- if echo "${ip_lookup}" | grep -E '[ \t]*[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+[ \t]*' > /dev/null 2>&1 ;then
- :
- else
- echo "$usage" >&2
- exit 5
- fi
- for i in `echo $ip_lookup`
- do
- _info=`curl -s "$url/$i" | sed -n '/IP Address:/{n;p};/Country:/{n;p};/City:/{n;p}'`
- echo "${_info}" | sed 's/<[^>]*>//g'
- echo
- done
- exit 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement