Skip to content

Instantly share code, notes, and snippets.

@rollwagen
Last active May 8, 2020 07:45
Show Gist options
  • Save rollwagen/cdfbc989c510c0f5925a55455e76274a to your computer and use it in GitHub Desktop.
Save rollwagen/cdfbc989c510c0f5925a55455e76274a to your computer and use it in GitHub Desktop.
Extract IPs from vsftpd.log and resolve/print geo-location.
IP_ADDRESSES=`cat vsftpd.log | grep CONNECT | awk -F':' '{print $7}'|sed 's/\"//'|sort|uniq|tr '\n' ' '`
for address in $IP_ADDRESSES; do
curl --silent http://api.ipstack.com/${address}?access_key=$IPSTACK_KEY | jq '.city, .country_name, .continent_name'| tr '\n' ','|sed "s/,$//"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment