From 7c42950e9b45015803201bad88cb66be4b311858 Mon Sep 17 00:00:00 2001 From: Usama015 Date: Mon, 19 Jun 2023 16:11:58 +0500 Subject: [PATCH] updated --- misp_modules/modules/expansion/ipgeolocation.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/misp_modules/modules/expansion/ipgeolocation.py b/misp_modules/modules/expansion/ipgeolocation.py index 131f7d4..ed5aabc 100644 --- a/misp_modules/modules/expansion/ipgeolocation.py +++ b/misp_modules/modules/expansion/ipgeolocation.py @@ -47,7 +47,7 @@ def handle_ip(apiKey, ip, misperrors): results = query_ipgeolocation(apiKey, ip) except Exception: misperrors['error'] = "Error while Querying IP Address" - return [], False + return [] # Check if the IP address is not reserved for special use @@ -65,9 +65,11 @@ def handle_ip(apiKey, ip, misperrors): # Parse the geolocation information related to the IP address ipObject = MISPObject('ip-api-address') mapping = get_mapping() - for field, relation in mapping.items(): - ipObject.add_attribute(relation, results[field]) - + try: + for field, relation in mapping.items(): + ipObject.add_attribute(relation, results[field]) + except Exception: + return {'error': 'Error while Adding attributes'} misp_event.add_object(ipObject) # Return the results in MISP format