def testName(self): iptc = iptables.from_iptables_xml() c = iptc.get_chain_in_filter_table(iptables.IPTables.CHAIN_INPUT) print c t = iptc.get_nat_table() print t print iptc.get_filter_table()
def testName(self): iptc = iptables.from_iptables_xml() rule = iptables.Rule() m = iptables.SourceMatch() m.source_ip = '10.0.0.1/255.255.255.0' rule.add_match(m) t = iptables.SnatTarget() t.to_source = '192.168.0.199' rule.set_target(t) iptc.nat_table_prerouting_chain_add_rule(rule) print str(iptc)
def testName(self): iptc = iptables.from_iptables_xml() tbl = iptc.get_filter_table() c = iptables.Chain() c.name = 'testchain' r = iptables.Rule() m = iptables.TcpMatch() m.dport = 10 m.sport = 1000 r.add_match(m) t = iptables.AcceptTarget() r.set_target(t) c.add_rule(r) r = iptables.Rule() m = iptables.IcmpMatch() m.icmp_type = 8 r.add_match(m) t = iptables.ReturnTarget() r.set_target(t) c.add_rule(r) tbl.add_chain(c) print tbl
def testName(self): iptc = iptables.from_iptables_xml() print iptc.get_nat_table() print iptc.get_mangle_table() print iptc.get_nat_table()