Ejemplo n.º 1
0
    def save(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")

            xmlParser.child(rootNode, "GraphsDir").setAttribute("path", self.graphs_dir)
            xmlParser.child(rootNode, "TmpPcapDir").setAttribute("path", self.tmp_pcap_dir)
            xmlParser.child(rootNode, "TcpflowParams").setAttribute("val", self.tcpflow_params)
            xmlParser.child(rootNode, "EmulationSteps").setAttribute("val", self.emulation_steps)
            if(self.skip_big_files == True):
                xmlParser.child(rootNode, "SkipBigFiles").setAttribute("val", "true")
            else:
                xmlParser.child(rootNode, "SkipBigFiles").setAttribute("val", "false")
            xmlParser.child(rootNode, "SkipBigFiles").setAttribute("size", self.skip_big_files_size)
            if(self.skip_broken_samples == True):
                xmlParser.child(rootNode, "SkipBrokenSamples").setAttribute("val", "true")
            else:
                xmlParser.child(rootNode, "SkipBrokenSamples").setAttribute("val", "false")
            xmlParser.child(rootNode, "SkipBrokenSamples").setAttribute("size", self.skip_broken_samples_size)
            if(self.skip_empty_samples == True):
                xmlParser.child(rootNode, "SkipEmptySamples").setAttribute("val", "true")
            else:
                xmlParser.child(rootNode, "SkipEmptySamples").setAttribute("val", "false")
            if(self.skip_nosyscall_noloop_samples == True):
                xmlParser.child(rootNode, "SkipNoSyscallNoLoopSamples").setAttribute("val", "true")
            else:
                xmlParser.child(rootNode, "SkipNoSyscallNoLoopSamples").setAttribute("val", "false")
        
            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 save(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")

            xmlParser.child(rootNode, "DBDriver").setAttribute("val", self.driver)
            xmlParser.child(rootNode, "DBHost").setAttribute("val", self.host)
            xmlParser.child(rootNode, "DBName").setAttribute("val", self.name)
            xmlParser.child(rootNode, "DBUser").setAttribute("val", self.user)
            xmlParser.child(rootNode, "DBPass").setAttribute("val", self.password)
        
            xmlParser.close()