Exemple #1
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)
    iconurl = fields_.String(tagname='IconURL', required=False)

    def appendelement(self, other):
        if isinstance(other, Field):
            self.fields.append(other)
        elif isinstance(other, Label):
            self.labels.append(other)

    def removeelement(self, other):
        if isinstance(other, Field):
            self.fields.remove(other)
        elif isinstance(other, Label):
            self.labels.remove(other)
Exemple #2
0
class MaltegoTransformRequestMessage(MaltegoElement):
    entities = fields_.List(_Entity, tagname='Entities', required=False)
    parameters = fields_.Dict(Field,
                              tagname='TransformFields',
                              key='name',
                              required=False)
    limits = fields_.Model(Limits, required=False)

    def __init__(self, **kwargs):
        super(MaltegoTransformRequestMessage, self).__init__(**kwargs)
        self._canari_fields = dict([(f.name, f.value)
                                    for f in self.entity.fields.values()])

    @property
    def entity(self):
        if self.entities:
            return MetaEntityClass.to_entity_type(self.entities[0].type)(
                self.entities[0])
        return Entity('')

    @property
    def params(self):
        if 'canari.local.arguments' in self.parameters:
            return self.parameters['canari.local.arguments'].value
        return self.parameters

    @property
    def value(self):
        return self.entity.value

    @property
    def fields(self):
        return self._canari_fields
Exemple #3
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)
Exemple #4
0
class Properties(MaltegoElement):

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

    def appendelement(self, other):
        if isinstance(other, TransformProperty):
            self.fields[other.name] = other

    def removeelement(self, other):
        if isinstance(other, TransformProperty):
            del self.fields[other.name]
Exemple #5
0
class attributes(MaltegoElement):

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

    def appendelement(self, other):
        if isinstance(other, fileobject):
            self.fileobjects[other.name] = other

    def removeelement(self, other):
        if isinstance(other, fileobject):
            del self.fileobjects[other.name]
Exemple #6
0
class fileobject(MaltegoElement):

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

    def appendelement(self, other):
        if isinstance(other, attr):
            self.attrs[other.name] = other

    def removeelement(self, other):
        if isinstance(other, attr):
            del self.attrs[other.name]
Exemple #7
0
class Converter(MaltegoElement):

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