From b11ad18d2bf8bb485ff8c92a4298607005099a51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Vinot?= Date: Mon, 16 Jul 2018 13:40:51 +0200 Subject: [PATCH] chg: Add comments Fix #242 --- pymisp/tools/genericgenerator.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/pymisp/tools/genericgenerator.py b/pymisp/tools/genericgenerator.py index 06c688e..cb339a2 100644 --- a/pymisp/tools/genericgenerator.py +++ b/pymisp/tools/genericgenerator.py @@ -7,6 +7,21 @@ from .abstractgenerator import AbstractMISPObjectGenerator class GenericObjectGenerator(AbstractMISPObjectGenerator): def generate_attributes(self, attributes): + """Generates MISPObjectAttributes from a list of dictionaries. + Each entry if the list must be in one of the two following formats: + * {: } + * {: {'value'=, 'type'=, ]} + + Note: Any missing parameter will default to the pre-defined value from the Object template. + If the object template isn't known by PyMISP, you *must* pass a type key/value, or it will fail. + + Example: + [{'analysis_submitted_at': '2018-06-15T06:40:27'}, + {'threat_score': {value=95, to_ids=False}}, + {'permalink': 'https://panacea.threatgrid.com/mask/samples/2e445ef5389d8b'}, + {'heuristic_raw_score': 7.8385159793597}, {'heuristic_score': 96}, + {'original_filename': 'juice.exe'}, {'id': '2e445ef5389d8b'}] + """ for attribute in attributes: for object_relation, value in attribute.items(): if isinstance(value, dict):