Autoblock Ip

I’m looking for a solution for outbound traffic, for example if a user attacks an external server they want to block its ip address, if the x server attacks another y server with 30mbps, that ip will automatically block, how can I create such protection?
I will pay if necessary