new: [entities] show attribute and object count in Event entity metadata

pull/40/head
Christophe Vandeplas 2020-04-05 15:57:43 +02:00
parent ddb0ccab3c
commit 46ad6abdba
2 changed files with 4 additions and 0 deletions

View File

@ -32,6 +32,8 @@ class MISPEvent(Entity):
# threat_level = EnumEntityField('type.enum', choices=['Undefined', 'Low', 'Medium', 'High'], display_name='Threat Level')
# analysis = EnumEntityField('type.enum', choices=['Initial', 'Ongoing', 'Completed'])
# org = StringEntityField('type.str', display_name='Organisation')
count_attributes = IntegerEntityField('count_attributes', display_name="# attributes", matching_rule=MatchingRule.Loose)
count_objects = IntegerEntityField('count_objects', display_name="# objects", matching_rule=MatchingRule.Loose)
class MISPObject(Entity):

View File

@ -341,6 +341,8 @@ def event_to_entity(e, link_style=LinkStyle.Normal, link_direction=LinkDirection
info=e['Event']['info'],
link_style=link_style,
link_direction=link_direction,
count_attributes=len(e['Event'].get('Attribute')),
count_objects=len(e['Event'].get('Object')),
notes=notes,
bookmark=Bookmark.Green)