Python TRX Library Reference (iTDS)

Modified on: Wed, 27 Sep, 2023 at 9:22 PM

Warning: Python TRX Local Library Reference (iTDS) is no longer supported. We recommend using the Python Maltego-TRX.


Input Entity Object

This object is used to read the Maltego request. It is passed along to each Transform and is assigned to the variable "m". The attributes below provide details about the input Entity.


Member NameDescription
m.Value (String)The value of the node as displayed on the graph. Note that this is not necessarily the value you want work with (see URL entity).
m.Weight (Integer)The weight of the node.
m.Slider (Integer)The slider's value – e.g. how many results should be returned.
m.Type (String)The type of the input node. See Entity definitions for possible values.
m.Properties (List)A list of properties of the node. Name, value pairs as strings
m.TransformSettings(List)The settings for the Transform. A list of name, value pairs as strings.

 

Available Methods

The following methods are defined to read Entity properties and Transform settings. You can read it straight out of the Property and Transform Settings list, but it's nicer to use these functions as they do some error checking:


Member NameDescriptionReturns
m.getProperty
(String property name)
Returns the value of the key, None if not definedValue
m.getTransformSetting
(String transform setting name)
Returns the value of the key, None if not definedValue


Transform Object

This is used to construct the reply to the iTDS. All values are strings.


TRX = MaltegoTransform()


Available Methods

Method NameDescriptionReturns
TRX.addEntity
([String Type,
String Value])
Adds an entity to the return vessel with type 'Type' and value 'Value'. Note that these can be set using functions in MaltegoEntity library.MaltegoEntity
TRX.addUIMessage
(String msg,
Const type)
Shows a message 'msg' in the Maltego GUI. Types could be
  • UIM_FATAL (pop up window)
  • UIM_PARTIAL (yellow)
  • UIM_INFORM (default)
  • UIM_DEBUG (light gray)
None
TRX.addException
(String msg)
Throws a Transform exceptionNone
TRX.returnOutput()Returns the XML of the vesselNone


Entity Object

This is the object that defines a single Entity within Maltego. An Entity can be created using the 'addEntity' method in the MaltegoTransform class.


me = TRX.addEntity(type, value)
Method NameDescription
me.setType
(String Type)
Sets the type of the entity – see list of Entity definitions for possible values
me.setValue
(String Value)
Sets the value of the entity
me.setWeight
(Integer weight)
Sets the weight of the entity
me.addDisplayInformation
(String Value,
[String Label])
Adds display information for label named 'Label'. This field is rendered as HTML within Maltego. Default label is 'Info'.
me.addProperty
(String propertyname,
String displayname,
String matchingrule,
String value)
Adds a property to the entity. Each property has a name, value and a display name. The display name is how it will be represented within Maltego. The matching rule determines how entities will be matched and could be 'strict' (default) or 'loose'
me.setIconURL
(String URL)
If set it will change the appearance of the icon. The URL should point to a PNG or JPG file. Maltego will size to fit but lots of large files will drain resources.
me.setLinkColor
(String HexColor)
Sets the color of the link to the node. Colors are in hex –for example '0xff00ff'
me.setLinkStyle
(Const Style)
Sets the style of the link to the node. The following constants should be used:
  • LINK_STYLE_NORMAL
  • LINK_STYLE_DASHED
  • LINK_STYLE_DOTTED
  • LINK_STYLE_DASHDOT
me.setLinkThickness
(Integer thickness)
Sets the thickness of the link to the node. Value is in pixels.
me.setLinkLabel
(String value)
Sets the label of the link to the node.
me.setBookmark
(Const Color)
Sets the bookmark color of the node. Keep in mind that these are chosen from a set number of colors. Use the following constants:
  • BOOKMARK_COLOR_NONE
  • BOOKMARK_COLOR_BLUE
  • BOOKMARK_COLOR_GREEN
  • BOOKMARK_COLOR_YELLOW
  • BOOKMARK_COLOR_ORANGE
  • BOOKMARK_COLOR_RED
me.setNote
(String note)
Creates an annotation to the node with value 'note'. If a subsequent Transform sets an annotation on the node it will appended to the note.

 

Reversing Entity Links 

To reverse an Entity link - add a property to the returning Entit(y/ies) as follows:
link#maltego.link.direction = <direction>

Possible values for direction are:

  • input-to-output            (default)
  • output-to-input
  • bidirectional


Example


me.addProperty('link#maltego.link.direction','link#maltego.link.direction','loose','output-to-input')


Did you find it helpful? Yes No

Send feedback
Sorry we couldn't be helpful. Help us improve this article with your feedback.