iploc is a unix shell command witten in go detecting IP strings in text and geolocating them.
Easy:
echo "116.31.116.44" | iploc
[116.31.116.44:China Telecom Guangdong/CN/Xinxi]
What about this use case ?
cat ~/auth.log | grep Failed | ./iploc
Jan 6 06:55:25 pogo sshd[9124]: Failed password for root from [116.31.116.44:China Telecom Guangdong/CN/Xinxi] port 47017 ssh2
Jan 6 06:55:41 pogo sshd[9129]: Failed password for root from [116.31.116.44:China Telecom Guangdong/CN/Xinxi] port 42884 ssh2
Jan 6 06:55:59 pogo sshd[9133]: Failed password for root from [116.31.116.44:China Telecom Guangdong/CN/Xinxi] port 48093 ssh2
Jan 6 06:57:03 pogo sshd[9147]: Failed password for root from [116.31.116.44:China Telecom Guangdong/CN/Xinxi] port 41735 ssh2
Jan 6 06:57:05 pogo sshd[9147]: Failed password for root from [116.31.116.44:China Telecom Guangdong/CN/Xinxi] port 41735 ssh2
Jan 6 06:57:06 pogo sshd[9152]: Failed password for root from [89.132.5.72:UPC Magyarorszag Kft./HU/Gyomro] port 4938 ssh2
Pretty easy:
git clone git@github.com:NothNoth/iploc.git
cd iploc/iploc/
go build
iploc basically performs regexps to extract ip addresses from the input text stream then uses and external online service for IP identification (http://ip-api.com/)
iploc is distributed under BSD licence.