Ejemplo n.º 1
0
 def get(self):
     xmlParser = XMLParser()
     opened = xmlParser.open(self.OPTIONS_FILE)
     
     if(opened == True):
         rootNode = None
         if(xmlParser.hasRoot("CoreOptions") == False):
             rootNode = xmlParser.createRoot("CoreOptions")
         else:
             rootNode = xmlParser.root("CoreOptions")
         
         self.graphs_dir = xmlParser.child(rootNode, "GraphsDir").attribute("path")
         self.tmp_pcap_dir = xmlParser.child(rootNode, "TmpPcapDir").attribute("path")
         self.tcpflow_params = xmlParser.child(rootNode, "TcpflowParams").attribute("val")
         self.emulation_steps = xmlParser.child(rootNode, "EmulationSteps").attribute("val")
         if(xmlParser.child(rootNode, "SkipBigFiles").attribute("val") == "false"):
             self.skip_big_files = False
         else:
             self.skip_big_files = True
         self.skip_big_files_size = xmlParser.child(rootNode, "SkipBigFiles").attribute("size")
         if(xmlParser.child(rootNode, "SkipBrokenSamples").attribute("val") == "false"):
             self.skip_broken_samples = False
         else:
             self.skip_broken_samples = True
         self.skip_broken_samples_size = xmlParser.child(rootNode, "SkipBrokenSamples").attribute("size")
         if(xmlParser.child(rootNode, "SkipEmptySamples").attribute("val") == "false"):
             self.skip_empty_samples = False
         else:
             self.skip_empty_samples = True
         if(xmlParser.child(rootNode, "SkipNoSyscallNoLoopSamples").attribute("val") == "false"):
             self.skip_nosyscall_noloop_samples = False
         else:
             self.skip_nosyscall_noloop_samples = True
     
         xmlParser.close()
Ejemplo n.º 2
0
 def get(self):
     xmlParser = XMLParser()
     opened = xmlParser.open(self.OPTIONS_FILE)
     
     if(opened == True):
         rootNode = None
         if(xmlParser.hasRoot("Logging") == False):
             rootNode = xmlParser.createRoot("Logging")
         else:
             rootNode = xmlParser.root("Logging")
         
         # logging level
         self.level = xmlParser.child(rootNode, "Level").attribute("val")
         
         # status strategy
         if(xmlParser.child(rootNode, "StatusStrategy").attribute("type") == "database"):
             self.exportStatusDB = True
         else:
             self.exportStatusDB = False
         
         # description strategy
         if(xmlParser.child(rootNode, "DescriptionStrategy").attribute("type") == "xml"):
             self.exportDescriptionXML = True
         else:
             self.exportDescriptionXML = False
     
         xmlParser.close()
Ejemplo n.º 3
0
    def save(self):
        xmlParser = XMLParser()
        opened = xmlParser.open(self.OPTIONS_FILE)
        
        if(opened == True):
            rootNode = None
            if(xmlParser.hasRoot("Logging") == False):
                rootNode = xmlParser.createRoot("Logging")
            else:
                rootNode = xmlParser.root("Logging")

            # logging level
            xmlParser.child(rootNode, "Level").setAttribute("val", self.level)
            
            # status strategy
            s = xmlParser.child(rootNode, "StatusStrategy")
            xmlParser.removeChild(rootNode, s)
            if(self.exportStatusDB == True):
                xmlParser.createChild(rootNode, "StatusStrategy").setAttribute("type", "database")
        
        
            # description strategy
            d = xmlParser.child(rootNode, "DescriptionStrategy")
            xmlParser.removeChild(rootNode, d)
            if(self.exportDescriptionXML == True):
                xmlParser.createChild(rootNode, "DescriptionStrategy").setAttribute("type", "xml")
            
            xmlParser.close()
Ejemplo n.º 4
0
 def get(self):
     xmlParser = XMLParser()
     opened = xmlParser.open(self.STATUS_FILE)
     
     if(opened == True):
         rootNode = None
         if(xmlParser.hasRoot("SystemStatus") == False):
             rootNode = xmlParser.createRoot("SystemStatus")
         else:
             rootNode = xmlParser.root("SystemStatus")
         
         self.version = xmlParser.child(rootNode, "Version").attribute("val")
         self.current_task = xmlParser.child(rootNode, "CurrentTask").attribute("name")
         self.last_error = xmlParser.child(rootNode, "LastError").attribute("desc")
         self.errors_num = xmlParser.child(rootNode, "ErrorsNum").attribute("val")
     
         xmlParser.close()
Ejemplo n.º 5
0
 def get(self):
     xmlParser = XMLParser()
     opened = xmlParser.open(self.OPTIONS_FILE)
     
     if(opened == True):
         rootNode = None
         if(xmlParser.hasRoot("Database") == False):
             rootNode = xmlParser.createRoot("Database")
         else:
             rootNode = xmlParser.root("Database")
         
         self.driver = xmlParser.child(rootNode, "DBDriver").attribute("val")
         self.host = xmlParser.child(rootNode, "DBHost").attribute("val")
         self.name = xmlParser.child(rootNode, "DBName").attribute("val")
         self.user = xmlParser.child(rootNode, "DBUser").attribute("val")
         self.password = xmlParser.child(rootNode, "DBPass").attribute("val")
     
         xmlParser.close()