Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception thrown when Properties not defined (maltego.py) #22

Closed
MaltegoThinus opened this issue Jul 20, 2021 · 4 comments
Closed

Exception thrown when Properties not defined (maltego.py) #22

MaltegoThinus opened this issue Jul 20, 2021 · 4 comments

Comments

@MaltegoThinus
Copy link
Collaborator

If an Entity does not have Properties, calling the "getProperty" method causes an exception, since "Properties" is not defined.

This is in "maltego.py":

def getProperty(self, key):
    return self.Properties.get(key)

I suggest initializing an Empty "Properties" variable.

@phdowling
Copy link
Contributor

Hi @MaltegoThinus, could you add some steps for reproducing this issue? Are you running on the latest version?

In server mode, Properties already gets initialized in the way you are proposing:
https://github.com/paterva/maltego-trx/blob/master/maltego_trx/maltego.py#L259
In local transform mode, there is a code-path during which this does not happen, but it seems like an unlikely/impossible path if I am not mistaken:
https://github.com/paterva/maltego-trx/blob/master/maltego_trx/maltego.py#L287
In any case it is probably worth fixing the problem in the local transform case - I could see how an entity with no defined properties at all could trigger this bug in a local setting.

@MaltegoThinus
Copy link
Collaborator Author

Hi @phdowling, yes: it's a local Transform only thing. If there are no additional arguments, then this error occurs because the "if len(LocalArgs) > 1" loop (line 287 in "maltego.py") is never executed, and the TransformSettings in line 297 is never initialized.

I think this is only possible when testing the Transform from the cmdline, since I don't duplicate properties when specifying the main value only. I think (not sure) that when the Local Transform is run from Maltego, it will add the "value" argument as well as a property for the main property.

To reproduce this, you can add a line to the GreetPerson example: "request.getProperty("randomstuffhere")", and then run the Transfrom from the terminal "python project.py local greetperson Thinus".

I test Transforms this way all the time, before wiring them into Maltego. Not sure if it's a common workflow.

@felixatmaltego
Copy link
Collaborator

Fixed in PR #27

@crest42
Copy link
Collaborator

crest42 commented Feb 3, 2022

Close with reference to #27

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants