Looking for a way to add IPs to the blocked IPs list using a script or API

I have a website where I'm getting three, or four, thousand hits a day from a handful of IPs. When I block them another handful appear the next day and so on.

I've been manually adding the IPs each day, but could really use a way to do this programmatically.

Does anyone know where the list of blocked IPs is stored by NIS? And is there any way I can access it via an API, or whatever. It doesn't matter to me as long as I can get access to the file without having to use the keyboard.

Thanks.