add a tranform to have just tags and galaxy on a Event

pull/12/head
Sebdraven 2019-03-11 16:46:39 +01:00
parent 4bafc049a4
commit 9d57313bb3
2 changed files with 30 additions and 0 deletions

View File

@ -25,6 +25,7 @@ class AttributeToEvent(Transform):
misp = get_misp_connection(config)
# misp.
events_json = misp.search(controller='events', values=maltego_misp_attribute.value, withAttachments=False)
for e in events_json['response']:
response += event_to_entity(e)
return response

View File

@ -17,7 +17,35 @@ __maintainer__ = 'Christophe Vandeplas'
__email__ = 'christophe@vandeplas.com'
__status__ = 'Development'
# @EnableDebugWindow
class EventToTags(Transform):
""""Expands an object to its attributes"""
input_type = MISPEvent
description = 'Expands an Event with tags'
def do_transform(self, request, response, config):
maltego_misp_event = request.entity
misp = get_misp_connection(config)
event_json = misp.get_event(maltego_misp_event.id)
event_tags = []
if 'Tag' in event_json['Event']:
for t in event_json['Event']['Tag']:
event_tags.append(t['name'])
# ignore all misp-galaxies
if t['name'].startswith('misp-galaxy'):
continue
response += Hashtag(t['name'])
for g in event_json['Event']['Galaxy']:
for c in g['GalaxyCluster']:
response += galaxycluster_to_entity(c)
return response
def on_terminate(self):
"""This method gets called when transform execution is prematurely terminated. It is only applicable for local
transforms. It can be excluded if you don't need it."""
pass
# @EnableDebugWindow
class EventToAttributes(Transform):
"""Expands an event to attributes, objects, tags and galaxies."""
@ -81,3 +109,4 @@ class ObjectToAttributes(Transform):
response += entity
return response