Beispiel #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()
Beispiel #2
0
	def save(self):
		xmlParser = XMLParser()
		opened = xmlParser.open(self.TASKS_FILE)
		
		if(opened == True):
			rootNode = xmlParser.createRoot("Task")
			rootNode.setAttribute("type", "analyze")
			
			# name
			xmlParser.createChild(rootNode, "Name").setAttribute("val", self.__name)
			
			# files
			for f in self.__files:
				e = xmlParser.createChild(rootNode, "File")
				e.setAttribute("source", "local")
				e.setAttribute("path", f)
			
			# output
			for o in self.__output:
				xmlParser.createChild(rootNode, "Output").setAttribute("val", o)
			
			# override
			if(self.__duplicate == True):
				xmlParser.createChild(rootNode, "Duplicate").setAttribute("val", "true")
			else:
				xmlParser.createChild(rootNode, "Duplicate").setAttribute("val", "false")

			xmlParser.close()
    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()
 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()
	def removeTask(self, removeId):
		xmlParser = XMLParser()
		opened = xmlParser.open(self.TASKS_FILE)
		
		if(opened == True):
			taskNode = xmlParser.root("Task")
			taskId = 1
			
			while(str(taskId) != removeId):
				taskNode = taskNode.nextSiblingElement("Task")
				taskId += 1

			xmlParser.removeRoot(taskNode)
			xmlParser.close()
	def collectTasks(self):
		xmlParser = XMLParser()
		opened = xmlParser.open(self.TASKS_FILE)
		taskNames = []
		
		if(opened == True):
			taskNode = xmlParser.root("Task")
			
			while(taskNode.isNull() == False):
				name = taskNode.firstChildElement("Name").attribute("val")
				taskNames.append(name)
				taskNode = taskNode.nextSiblingElement("Task")

			xmlParser.close()
		
		return taskNames
Beispiel #7
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()
Beispiel #8
0
	def save(self):
		xmlParser = XMLParser()
		opened = xmlParser.open(self.TASKS_FILE)
		
		if(opened == True):
			rootNode = xmlParser.createRoot("Task")
			rootNode.setAttribute("type", "group")
			
			# name
			xmlParser.createChild(rootNode, "Name").setAttribute("val", self.__name)
			
			# files
			for f in self.__files:
				e = xmlParser.createChild(rootNode, "File")
				e.setAttribute("source", "local")
				e.setAttribute("path", f)
			
			# from
			xmlParser.createChild(rootNode, "From").setAttribute("date", self.__from)

			# until
			xmlParser.createChild(rootNode, "Until").setAttribute("date", self.__until)

			# algorithm
			xmlParser.createChild(rootNode, "Algorithm").setAttribute("name", self.__algorithm)
			
			# context
			for c in self.__context.keys():
				n = xmlParser.createChild(rootNode, "Context")
				n.setAttribute("name", c)
				n.setAttribute("val", self.__context[c])
			
			# input
			xmlParser.createChild(rootNode, "Input").setAttribute("val", self.__input)
			
			# output
			for o in self.__output:
				xmlParser.createChild(rootNode, "Output").setAttribute("val", o)
			
			# override
			if(self.__override == True):
				xmlParser.createChild(rootNode, "Override").setAttribute("val", "true")
			else:
				xmlParser.createChild(rootNode, "Override").setAttribute("val", "false")

			xmlParser.close()
    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()
Beispiel #10
0
    def save(self):
        xmlParser = XMLParser()
        opened = xmlParser.open(self.TASKS_FILE)
        
        if(opened == True):
            rootNode = xmlParser.createRoot("Task")
            rootNode.setAttribute("type", "export")
            
            # name
            xmlParser.createChild(rootNode, "Name").setAttribute("val", self.__name)
            
            # files
            for f in self.__files:
                e = xmlParser.createChild(rootNode, "File")
                e.setAttribute("source", "local")
                e.setAttribute("path", f)
            
            # from
            xmlParser.createChild(rootNode, "From").setAttribute("date", self.__from)

            # until
            xmlParser.createChild(rootNode, "Until").setAttribute("date", self.__until)

            # input
            xmlParser.createChild(rootNode, "Input").setAttribute("val", self.__input)
            
            # output
            for o in self.__output:
                xmlParser.createChild(rootNode, "Output").setAttribute("val", o)
            
            # only index file
            if(self.__onlyIndexFile == True):
                xmlParser.createChild(rootNode, "OnlyIndexFile").setAttribute("val", "true")
            else:
                xmlParser.createChild(rootNode, "OnlyIndexFile").setAttribute("val", "false")

            # export directory
            xmlParser.createChild(rootNode, "ExportDir").setAttribute("path", self.__export_dir)
            
            xmlParser.close()