def test_04_raw_table(self): """ Tables 04: raw OUTPUT entry """ tables = Tables(dst, "") line = "iptables -t raw -A OUTPUT" line = line + " -p tcp --dport 80 -j ACCEPT" tables.put_into_tables(line) expect = ['-A OUTPUT -p tcp --dport 80 -j ACCEPT '] self.assertEqual(expect, tables.data["raw"]["OUTPUT"])
def test_03_mangle_table(self): """ Tables 03: mangle INPUT entry """ tables = Tables(dst, "") line = "iptables -t mangle -A INPUT" line = line + " -p tcp --dport 80 -j ACCEPT" tables.put_into_tables(line) expect = ['-A INPUT -p tcp --dport 80 -j ACCEPT '] self.assertEqual(expect, tables.data["mangle"]["INPUT"])
def test_02_nat_prerouting(self): """ Tables 02: nat PREROUTING entry """ tables = Tables(dst, "") line = "iptables -t nat -A PREROUTING -s 10.0.0.0/21" line = line + " -p tcp --dport 80 -j SNAT --to-source 192.168.1.15" tables.put_into_tables(line) expect = ['-A PREROUTING -s 10.0.0.0/21 -p tcp --dport 80 -j SNAT --to-source 192.168.1.15 '] self.assertEqual(expect, tables.data["nat"]["PREROUTING"])
def test_02_nat_prerouting(self): """ Tables 02: nat PREROUTING entry """ tables = Tables(dst, "") line = "iptables -t nat -A PREROUTING -s 10.0.0.0/21" line = line + " -p tcp --dport 80 -j SNAT --to-source 192.168.1.15" tables.put_into_tables(line) expect = [ '-A PREROUTING -s 10.0.0.0/21 -p tcp --dport 80 -j SNAT --to-source 192.168.1.15 ' ] self.assertEqual(expect, tables.data["nat"]["PREROUTING"])