def convert_tool(tool20): tool1x = ToolInformation() if "name" in tool20: tool1x.title = tool20["name"] if "description" in tool20: tool1x.description = tool20["description"] if "tool_version" in tool20: tool1x.version = tool20["tool_version"] if "labels" in tool20: warn( "labels not representable in a STIX 1.x ToolInformation. Found in %s", 502, tool20["id"]) # bug in python_stix prevents using next line of code # tool1x.type_ = convert_open_vocabs_to_controlled_vocabs(tool20["labels"], TOOL_LABELS_MAP) ttp = TTP(id_=convert_id20(tool20["id"]), timestamp=text_type(tool20["modified"])) ttp.resource = Resource(tools=Tools([tool1x])) if "kill_chain_phases" in tool20: process_kill_chain_phases(tool20["kill_chain_phases"], ttp) if "object_marking_refs" in tool20: for m_id in tool20["object_marking_refs"]: ms = create_marking_specification(m_id) if ms: CONTAINER.add_marking(ttp, ms, descendants=True) if "granular_markings" in tool20: error( "Granular Markings present in '%s' are not supported by stix2slider", 604, tool20["id"]) record_id_object_mapping(tool20["id"], ttp) return ttp