Can I use the IPs gathered by a firewall rule to show them captha for the whole website?

Can I use the IPs from a fire rule to challenge them for the whole website? Lets say I have a rule that catches some IPs, how can I restrict the gathered ips?

There are intergrations like Fail2Ban which do this automatically

Or you can use the API