Esempio n. 1
0
def add_actor_content(drop=False):
    """
    Add Actor content to the system. This is content based off of STIX and does
    not include Actor Identifiers which are not based on STIX.

    :param drop: Drop the collection before adding.
    :type drop: boolean
    """

    if not drop:
        print "Drop protection does not apply to actor content."

    ActorThreatType.drop_collection()
    ActorMotivation.drop_collection()
    ActorSophistication.drop_collection()
    ActorIntendedEffect.drop_collection()

    count = 0
    for t in vocabs.ThreatActorType._ALLOWED_VALUES:
        x = ActorThreatType(name=t)
        x.save()
        count += 1
    print "Added %s Threat Actor Types." % count
    count = 0
    for t in vocabs.Motivation._ALLOWED_VALUES:
        x = ActorMotivation(name=t)
        x.save()
        count += 1
    print "Added %s Actor Motivations." % count
    count = 0
    for t in vocabs.ThreatActorSophistication._ALLOWED_VALUES:
        x = ActorSophistication(name=t)
        x.save()
        count += 1
    print "Added %s Actor Sophistications." % count
    count = 0
    for t in vocabs.IntendedEffect._ALLOWED_VALUES:
        x = ActorIntendedEffect(name=t)
        x.save()
        count += 1
    print "Added %s Actor Intended Effects." % count
Esempio n. 2
0
def add_actor_content(drop=False):
    """
    Add Actor content to the system. This is content based off of STIX and does
    not include Actor Identifiers which are not based on STIX.

    :param drop: Drop the collection before adding.
    :type drop: boolean
    """

    if not drop:
        print "Drop protection does not apply to actor content."

    ActorThreatType.drop_collection()
    ActorMotivation.drop_collection()
    ActorSophistication.drop_collection()
    ActorIntendedEffect.drop_collection()

    count = 0
    for t in vocabs.ThreatActorType._ALLOWED_VALUES:
        x = ActorThreatType(name = t)
        x.save()
        count += 1
    print "Added %s Threat Actor Types." % count
    count = 0
    for t in vocabs.Motivation._ALLOWED_VALUES:
        x = ActorMotivation(name = t)
        x.save()
        count += 1
    print "Added %s Actor Motivations." % count
    count = 0
    for t in vocabs.ThreatActorSophistication._ALLOWED_VALUES:
        x = ActorSophistication(name = t)
        x.save()
        count += 1
    print "Added %s Actor Sophistications." % count
    count = 0
    for t in vocabs.IntendedEffect._ALLOWED_VALUES:
        x = ActorIntendedEffect(name = t)
        x.save()
        count += 1
    print "Added %s Actor Intended Effects." % count