From 9d603344c2cb0c0560995252f8a9d3bdd50c51f4 Mon Sep 17 00:00:00 2001 From: Sebdraven Date: Tue, 17 Jul 2018 18:32:50 +0200 Subject: [PATCH] add searching_stats --- .../modules/expansion/securitytrails.py | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/misp_modules/modules/expansion/securitytrails.py b/misp_modules/modules/expansion/securitytrails.py index b2790fa..5294a62 100644 --- a/misp_modules/modules/expansion/securitytrails.py +++ b/misp_modules/modules/expansion/securitytrails.py @@ -543,6 +543,31 @@ def expand_searching_domain(api, ip): return r, status_ok + +def expand_search_stats(api, ip, misperror): + r = [] + status_ok = False + + try: + result = api.searching_stats(ipv4=ip) + if result and 'top_organizations' in result: + comment = '' + for reg in result['top_organizations']: + comment += 'Organization %s used %s count: %s' % (reg['key'], + ip, + reg['count']) + r.append({'types': ['comment'], + 'categories': ['Other'], + 'values': comment, + }) + status_ok = True + except APIError as e: + misperrors['error'] = e + return [], False + + return r, status_ok + + def introspection(): return mispattributes