AI becoming virus generators

Now that they’ve connected AIs to the Internet with script generating and running abilities how will we stop the viruses they generate?