From e7684bedf42bc56e818bc15033f5ba5c1cf91ba9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Vinot?= Date: Tue, 24 Apr 2018 09:45:36 +0200 Subject: [PATCH] chg: Add more examples --- docs/tutorial/PyMISP_tutorial.ipynb | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/docs/tutorial/PyMISP_tutorial.ipynb b/docs/tutorial/PyMISP_tutorial.ipynb index c426c3a..3cd1cf3 100644 --- a/docs/tutorial/PyMISP_tutorial.ipynb +++ b/docs/tutorial/PyMISP_tutorial.ipynb @@ -214,6 +214,7 @@ "\n", "## Add the attribute to the event\n", "event.add_attribute(**attribute)\n", + "event.add_attribute(type='domain', value='circl.lu', disable_correlation=True)\n", "\n", "## Push the updated event to MISP\n", "event_dict = misp.update(event)\n", @@ -310,29 +311,21 @@ " 'subject': 'An email',\n", "}\n", "\n", - "# Retreive the template ID from the object's name\n", - "## Fetch all templates\n", - "templates = misp.get_object_templates_list()\n", - "## Get the template matching with the object's name\n", - "template_id = None\n", - "for template in templates:\n", - " cur_name = template['ObjectTemplate']['name']\n", - " cur_id = template['ObjectTemplate']['id']\n", - " if cur_name == object_name:\n", - " template_id = cur_id\n", - " break \n", - "if template_id is None:\n", - " raise Exception('No matching template')\n", - "\n", "# Create the MISP Object\n", "misp_obj = MISPObject(object_name)\n", "for obj_relation, value in object_data.items():\n", - " misp_obj.add_attribute(obj_relation, **{'value': value})\n", + " if obj_relation == 'subject':\n", + " misp_obj.add_attribute(obj_relation, value=value, comment='My fancy subject', disable_correlation=True)\n", + " else: \n", + " misp_obj.add_attribute(obj_relation, value=value)\n", + "\n", + "template_id = misp.get_object_template_id(misp_obj.template_uuid)\n", "\n", "# Add the object to MISP\n", "response = misp.add_object(event_id,\n", " template_id,\n", " misp_obj)\n", + "print('Event ID', event_id)\n", "print(response)" ] }