Im an oper and would like to auto kick some spambots.Only way to see its a spambot is via the real ip. I cant find any other way than /whois where the ip shows in the 'nick is connecting from...'

What im looking for is a script that do a whois or something else if there is a way and then compare the real ip against a set of knowen spambot ip ranges. Can any help?