コード例 #1
0
 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"])
コード例 #2
0
 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"])
コード例 #3
0
ファイル: test_iptables_converter.py プロジェクト: sl0/conv
 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"])
コード例 #4
0
ファイル: test_iptables_converter.py プロジェクト: sl0/conv
 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"])
コード例 #5
0
ファイル: test_iptables_converter.py プロジェクト: sl0/conv
 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"])
コード例 #6
0
 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"])