Beispiel #1
0
    def getProperties(self):
        properties = []
        prop = Property('name', Format.STRING, self.getName())
        prop.setIsEditable(True)
        properties.append(prop)

        properties.append(Property('messages', Format.DECIMAL, len(self.getMessages())))
        properties.append(Property('fields', Format.DECIMAL, len(self.getExtendedFields())))
        minMsgSize = None
        maxMsgSize = 0
        avgMsgSize = 0
        if len(self.getMessages()) > 0:
            for m in self.getMessages():
                s = len(m.getData()) * 2
                if minMsgSize is None or s < minMsgSize:
                    minMsgSize = s
                if maxMsgSize is None or s > maxMsgSize:
                    maxMsgSize = s
                avgMsgSize += s
            avgMsgSize = avgMsgSize / len(self.getMessages())
        properties.append(Property('avg msg size (bytes)', Format.DECIMAL, avgMsgSize))
        properties.append(Property('min msg size (bytes)', Format.DECIMAL, minMsgSize))
        properties.append(Property('max msg size (bytes)', Format.DECIMAL, maxMsgSize))

        return properties
Beispiel #2
0
 def getProperties(self):
     """Computes and returns the properties of the current message
        @return an array with all the properties [[key,type,val],...]"""
     properties = super(L4NetworkMessage, self).getProperties()
     properties.append(Property('Layer 4 Protocol', Format.STRING, self.getL4Protocol()))
     properties.append(Property('Source port', Format.DECIMAL, self.getL4SourcePort()))
     properties.append(Property('Target port', Format.DECIMAL, self.getL4DestinationPort()))
     return properties
Beispiel #3
0
 def getProperties(self):
     properties = []
     properties.append(Property('ID', Format.STRING, str(self.getID())))
     properties.append(Property('Type', Format.STRING, self.getType()))
     properties.append(
         Property('Timestamp', Format.DECIMAL, self.getTimestamp()))
     properties.extend(super(RawMessage, self).getProperties())
     return properties
Beispiel #4
0
    def getProperties(self):
        properties = []
        prop = Property('name', Format.STRING, self.getName())
        prop.setIsEditable(True)
        properties.append(prop)

        properties.append(
            Property('messages', Format.DECIMAL, len(self.getMessages())))
        properties.append(
            Property('fields', Format.DECIMAL, len(self.getExtendedFields())))
        minMsgSize = None
        maxMsgSize = 0
        avgMsgSize = 0
        if len(self.getMessages()) > 0:
            for m in self.getMessages():
                s = len(m.getData()) * 2
                if minMsgSize is None or s < minMsgSize:
                    minMsgSize = s
                if maxMsgSize is None or s > maxMsgSize:
                    maxMsgSize = s
                avgMsgSize += s
            avgMsgSize = avgMsgSize / len(self.getMessages())
        properties.append(
            Property('avg msg size (bytes)', Format.DECIMAL, avgMsgSize))
        properties.append(
            Property('min msg size (bytes)', Format.DECIMAL, minMsgSize))
        properties.append(
            Property('max msg size (bytes)', Format.DECIMAL, maxMsgSize))

        return properties
Beispiel #5
0
 def getProperties(self):
     properties = super(L3NetworkMessage, self).getProperties()
     properties.append(
         Property('Layer 3 Protocol', Format.STRING, self.getL3Protocol()))
     properties.append(
         Property('Layer 3 Source Address', Format.IP,
                  self.getL3SourceAddress()))
     properties.append(
         Property('Layer 3 Destination Address', Format.IP,
                  self.getL3DestinationAddress()))
     return properties
Beispiel #6
0
    def getProperties(self):
        """Compute and return the list of properties of the actor"""
        properties = []
        properties.append(Property("ID", Format.STRING, self.getID()))
        properties.append(Property("Name", Format.STRING, self.getName()))
        initiator = "No"
        if self.isInitiator():
            initiator = "Yes"
        properties.append(Property("Initiator", Format.STRING, initiator))

        properties.extend(self.getAbstractionLayer().getProperties())

        return properties
Beispiel #7
0
 def getProperties(self):
     properties = []
     properties.append(
         Property("Protocol", Format.STRING, self.originalProtocol))
     properties.append(
         Property("Bind IP", Format.STRING, self.originalBindIp))
     properties.append(
         Property("Bind Port", Format.DECIMAL, self.originalBindPort))
     properties.append(
         Property("Target IP", Format.STRING, self.originalTargetIp))
     properties.append(
         Property("Target Port", Format.DECIMAL, self.originalTargetPort))
     return properties
    def getProperties(self):
        properties = []
        properties.extend(
            super(IRPDeviceIoControlMessage, self).getProperties())
        properties.append(Property('IOCTL', Format.DECIMAL, self.getIOCTL()))

        return properties
Beispiel #9
0
 def getProperties(self):
     properties = []
     properties.append(Property('ID', Format.STRING, str(self.getID())))
     properties.append(Property('Type', Format.STRING, self.getType()))
     properties.append(
         Property('Timestamp', Format.DECIMAL, self.getTimestamp()))
     properties.append(
         Property('Filename', Format.STRING, self.getFilename()))
     properties.append(
         Property('Creation Date', Format.STRING, self.getCreationDate()))
     properties.append(
         Property('Modification Date', Format.STRING,
                  self.getModificationDate()))
     properties.append(Property('Owner', Format.STRING, self.getOwner()))
     properties.append(Property('Size', Format.DECIMAL, self.getSize()))
     properties.append(
         Property('Line number', Format.DECIMAL, self.getLineNumber()))
     properties.append(Property('Data', Format.STRING,
                                self.getStringData()))
     properties.extend(super(FileMessage, self).getProperties())
     return properties
Beispiel #10
0
 def getProperties(self):
     properties = []
     properties.append(Property('ID', Format.STRING, str(self.getID())))
     properties.append(Property('Type', Format.STRING, self.getType()))
     properties.append(
         Property('Timestamp', Format.DECIMAL, self.getTimestamp()))
     properties.append(
         Property('Category', Format.STRING, self.getCategory()))
     properties.append(Property('Key', Format.STRING, self.getKey()))
     properties.append(
         Property('Direction', Format.STRING, self.getDirection()))
     properties.append(Property('Data', Format.STRING,
                                self.getStringData()))
     properties.extend(super(IPCMessage, self).getProperties())
     return properties
Beispiel #11
0
 def getProperties(self):
     properties = []
     properties.append(Property('ID', Format.STRING, str(self.getID())))
     properties.append(Property('Type', Format.STRING, self.getType()))
     properties.append(
         Property('Timestamp', Format.DECIMAL, self.getTimestamp()))
     properties.append(
         Property('Layer 2 Protocol', Format.STRING, self.getL2Protocol()))
     properties.append(
         Property('Layer 2 Source Address', Format.STRING,
                  self.getL2SourceAddress()))
     properties.append(
         Property('Layer 2 Destination Address', Format.STRING,
                  self.getL2DestinationAddress()))
     properties.append(Property('Data', Format.HEX, self.getStringData()))
     properties.extend(super(L2NetworkMessage, self).getProperties())
     return properties
    def envDepsSearch(self):
        """Search within symbol the environmental deps"""

        currentProject = self.vocabularyController.getCurrentProject()
        if currentProject is None:
            return

        # Create the Searcher
        searcher = Searcher(currentProject)

        # Retrieve all the possibles env dependencies (properties of messages And vocabulary env deps)
        envDeps = currentProject.getEnvironmentDependencies()

        # Search in the same time all the applicative data in the project
        appData = currentProject.getApplicativeData()
        for data in appData:
            print "data found"
            envDeps.append(
                Property(data.getName(), data.getType(), data.getValue()))

        # Create the search tasks
        self.searchTasks = []
        for prop in envDeps:
            if prop.getFormat() == Format.STRING:
                self.log.debug("Search for String {0}...".format(
                    prop.getCurrentValue()))
                self.searchTasks.extend(
                    searcher.getSearchedDataForString(
                        str(prop.getCurrentValue())))
            elif prop.getFormat() == Format.IP:
                self.log.debug("Search for IP {0}...".format(
                    prop.getCurrentValue()))
                self.searchTasks.extend(
                    searcher.getSearchedDataForIP(prop.getCurrentValue()))
            else:
                self.log.warn(
                    "A property with format {0} cannot be searched.".format(
                        prop.getFormat()))
    def __init__(self, controller):
        '''
        Constructor
        '''
        self.builder = Gtk.Builder()
        self.builder.add_from_file(
            os.path.join(ResourcesConfiguration.getStaticResources(), "ui",
                         "vocabulary",
                         "environmentDependenciesSearcherView.glade"))
        self._getObjects(self.builder, [
            "envDepsSearcherDialog", "cancelButton", "executeButton",
            "searchProgressBar", "envDependenciesListstore"
        ])
        self.controller = controller
        self.builder.connect_signals(self.controller)
        self.cancelButton.set_sensitive(True)

        # Update the list store of env. dependencies
        currentProject = self.controller.vocabularyController.getCurrentProject(
        )
        envDeps = []
        if currentProject is not None:
            envDeps.extend(currentProject.getEnvironmentDependencies())

        # Search in the same time all the applicative data in the project
        appData = currentProject.getApplicativeData()
        for data in appData:
            envDeps.append(
                Property(data.getName(), data.getType(), data.getValue()))

        for envDep in envDeps:
            i = self.envDependenciesListstore.append()
            self.envDependenciesListstore.set(i, 0,
                                              str(envDep.getCurrentValue()))
            self.envDependenciesListstore.set(i, 1, str(envDep.getName()))
            self.envDependenciesListstore.set(i, 2, str(envDep.getFormat()))
Beispiel #14
0
    def getProperties(self):
        properties = PropertyList()
        configuration = self.getConfiguration()
        properties.append(Property("workspace", Format.STRING, self.getPath()))
        prop = Property("name", Format.STRING, self.getName())
        prop.setIsEditable(True)
        properties.append(prop)

        prop = Property("description", Format.STRING, self.getDescription())
        prop.setIsEditable(True)
        properties.append(prop)

        properties.append(Property("date", Format.STRING, self.getCreationDate()))
        properties.append(Property("symbols", Format.DECIMAL, len(self.getVocabulary().getSymbols())))
        properties.append(Property("messages", Format.DECIMAL, len(self.getVocabulary().getMessages())))
        fields = 0
        for sym in self.getVocabulary().getSymbols():
            fields = fields + len(sym.getField().getExtendedFields())
        properties.append(Property("fields", Format.DECIMAL, fields))

        prop = Property(
            configuration.VOCABULARY_GLOBAL_FORMAT,
            Format.STRING,
            configuration.getVocabularyInferenceParameter(configuration.VOCABULARY_GLOBAL_FORMAT),
        )
        prop.setIsEditable(True)
        prop.setPossibleValues(Format.getSupportedFormats())
        properties.append(prop)

        prop = Property(
            configuration.VOCABULARY_GLOBAL_UNITSIZE,
            Format.STRING,
            configuration.getVocabularyInferenceParameter(configuration.VOCABULARY_GLOBAL_UNITSIZE),
        )
        prop.setIsEditable(True)
        prop.setPossibleValues(
            [UnitSize.NONE, UnitSize.BITS4, UnitSize.BITS8, UnitSize.BITS16, UnitSize.BITS32, UnitSize.BITS64]
        )
        properties.append(prop)

        prop = Property(
            configuration.VOCABULARY_GLOBAL_SIGN,
            Format.STRING,
            configuration.getVocabularyInferenceParameter(configuration.VOCABULARY_GLOBAL_SIGN),
        )
        prop.setIsEditable(True)
        prop.setPossibleValues([Sign.SIGNED, Sign.UNSIGNED])
        properties.append(prop)

        prop = Property(
            configuration.VOCABULARY_GLOBAL_ENDIANESS,
            Format.STRING,
            configuration.getVocabularyInferenceParameter(configuration.VOCABULARY_GLOBAL_ENDIANESS),
        )
        prop.setIsEditable(True)
        prop.setPossibleValues([Endianess.BIG, Endianess.LITTLE])
        properties.append(prop)
        return properties
Beispiel #15
0
    def getProperties(self):
        properties = PropertyList()
        configuration = self.getConfiguration()
        properties.append(Property('workspace', Format.STRING, self.getPath()))
        prop = Property('name', Format.STRING, self.getName())
        prop.setIsEditable(True)
        properties.append(prop)

        prop = Property('description', Format.STRING, self.getDescription())
        prop.setIsEditable(True)
        properties.append(prop)

        properties.append(
            Property('date', Format.STRING, self.getCreationDate()))
        properties.append(
            Property('symbols', Format.DECIMAL,
                     len(self.getVocabulary().getSymbols())))
        properties.append(
            Property('messages', Format.DECIMAL,
                     len(self.getVocabulary().getMessages())))
        fields = 0
        for sym in self.getVocabulary().getSymbols():
            fields = fields + len(sym.getField().getExtendedFields())
        properties.append(Property('fields', Format.DECIMAL, fields))

        prop = Property(
            configuration.VOCABULARY_GLOBAL_FORMAT, Format.STRING,
            configuration.getVocabularyInferenceParameter(
                configuration.VOCABULARY_GLOBAL_FORMAT))
        prop.setIsEditable(True)
        prop.setPossibleValues(Format.getSupportedFormats())
        properties.append(prop)

        prop = Property(
            configuration.VOCABULARY_GLOBAL_UNITSIZE, Format.STRING,
            configuration.getVocabularyInferenceParameter(
                configuration.VOCABULARY_GLOBAL_UNITSIZE))
        prop.setIsEditable(True)
        prop.setPossibleValues([
            UnitSize.NONE, UnitSize.BITS4, UnitSize.BITS8, UnitSize.BITS16,
            UnitSize.BITS32, UnitSize.BITS64
        ])
        properties.append(prop)

        prop = Property(
            configuration.VOCABULARY_GLOBAL_SIGN, Format.STRING,
            configuration.getVocabularyInferenceParameter(
                configuration.VOCABULARY_GLOBAL_SIGN))
        prop.setIsEditable(True)
        prop.setPossibleValues([Sign.SIGNED, Sign.UNSIGNED])
        properties.append(prop)

        prop = Property(
            configuration.VOCABULARY_GLOBAL_ENDIANESS, Format.STRING,
            configuration.getVocabularyInferenceParameter(
                configuration.VOCABULARY_GLOBAL_ENDIANESS))
        prop.setIsEditable(True)
        prop.setPossibleValues([Endianess.BIG, Endianess.LITTLE])
        properties.append(prop)
        return properties
Beispiel #16
0
    def getProperties(self):
        properties = []
        properties.append(Property('ID', Format.STRING, str(self.getID())))
        properties.append(Property('Type', Format.STRING, self.getType()))
        properties.append(
            Property('Timestamp', Format.DECIMAL, self.getTimestamp()))

        properties.append(
            Property('Direction', Format.STRING, self.getDirection()))
        properties.append(Property('Major', Format.STRING, self.getMajor()))
        properties.append(Property('Minor', Format.DECIMAL, self.getMinor()))
        properties.append(
            Property('Requestmode', Format.STRING, self.getRequestMode()))
        properties.append(Property('PID', Format.DECIMAL, self.getPID()))
        properties.append(Property('Status', Format.DECIMAL, self.getStatus()))
        properties.append(
            Property('Information', Format.DECIMAL, self.getInformation()))
        properties.append(Property('Cancel', Format.STRING, self.getCancel()))
        properties.append(Property('SizeIn', Format.DECIMAL, self.getSizeIn()))
        properties.append(
            Property('SizeOut', Format.DECIMAL, self.getSizeOut()))

        properties.append(Property('Data', Format.HEX, self.getStringData()))
        properties.append(
            Property('Pattern', Format.STRING, self.getPatternString()))
        properties.extend(super(IRPMessage, self).getProperties())
        return properties