If you prefer a Perl script instead of Python you could try out a Perl hack of mine called LogSentry. Monitors ssh and ftp logs. Pretty much the same funcionality as BlockHosts I guess but I was unaware of BlockHosts when I needed it.
It supports OpenSSH and vsftpd.