If you use a service that requires you to whitelist multiple IP addresses or you have multiple IP addresses that are blocked currently in your current firewall or in any other way and you wish to transition them to the BitNinja ipsets.
Bulk actions can be done via the BitNinja CLI. You can also add IP addresses to the blacklist and the whitelist from the Dashboard.
Bulk Whitelist and Blacklist from the Dashboard
For this feature open the Firewall menu and click on the Blacklist or Whitelist menu and click on the “ADD MANY” button.

And add the IP addresses separated by enter. Each IP address or IP address range should be in a new line.
You can also set an expiration date for the IP address after that it gets delisted from the blacklist or whitelist.
You can also select the server where you would like to whitelist/ blacklist the IP addresses on. If there is no server selected the IP addresses will be added on all server’s whitelist or blacklist. The servers cannot be specified afterwards per IP address.

Bulk greylisting, blacklisting, and whitelisting from the BitNinjaCLI
Example of a script that adds a list of IP addresses to your whitelist blacklist or greylist:
- Create a file called iplist.txt and insert the Ip addresses you would like to check/add
e.g.:nano iplist.txt
and paste the IP addresses and then pressctrl+ x
theny
then enter - Make a file called
AddToGreylist.sh
and paste the text below into it
e.g.:nano AddToGreylist.sh
#!/bin/bash
while read line; do echo $line;
#bitninjacli --greylist/ --blacklist/ --whitelist --add/ --del/ --check = IPaddress
#e.g.:
#greylisting
bitninjacli --greylist --add=$line
#blacklisting
#bitninjacli --blacklist --add=$line
#whitelisting
#bitninjacli --whitelist --add=$line
done < $1
- Issue the command
chmod +x AddToGreylist.sh
so it will be executable - Run the command and pass the
iplist.txt
file as a parameter to it with./AddToGreylist.sh iplist.txt