How to add multiple ip addresses to block list at once


I have a list of around 1,000 ip addresses that have been used to create multiple spam accounts on our site. I’d like to set up the JavaScript challenge for all of these ip addresses. I can see how to set up the challenge for individual ip addresses, but is there a way I can easily add these 1,000 ips all at once?


It can be done via the API. Haven’t tested this script, but something link this would probably work:

Thanks for the link to the documentation cscharff! I used that to put together a quick python script, which I’ve added here for anyone else trying to do the same thing.

import re, sys
import requests
fhand = open ('ip_list.txt')
auth_key = '***'
auth_email ='***'
headers = {'X-Auth-Email': auth_email, 'X-Auth-Key': auth_key, 'Content-Type': 'application/json'}

for ip in fhand:
	data = str('{{"mode":"js_challenge","configuration":{{"target":"ip","value": "{0}"}} }}'.format(str(ip.strip())))
	r ="***/firewall/access_rules/rules",   headers=headers, data=data)
	print ip
	print r.content
1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.