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

fix(local): Initialize Properties and TransformSettings regardless of arguments #27

Merged
merged 3 commits into from
Jan 26, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions maltego_trx/maltego.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,9 @@ def _get_int(element, tag_name, attr_name=None):
return 0

def __init__(self, MaltegoXML="", LocalArgs=[]):
self.TransformSettings = {}
self.Properties = {}

if MaltegoXML:
maltego_msg = minidom.parseString(MaltegoXML)
entities = maltego_msg.getElementsByTagName("Entity")
Expand All @@ -256,7 +259,6 @@ def __init__(self, MaltegoXML="", LocalArgs=[]):
self.Genealogy.append(entity_type)

# Additional Fields
self.Properties = {}
additional_fields_tag = entity.getElementsByTagName("AdditionalFields")
additional_fields = additional_fields_tag[0].getElementsByTagName("Field") if additional_fields_tag else []
for field in additional_fields:
Expand All @@ -269,13 +271,13 @@ def __init__(self, MaltegoXML="", LocalArgs=[]):
self.Properties[v3_property_name] = value

# Transform Settings
self.TransformSettings = {}
settings_tag = maltego_msg.getElementsByTagName("TransformFields")
settings = settings_tag[0].getElementsByTagName("Field") if settings_tag else []
for setting in settings:
name = setting.getAttribute("Name")
value = self._get_text(setting)
self.TransformSettings[name] = value

elif LocalArgs:
self.Value = LocalArgs[0]
self.Type = "local.Unknown"
Expand All @@ -294,7 +296,6 @@ def __init__(self, MaltegoXML="", LocalArgs=[]):
.replace("\\=", equals_rnd)

self.buildProperties(text.split("#"), hash_rnd, equals_rnd, bslash_rnd)
self.TransformSettings = {}

def clearLegacyProperties(self):
to_clear = set()
Expand Down