def del_standard(self): """ Del rules that are there but should not be deleted These standard firewall rules vary according to the device type """ type = CsCmdLine("cmdline").get_type() try: table = '' for i in open("/etc/iptables/iptables-%s" % type): if i.startswith('*'): # Table table = i[1:].strip() if i.startswith('-A'): # Rule self.del_rule(table, i.strip()) except IOError: # Nothing can be done return
def get_cmdline_instance(cls): if cls.cl is None: cls.cl = CsCmdLine("cmdline") return cls.cl