MaltegoTech / maltego-trx

Maltego Transform library for Python
MIT License
218 stars 45 forks source link

How to Link Entities #44

Closed magicniko closed 1 year ago

magicniko commented 2 years ago

Let's say I have the following data structure after looking up some info about some_input

[
  {
    "id": 123,
    "collection": "foobar"
  },
  {
    "id": 456,
    "collection": "foobar"
  },
  {
    "id": 789,
    "collection": "something_else"
  }
]

And I want to generate a graph that looks like this:

             ┌────────────────────┐
             │                    │
             │                    │
             │                    │
             │      some_input    │
             │                    │
             │                    │
             │                    ├─────────────┐
      ┌──────┴─────────┬──────────┘             │
      │                │                        │
      │                │                        │
      │                │                        │
┌─────▼────┐       ┌───▼───────┐                │
│          │       │           │        ┌───────▼─────┐
│          │       │           │        │             │
│ 123      │       │   456     │        │             │
│          │       │           │        │    789      │
└────┬─────┘       └────┬──────┘        │             │
     │                  │               └───┬─────────┘
     │                  │                   │
     │                  │                   │
     │                  │                   │
     │ ┌─────────┐      │                   │
     │ │         ◄──────┘      ┌────────────▼───┐
     └─► foobar  │             │                │
       │         │             │                │
       └─────────┘             │  something_else│
                               │                │
                               │                │
                               └────────────────┘

How do I add outgoing connections from the ids to the collection using this library?

felixatmaltego commented 2 years ago

Hi @magicniko, as of right now, we can only return one level of entities. What I would recommend, is to return the collections as entities and set the id as their link label (entity.setLinkLabel(<id>)).

Hope this helps! felixatmaltego

felixatmaltego commented 1 year ago

Closing for inactivity

Paradigm00 commented 9 months ago

Ok but how? show us some examples

if i do something like this

trx = MaltegoTransform()
ent1 = trx.addEntity(IPv4Address, '127.0.0.1')
ent2 = trx.addEntity(Port, '8080')

How do I connect with a link to those entities?

you proposed ent2.setLinkLabel(<id>) but what is the ent1 id? thanks