Last active
May 8, 2020 07:45
-
-
Save rollwagen/cdfbc989c510c0f5925a55455e76274a to your computer and use it in GitHub Desktop.
Extract IPs from vsftpd.log and resolve/print geo-location.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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