From fd3c62c460dc52c18881a983a13b73f56774a063 Mon Sep 17 00:00:00 2001 From: Golbark Date: Wed, 8 Apr 2020 01:07:46 -0700 Subject: [PATCH] Fix variable issue in the loop --- misp_modules/modules/expansion/censys_enrich.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/misp_modules/modules/expansion/censys_enrich.py b/misp_modules/modules/expansion/censys_enrich.py index b1b89b8..0fc61ae 100644 --- a/misp_modules/modules/expansion/censys_enrich.py +++ b/misp_modules/modules/expansion/censys_enrich.py @@ -193,13 +193,15 @@ def check_if_present(object, attribute_name, list_objects): using attribute_name for the matching """ for o in list_objects: + # We first look for a match on the name if o['name'] == object['name']: for attr in object['Attribute']: + # Within the attributes, we look for the one to compare if attr['type'] == attribute_name: - value = attr['value'] - for attr2 in o['Attribute']: - if attr['type'] == attribute_name and attr['value'] == value: - return True + # Then we check the attributes of the other object and look for a match + for attr2 in o['Attribute']: + if attr2['type'] == attribute_name and attr2['value'] == attr['value']: + return True return False