Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Geolocate a number of IP addresses via shell script' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Geolocate a number of IP addresses via shell script
Authored by: alblue on Jan 13, '10 09:57:11AM
Here's a better version, which doesn't write to any files. It also only relies on programs that are already installed on all Mac OS X machines, not extra downloads.
#!/bin/bash

for IP in $*
do
  curl -s http://www.geoiptool.com/en/?IP=${IP} | textutil -convert txt -stdin -stdout -format html | sed -n '/Host Name/,/Postal code/p' 
done


[ Reply to This | # ]
Geolocate a number of IP addresses via shell script
Authored by: ctierney on Jan 13, '10 10:18:20AM

Almost all. I don't have textutil on 10.3.9.



[ Reply to This | # ]
Geolocate a number of IP addresses via shell script
Authored by: afb on Jan 14, '10 12:10:32AM
This seems to leave out data. I get this for the IP in the hint:

Host Name:
cache04.ns.uu.net
IP Address:
198.6.1.5
Country:
United States 
Country code:
US (USA)
Region:
Oregon
City:
Eugene
Postal code:


[ Reply to This | # ]