|
There are tools available to do what you wish.
Some ideas.
Iptables limit and recent match. Which can be used to drop packets over n simultaneous connection attempts from an ip.
fail2ban - scans log files, and generates firewall rules to "ban" IP's, and can also do additional things, like email alerts, with whois lookups for example.
|