def exportSelectedFields_cb(self, event):
     # If fields header are selected, we get it
     fields = self.vocabularyController.view.selectedMessageTable.treeViewHeaderGroup.getSelectedFields()
     if fields is None or len(fields) == 0:
         # Either, we only consider the current field
         fields = [self.field]
     # We retrieve the first and last fields selected
     firstField = fields[0]
     lastField = fields[0]
     for field in fields:
         if field.getIndex() < firstField.getIndex():
             firstField = field
         if field.getIndex() > lastField.getIndex():
             lastField = field
     # We initialize the correct number of new messages
     newMessages = []
     for message in self.getSymbol().getMessages():
         mUuid = str(uuid.uuid4())
         newMessages.append(RawMessage(mUuid, message.getTimestamp(), ""))
     # We concatenate between the first and last cells
     for index in range(firstField.getIndex(), lastField.getIndex() + 1):
         cells = self.getSymbol().getFieldByIndex(index).getCells()
         for i in range(len(cells)):
             newMessages[i].setData(str(newMessages[i].getStringData()) + str(cells[i]))
     # We create a new symbol and register it
     currentWorkspace = self.vocabularyController.getCurrentWorkspace()
     currentProject = self.vocabularyController.netzob.getCurrentProject()
     confirmController = ConfirmImportMessagesController(currentWorkspace, currentProject, "RAW", newMessages)
     confirmController.run()
     # Update UI
     self.vocabularyController.view.updateSelectedMessageTable()
     self.vocabularyController.view.updateLeftPanel()
Example #2
0
    def saveMessagesInProject(self, workspace, project, messages):
        """Add a selection of messages to an existing project
           it also saves them in the workspace"""

        if self.end_cb is not None:
            self.end_cb(workspace, project, self.type, messages)
        else:
            confirmController = ConfirmImportMessagesController(workspace, project, self.type, messages)
            confirmController.run()
 def requestConfirmation(self, workspace, project, type, messages):
     confirmController = ConfirmImportMessagesController(workspace, project, type, messages)
     confirmController.setFinish_cb(self.plugin.finish)
     GObject.idle_add(confirmController.run)
 def requestConfirmation(self, workspace, project, type, messages):
     confirmController = ConfirmImportMessagesController(
         workspace, project, type, messages)
     confirmController.setFinish_cb(self.plugin.finish)
     GObject.idle_add(confirmController.run)