automatically killing processes is a little dangerous (especially if you are doing it as root). You might do better to automate identifiying such processes, and then manually kill them. Have a look at the ps and top commands. Study the man pages and look for examples online. You can then write a script that uses ps or top to find suspicious CPU hogging processes and then send you an email if it finds something.
PS. If using top in a script make sure you look at the -b (batch mode) option.