class MaltegoTransformResponseMessage(MaltegoElement): messages = fields_.List(UIMessage, tagname='UIMessages') entities = fields_.List(_Entity, tagname='Entities') def __iadd__(self, other): if isinstance(other, Entity): self.entities.append(other.__entity__) elif isinstance(other, _Entity): self.entities.append(other) elif isinstance(other, UIMessage): self.messages.append(other) return self
class TransformSet(MaltegoElement): name = fields_.String() description = fields_.String(default='') transforms = fields_.List(Transform, tagname='Transforms') def __iadd__(self, other): if isinstance(other, Transform): self.transforms.append(other) return self
class MaltegoTransform(MaltegoElement): """This is the complete MaltegoTransform element definition that is present in Maltego profiles. It defines every aspect of a transform including it's input entity type, transform set, template, etc.""" name = fields_.String() displayname = fields_.String(attrname='displayName', default='') abstract = fields_.String(default=False) template = fields_.Boolean(default=False) visibility = fields_.String(default=VisibilityType.Public) description = fields_.String(default='') helpurl = fields_.String(attrname='helpURL', default='') author = fields_.String(default='') owner = fields_.String(default='') locrel = fields_.String(attrname='locationRelevance', default='global') version = fields_.String(default='1.0') requireinfo = fields_.Boolean(default=False, attrname='requireDisplayInfo') adapter = fields_.String(tagname='TransformAdapter', default=TransformAdapter.Local) properties = fields_.Model(Properties) input = fields_.List(InputConstraint, tagname='InputConstraints', required=False) output = fields_.List(OutputEntity, tagname='OutputEntities', required=False) help = fields_.CDATA(tagname='Help', default='') disclaimer = fields_.CDATA(tagname='Disclaimer', default='') sets = fields_.List(Set, tagname='defaultSets') stealthlevel = fields_.Integer(tagname='StealthLevel', default=0) authenticator = fields_.String(tagname='Authenticator', required=False) def __iadd__(self, other): if isinstance(other, Set): self.sets.append(other) elif isinstance(other, TransformProperty): self.properties.fields_.append(other) elif isinstance(other, InputConstraint) or isinstance( other, InputEntity): self.input.append(other) elif isinstance(other, OutputEntity): self.output.append(other) return self
class MaltegoTransformExceptionMessage(MaltegoElement): """ MaltegoTransformExceptionMessage is the root container for the MaltegoException element. """ exceptions = fields_.List(MaltegoException, tagname='Exceptions') def __iadd__(self, exception): if isinstance(exception, MaltegoException): self.exceptions.append(exception) else: self.exceptions.append(MaltegoException(str(exception))) return self
class TransformSettings(MaltegoElement): enabled = fields_.Boolean(default=True) runwithall = fields_.Boolean(default=True) favorite = fields_.Boolean(default=False) accepted = fields_.Boolean(default=False, attrname='disclaimerAccepted') showhelp = fields_.Boolean(default=True, attrname='showHelp') properties = fields_.List(TransformPropertySetting, tagname='Properties') def __iadd__(self, other): if isinstance(other, TransformPropertySetting): self.properties.append(other) return self
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) or Unknown)(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 @property def settings(self): return {k: v.value for k, v in self._parameters.items()}
class MaltegoServer(MaltegoElement): name = fields_.String(default='Local') enabled = fields_.Boolean(default=True) description = fields_.String(default='Local transforms hosted on this machine') url = fields_.String(default='http://localhost') lastsync = fields_.String(tagname='LastSync', default=time.strftime('%Y-%m-%d')) protocol = fields_.Model(Protocol) authentication = fields_.Model(Authentication) transforms = fields_.List(Transform, tagname='Transforms') def __iadd__(self, other): if isinstance(other, Transform): self.transforms.append(other) return self