(self, threat_actors)
Parse list of Threat Actors.

        :param threat_actors: List of STIX ThreatActors.
        :type threat_actors: List of STIX ThreatActors.
Parse list of Threat Actors.
Parse list of Threat Actors .
def parse_threat_actors(self, threat_actors):
        """
        Parse list of Threat Actors.

        :param threat_actors: List of STIX ThreatActors.
        :type threat_actors: List of STIX ThreatActors.
        """
        analyst = self.source_instance.analyst
        for threat_actor in threat_actors: # for each STIX ThreatActor
            try: # create CRITs Actor from ThreatActor
                if isinstance(threat_actor, ThreatActor):
                    name = str(threat_actor.title)
                    if not self.preview:
                        description = threat_actor.description
                        res = add_new_actor(name=name,
                                            description=description,
                                            source=[self.source],
                                            analyst=analyst)
                        self.parsed.append(threat_actor.id_)
                        if res['success']:
                            sl = ml = tl = il = []
                            for s in threat_actor.sophistications:
                                v = get_crits_actor_tags(str(s.value))
                                if v:
                                    sl.append(v)
                            update_actor_tags(res['id'],
                                                'ActorSophistication',
                                                sl,
                                                analyst)
                            for m in threat_actor.motivations:
                                v = get_crits_actor_tags(str(m.value))
                                if v:
                                    ml.append(v)
                            update_actor_tags(res['id'],
                                                'ActorMotivation',
                                                ml,
                                                analyst)
                            for t in threat_actor.types:
                                v = get_crits_actor_tags(str(t.value))
                                if v:
                                    tl.append(v)
                            update_actor_tags(res['id'],
                                                'ActorThreatType',
                                                tl,
                                                analyst)
                            for i in threat_actor.intended_effects:
                                v = get_crits_actor_tags(str(i.value))
                                if v:
                                    il.append(v)
                            update_actor_tags(res['id'],
                                                'ActorIntendedEffect',
                                                il,
                                                analyst)
                            obj = Actor.objects(id=res['id']).first()
                            self.updates[obj.id] = obj
                            self.imported[threat_actor.id_] = (Actor._meta['crits_type'],
                                                               obj.id, name or obj.id)
                        else: #failed
                            self.failed.append((res['message'],
                                                "Threat Actor (%s)" % name,
                                                threat_actor.id_)) # note for display in UI

                    else: #preview_only
                        self.imported[threat_actor.id_] = (Actor._meta['crits_type'],
                                                           None, name)
            except Exception, e:
                self.failed.append((e.message,
                                    "Threat Actor (%s)" % name,
                                    threat_actor.id_))
def parse_threat_actors ( self , threat_actors ) : analyst = self . source_instance . analyst for threat_actor in threat_actors : # for each STIX ThreatActor try : # create CRITs Actor from ThreatActor if isinstance ( threat_actor , ThreatActor ) : name = str ( threat_actor . title ) if not self . preview : description = threat_actor . description res = add_new_actor ( name = name , description = description , source = [ self . source ] , analyst = analyst ) self . parsed . append ( threat_actor . id_ ) if res [ 'success' ] : sl = ml = tl = il = [ ] for s in threat_actor . sophistications : v = get_crits_actor_tags ( str ( s . value ) ) if v : sl . append ( v ) update_actor_tags ( res [ 'id' ] , 'ActorSophistication' , sl , analyst ) for m in threat_actor . motivations : v = get_crits_actor_tags ( str ( m . value ) ) if v : ml . append ( v ) update_actor_tags ( res [ 'id' ] , 'ActorMotivation' , ml , analyst ) for t in threat_actor . types : v = get_crits_actor_tags ( str ( t . value ) ) if v : tl . append ( v ) update_actor_tags ( res [ 'id' ] , 'ActorThreatType' , tl , analyst ) for i in threat_actor . intended_effects : v = get_crits_actor_tags ( str ( i . value ) ) if v : il . append ( v ) update_actor_tags ( res [ 'id' ] , 'ActorIntendedEffect' , il , analyst ) obj = Actor . objects ( id = res [ 'id' ] ) . first ( ) self . updates [ obj . id ] = obj self . imported [ threat_actor . id_ ] = ( Actor . _meta [ 'crits_type' ] , obj . id , name or obj . id ) else : #failed self . failed . append ( ( res [ 'message' ] , "Threat Actor (%s)" % name , threat_actor . id_ ) ) # note for display in UI else : #preview_only self . imported [ threat_actor . id_ ] = ( Actor . _meta [ 'crits_type' ] , None , name ) except Exception , e : self . failed . append ( ( e . message , "Threat Actor (%s)" % name , threat_actor . id_ ) )