I already have a library of security applications and scripts that monitor precisely what you are asking about specifically and directly interface CSF's configuration and could help you get setup with some of those if you would like.
However, if you are just wanting to know the command to call from your scripts to add to the "csf.deny" list, this works and doesn't require any restart of your firewall as it adds it live in one step:
Code:
# /usr/sbin/csf -d "(ip or cidr goes here)" "Any comments you want"
You can also temporarily ban IPs (in seconds):
Code:
# /usr/sbin/csf -td "(ip or cidr goes here)" 3600
(The above would block the IP given for 1 hour)
You could also setup a cron process to watch your log files and then issue these commands accordingly as needed.