add mass whitelist by ip or domain

Jun 13, 2024
16
1
3
hi,

i used this command to add multiple email adress to the blacklist, but it only work for email adress, i'm trying to modify the command to add domains and ip adress (in two separate command i assume?)

heres the command i used for emails:

while read line;do pmgsh create /config/ruledb/who/2/email --email "$line" ; done < black.txt


thanks
 
Hi @eaglex01,

You can try with this script:
Code:
#!/bin/bash
while read line;do
    TYPE='domain'
    if [[ "$line" == *"@"* ]]; then
        TYPE='email'
    fi
    pmgsh create /config/ruledb/who/2/${TYPE} --${TYPE} "$line"
done < black.txt

PS:
For domain:
Code:
pmgsh create /config/ruledb/who/2/domain --domain example.com
For single ip address:
Code:
pmgsh create /config/ruledb/who/2/ip --ip 1.1.1.1
For network:
Code:
pmgsh create /config/ruledb/who/2/network --cidr 1.1.1.0/24
 
Last edited: