Hi Foks,
I just want to check what countries were the most blocked once.
So I was locking for some existing function but cannot find any so I wrote it by myself and here is the 1 line code to find out what countries are worst!!!
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/bash | |
## all Fail2Ban Log should be logged into /var/log/fail2ban.log then this will work | |
## you need geoiplookup to get it runningyou can install it with sudo apt install geoip-bin | |
cat /var/log/fail2ban.log* | grep Ban | sed 's/.*[Bb]an \(.*\)/\1/' | uniq | while read line; do geoiplookup $line; done | sort | uniq -c | sort -nr |
br
wikrie