"""
:param ip: ipv4 address
:raises a BlockipError in case of errors."""
- command = "iptables -I blockip -s {ip} -j ACCEPT".format(ip=ip)
- p = call(command, shell=True)
+ command = ['iptables', '-I', 'blockip', '-s', str(ip), '-j', 'ACCEPT']
+ p = call(command)
if p != 0:
raise BlockipError(p)
"""
:param ip: ipv4 address
:raises a BlockipError in case of errors."""
- command = "iptables -D blockip -s {ip} -j ACCEPT".format(ip=ip)
- p = call(command, shell=True)
+ command = ['iptables', '-D', 'blockip', '-s', str(ip), '-j', 'ACCEPT']
+ p = call(command)
if p != 0:
raise BlockipError(p)