If I have a CIDR like 13.54.63.128/26
can fail2ban-client
tell me if there's an IP in this range that's currently banned?
Currently I'm doing:
CIDR="13.54.63.128/26"
nmap -sL -n $CIDR | awk '/Nmap scan report/{print $NF}' | while read ip
do
sudo iptables -L -n | grep $ip
done
which does the job, but feels a bit hacky.
Please note this is not a question concerning fail2ban's partial IP matching. I want to know the client's ability to report on banned IPs.
There is a nifty little tool
grepcidr
that is useful for quick shell scripts that need to find matches from a specific CIDR in a list with IPv4 or IPv6 addresses.