Skip to content

Instantly share code, notes, and snippets.

@robertsinfosec
Created May 10, 2025 19:51
Show Gist options
  • Save robertsinfosec/be19323d52b2e1d13187ec94685f3767 to your computer and use it in GitHub Desktop.
Save robertsinfosec/be19323d52b2e1d13187ec94685f3767 to your computer and use it in GitHub Desktop.
Shows details of all active Fail2Ban jails on the current system.
#!/bin/bash
JAILS=$(fail2ban-client status | grep "Jail list" | sed -E 's/^[^:]+:[ \t]+//' | sed 's/,//g')
INDEX=1
for JAIL in $JAILS
do
echo ""
echo -n "${INDEX}) "
fail2ban-client status $JAIL
((INDEX++))
done
echo ""
echo "$(find /var/log/syslog -type f -mtime -1 -exec grep "UFW BLOCK" {} \; | wc -l) blocks in the past 24 hours."
echo ""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment