From d623f9a7484362fe3ac85dda05c4a1762ae9307b Mon Sep 17 00:00:00 2001 From: mh4x0f Date: Tue, 26 Oct 2021 20:21:30 -0300 Subject: [PATCH] Added support to OS (kali linux for example) that using iptables with nf_tables as default --- evillimiter/common/globals.py | 2 +- evillimiter/console/shell.py | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/evillimiter/common/globals.py b/evillimiter/common/globals.py index 2df03dc..bcd0dde 100644 --- a/evillimiter/common/globals.py +++ b/evillimiter/common/globals.py @@ -3,7 +3,7 @@ BROADCAST = 'ff:ff:ff:ff:ff:ff' BIN_TC = shell.locate_bin('tc') -BIN_IPTABLES = shell.locate_bin('iptables') +BIN_IPTABLES = shell.locate_iptables_bin('iptables') BIN_SYSCTL = shell.locate_bin('sysctl') IP_FORWARD_LOC = 'net.ipv4.ip_forward' \ No newline at end of file diff --git a/evillimiter/console/shell.py b/evillimiter/console/shell.py index 5cdd37b..c2d7ec6 100644 --- a/evillimiter/console/shell.py +++ b/evillimiter/console/shell.py @@ -21,6 +21,11 @@ def output_suppressed(command, root=True): return subprocess.check_output('sudo ' + command if root else command, shell=True, stderr=DEVNULL).decode('utf-8') +def locate_iptables_bin(name): + if "nf_tables" in output_suppressed("{} --version".format(name)): + return locate_bin("iptables-legacy") + return locate_bin(name) + def locate_bin(name): try: return output_suppressed('which {}'.format(name)).replace('\n', '')