def add_internal_actor_item(internal_item, pkg): ta = ThreatActor() motive_item = internal_item.get('motive') if not motive_item: error("Required 'motive' item is missing in 'actor/internal' item") else: for item in motive_item: motivation = Statement() motivation.value = map_motive_item_to_motivation(item) ta.add_motivation(motivation) # job_change added in 1.3 variety_item = internal_item.get('variety') if not variety_item: error("Required 'variety' item is missing in 'actor/internal' item") else: for v in variety_item: ta_type = Statement() ta_type.value = ThreatActorType(ThreatActorType.TERM_INSIDER_THREAT) ta_type.description = v ta.add_type(ta_type) notes_item = internal_item.get('notes') if notes_item: ta.description = "Notes: " + escape(notes_item) pkg.add_threat_actor(ta)