Ejemplo n.º 1
0
 def nat_translation_addr_port(self,action,type,rule_num,trans_addr_port):
     if vld.testip(trans_addr_port):
         suffix=[rule_num,"translation address",trans_addr_port]
     elif str(trans_addr_port).isdigit():
         suffix=[rule_num,"translation port",trans_addr_port]
     else:
         logger.error("%s: unknown type either it is an ip address or a port number in translation operation!"%addr_port)
         return False
     return self.nat_config(action,type,suffix)
Ejemplo n.º 2
0
 def nat_translation_addr_port(self, action, type, rule_num,
                               trans_addr_port):
     if vld.testip(trans_addr_port):
         suffix = [rule_num, "translation address", trans_addr_port]
     elif str(trans_addr_port).isdigit():
         suffix = [rule_num, "translation port", trans_addr_port]
     else:
         logger.error(
             "%s: unknown type either it is an ip address or a port number in translation operation!"
             % addr_port)
         return False
     return self.nat_config(action, type, suffix)
Ejemplo n.º 3
0
 def nat_filter_addr_port(self,action,type,rule_num,orient,addr_port):
     if not orient in self.type:
         logger.error("%s: invalid position!"%orient)
         return False
     if vld.testip(addr_port):
         suffix=[rule_num,orient,"address",addr_port+"/24"]
     elif str(addr_port).isdigit():
         suffix=[rule_num,orient,"port",addr_port]
     else:
         logger.error("%s: unknown type either it is an ip address or a port number in filtering operation!"%addr_port)
         return False
     return self.nat_config(action,type,suffix)
Ejemplo n.º 4
0
 def nat_filter_addr_port(self, action, type, rule_num, orient, addr_port):
     if not orient in self.type:
         logger.error("%s: invalid position!" % orient)
         return False
     if vld.testip(addr_port):
         suffix = [rule_num, orient, "address", addr_port + "/24"]
     elif str(addr_port).isdigit():
         suffix = [rule_num, orient, "port", addr_port]
     else:
         logger.error(
             "%s: unknown type either it is an ip address or a port number in filtering operation!"
             % addr_port)
         return False
     return self.nat_config(action, type, suffix)