Beispiel #1
0
class EntityProperties(MaltegoElement):
    class meta:
        tagname = 'Properties'

    value = fields_.String(required=False)
    groups = fields_.Model(Groups, required=False)
    fields = fields_.Dict(Field, key='name', tagname='Fields', required=False)
Beispiel #2
0
class Properties(MaltegoElement):

    fields = fields_.Dict(TransformProperty, key='name', tagname='Fields')

    def __iadd__(self, other):
        if isinstance(other, TransformProperty):
            self.fields[other.name] = other
        return self
Beispiel #3
0
class _Entity(MaltegoElement):
    class meta:
        tagname = 'Entity'

    type = fields_.String(attrname='Type')
    fields = fields_.Dict(Field, key='name', tagname='AdditionalFields', required=False)
    labels = fields_.Dict(Label, key='name', tagname='DisplayInformation', required=False)
    value = fields_.String(tagname='Value')
    weight = fields_.Integer(tagname='Weight', default=1)
    icon_url = fields_.String(tagname='IconURL', required=False)

    def __iadd__(self, other):
        if isinstance(other, Field):
            self.fields[other.name] = other
        elif isinstance(other, Label):
            self.labels[other.name] = other
        return self
Beispiel #4
0
class attributes(MaltegoElement):

    version = fields_.String(default='1.0')
    fileobjects = fields_.Dict(fileobject, key='name')

    def __iadd__(self, other):
        if isinstance(other, fileobject):
            self.fileobjects[other.name] = other
        return self
Beispiel #5
0
class fileobject(MaltegoElement):

    name = fields_.String()
    attrs = fields_.Dict(attr, key='name')

    def __iadd__(self, other):
        if isinstance(other, attr):
            self.attrs[other.name] = other
        return self
Beispiel #6
0
class MaltegoTransformRequestMessage(MaltegoElement):

    __entities = fields_.List(_Entity, tagname='Entities', required=False)
    _entities = None  # This is so we can cache the transform entity object list.
    _parameters = fields_.Dict(Field,
                               tagname='TransformFields',
                               key='name',
                               required=False)
    limits = fields_.Model(Limits, required=False)

    def __iadd__(self, other):
        if isinstance(other, Entity):
            self.__entities.append(other.__entity__)
        elif isinstance(other, _Entity):
            self.__entities.append(other)
        elif isinstance(other, Field):
            self._parameters[other.name] = other
        elif isinstance(other, Limits):
            self.limits = other
        return self

    @property
    def entity(self):
        """Returns the first Entity object in the transform request.

        :return: first Entity object."""
        if self.entities:
            return self.entities[0]
        return Entity('')

    @property
    def entities(self):
        if not self._entities:
            self._entities = [
                EntityTypeFactory.create(e.type)(e) for e in self.__entities
            ]
        return self._entities

    @property
    def parameters(self):
        """Returns a list of passed transform parameters in the event that a transform has additional parameters that
        are required in order to operate (i.e. API key). For local transforms, the program arguments are returned
        instead.

        :return: list of parameters."""
        if 'canari.local.arguments' in self._parameters:
            return self._parameters['canari.local.arguments'].value
        return self._parameters
Beispiel #7
0
class Converter(MaltegoElement):

    value = fields_.CDATA(default='', tagname='Value', required=False)
    regexgroups = fields_.Dict(RegexGroup, key='property', required=False)