Created
April 4, 2017 16:34
-
-
Save polprog/96d0bd410c31eaec699a61e1ff6be6ba to your computer and use it in GitHub Desktop.
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 | |
#Analyze fail2ban logs and make a top 10 list of abusers! | |
if [[ $1 == "today" ]]; then | |
echo "Top abusers today:" | |
grep "Ban " /var/log/fail2ban.log | grep `date +%Y-%m-%d` | awk '{print $NF}' | sort | awk '{print $1,"("$1")"}' | logresolve | uniq -c | sort -n | |
else | |
echo "Top abusers:" | |
grep "Ban " /var/log/fail2ban.log | awk -F[\ \:] '{print $10,$8}' | sort | uniq -c | sort -n | |
echo "Run '$0 today' to get todays suspicious activity" | |
fi; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment