chg: [pymisp] better follow new PyMISP convention

pull/40/head
Christophe Vandeplas 2019-10-25 06:56:01 +02:00
parent 83fdde0580
commit 1718217385
3 changed files with 7 additions and 7 deletions

View File

@ -32,7 +32,7 @@ class AttributeInMISP(Transform):
pass
misp = get_misp_connection(config)
events_json = misp.search(controller='events', value=maltego_misp_attribute.value, withAttachments=False)
events_json = misp.search(controller='events', value=maltego_misp_attribute.value, with_attachments=False)
# we need to do really rebuild the Entity from scratch as request.entity is of type Unknown
for e in events_json:
attr = get_attribute_in_event(e, maltego_misp_attribute.value)
@ -59,7 +59,7 @@ class AttributeInMISP(Transform):
# cidrs = ipaddress.summarize_address_range(ipaddress.IPv4Address(ip_start), ipaddress.IPv4Address(ip_end))
# for cidr in cidrs:
# print(str(cidr))
# attr_json = misp.search(controller='attributes', values=str(cidr), withAttachments=False)
# attr_json = misp.search(controller='attributes', value=str(cidr), with_attachments=False)
# print(attr_json)
# return response
@ -87,14 +87,14 @@ class AttributeToEvent(Transform):
tag_name = get_entity_property(request.entity, 'tag_name')
if not tag_name:
tag_name = request.entity.value
events_json = misp.search(controller='events', tags=tag_name, withAttachments=False)
events_json = misp.search(controller='events', tags=tag_name, with_attachments=False)
for e in events_json:
response += event_to_entity(e, link_direction=LinkDirection.OutputToInput)
return response
# from Object
elif 'properties.mispobject' in request.entity.fields:
if request.entity.fields.get('event_id'):
events_json = misp.search(controller='events', eventid=request.entity.fields.get('event_id').value, withAttachments=False)
events_json = misp.search(controller='events', eventid=request.entity.fields.get('event_id').value, with_attachments=False)
for e in events_json:
response += event_to_entity(e, link_direction=LinkDirection.OutputToInput)
return response
@ -102,7 +102,7 @@ class AttributeToEvent(Transform):
return response
# standard Entities (normal attributes)
else:
events_json = misp.search(controller='events', value=request.entity.value, withAttachments=False)
events_json = misp.search(controller='events', value=request.entity.value, with_attachments=False)
# return the MISPEvent or MISPObject of the attribute
for e in events_json:

View File

@ -39,7 +39,7 @@ class EventToTransform(Transform):
maltego_misp_event = request.entity
self.misp = get_misp_connection(config)
event_id = maltego_misp_event.id
search_result = self.misp.search(controller='events', eventid=event_id, withAttachments=False)
search_result = self.misp.search(controller='events', eventid=event_id, with_attachments=False)
if search_result:
self.event_json = search_result.pop()
else:

View File

@ -41,7 +41,7 @@ class GalaxyToEvents(Transform):
tag_name = maltego_misp_galaxy.tag_name
else:
tag_name = maltego_misp_galaxy.value
events_json = misp.search(controller='events', tags=tag_name, withAttachments=False)
events_json = misp.search(controller='events', tags=tag_name, with_attachments=False)
for e in events_json:
response += MISPEvent(e['Event']['id'], uuid=e['Event']['uuid'], info=e['Event']['info'], link_direction=LinkDirection.OutputToInput)
return response