in blocky-client.py [0:0]
def unban_line(ip, linenumber, chain='INPUT'):
""" Unbans an IP or block by line number """
if not linenumber:
return
exe = IPTABLES_EXEC
if ':' in ip:
exe = IP6TABLES_EXEC
if DEBUG:
print("Would have removed line %s from %s chain in iptables here..." % (linenumber, chain))
return True
try:
subprocess.check_call([
ENV_EXEC,
exe,
'-D', chain, linenumber
], stderr=open(os.devnull, 'wb'))
except subprocess.CalledProcessError as err: # iptables error, expected result variant
return False
except OSError as err:
print("%s not found or inaccessible: %s" % (exe, err))
return False
return True