From 1d100833a4cade1d942e91c9f176ef0aea6aded7 Mon Sep 17 00:00:00 2001 From: Sebdraven Date: Tue, 10 Jul 2018 15:12:27 +0200 Subject: [PATCH] concat results --- misp_modules/modules/expansion/dnstrails.py | 29 +++++++++++---------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/misp_modules/modules/expansion/dnstrails.py b/misp_modules/modules/expansion/dnstrails.py index 5a0cfcc..6f52dff 100644 --- a/misp_modules/modules/expansion/dnstrails.py +++ b/misp_modules/modules/expansion/dnstrails.py @@ -222,27 +222,28 @@ def expand_whois(api, domain): if results: status_ok = True item_registrant = __select_registrant_item(results) - - r.append({ - 'types': ['whois-registrant-email', 'whois-registrant-phone', + types = ['whois-registrant-email', 'whois-registrant-phone', 'whois-registrant-name', 'whois-registrar', - 'whois-creation-date'], - 'values': [item_registrant['email'], - item_registrant['telephone'], - item_registrant['name'], results['registrarName'], - results['createdDate']], - 'categories': ['attribution'], - 'comment': 'whois information of %s by securitytrails' % domain - } + 'whois-creation-date'] + values = [item_registrant['email'], + item_registrant['telephone'], + item_registrant['name'], results['registrarName'], + results['createdDate']] + for t, v in zip(types, values): + r.append({ + 'types': t, + 'values': v, + 'categories': ['attribution'], + 'comment': 'whois information of %s by securitytrails' % domain + } - ) + ) # TODO File "modules/expansion/dnstrails.py", line 230, in expand_whois # 'values': [item_registrant['email'], # TypeError: 'NoneType' object is not subscriptable except APIError as e: misperrors['error'] = e - print(e) return r, status_ok @@ -258,6 +259,6 @@ def version(): def __select_registrant_item(entry): if 'contacts' in entry: for c in entry['contacts']: - print(c) + if c['type'] == 'registrant': return c