-
-
Save qunwang6/3cd4b7c67f5c4ce0515f9d6f83019755 to your computer and use it in GitHub Desktop.
Generate CSV of country/city/geo location/ISP information of the IPs banned by sshguard. Requires jq (https://stedolan.github.io/jq/).
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
#!/bin/sh | |
echo '"country","city","latitude","longitude","ISP","organization","IP"' | |
sudo iptables-save | grep sshguard | grep -oE '[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+' | xargs -I{} curl -s http://ip-api.com/json/{} | jq -r '[.country, .city, .lat, .lon, .isp, .org, .query] | @csv' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment