1 2 3 4 5 6 7 | #!/usr/bin/env python import json import sys for rule in json.load(sys.stdin): print("iptables -I INPUT -s {ip}/{cidr} -p {protocol} " "-m {protocol} --dport {port} -j ACCEPT".format(**rule)) |
IyEvdXNyL2Jpbi9lbnYgcHl0aG9uCmltcG9ydCBqc29uCmltcG9ydCBzeXMKCmZvciBydWxlIGluIGpzb24ubG9hZChzeXMuc3RkaW4pOgogICAgcHJpbnQoImlwdGFibGVzIC1JIElOUFVUIC1zIHtpcH0ve2NpZHJ9IC1wIHtwcm90b2NvbH0gIgogICAgICAgICAgIi1tIHtwcm90b2NvbH0gLS1kcG9ydCB7cG9ydH0gLWogQUNDRVBUIi5mb3JtYXQoKipydWxlKSk=
-
upload with new input
-
result: Success time: 0.09s memory: 11024 kB returned value: 0
[ { "ip": "1.2.3.4", "cidr": 32, "protocol": "tcp", "port": 3306 }, { "ip": "2.4.5.6", "cidr": 32, "protocol": "tcp", "port": 80 }, { "ip": "5.6.7.8", "cidr": 32, "protocol": "tcp", "port": 443 }, { "ip": "6.8.3.1", "cidr": 32, "protocol": "tcp", "port": 53 } ]iptables -I INPUT -s 1.2.3.4/32 -p tcp -m tcp --dport 3306 -j ACCEPT iptables -I INPUT -s 2.4.5.6/32 -p tcp -m tcp --dport 80 -j ACCEPT iptables -I INPUT -s 5.6.7.8/32 -p tcp -m tcp --dport 443 -j ACCEPT iptables -I INPUT -s 6.8.3.1/32 -p tcp -m tcp --dport 53 -j ACCEPT


