예제 #1
0
def populate_signature_types(drop):
    """
    Populate default set of signature types into the system.

    :param drop: Drop the existing collection before trying to populate.
    :type: boolean
    """

    # define your signature types here
    data_types = ['Bro', 'Snort', 'Yara']
    if drop:
        SignatureType.drop_collection()
    if len(SignatureType.objects()) < 1:
        for data_type in data_types:
            dt = SignatureType()
            dt.name = data_type
            dt.save()
        print "Signature Types: added %s types!" % len(data_types)
    else:
        print "Signature Types: existing documents detected. skipping!"
예제 #2
0
def populate_signature_types(drop):
    """
    Populate default set of signature types into the system.

    :param drop: Drop the existing collection before trying to populate.
    :type: boolean
    """

    # define your signature types here
    data_types = ['Bro', 'Snort', 'Yara']
    if drop:
        SignatureType.drop_collection()
    if len(SignatureType.objects()) < 1:
        for data_type in data_types:
            dt = SignatureType()
            dt.name = data_type
            dt.save()
        print "Signature Types: added %s types!" % len(data_types)
    else:
        print "Signature Types: existing documents detected. skipping!"
예제 #3
0
def add_new_signature_type(data_type, analyst):
    """
    Add a new Signature datatype to CRITs.

    :param data_type: The new datatype to add.
    :type data_type: str
    :param analyst: The user adding the new datatype.
    :type analyst: str
    :returns: bool
    """

    data_type = data_type.strip()
    try:
        signature_type = SignatureType.objects(name=data_type).first()
        if signature_type:
            return False
        signature_type = SignatureType()
        signature_type.name = data_type
        signature_type.save(username=analyst)
        return True
    except ValidationError:
        return False
예제 #4
0
파일: handlers.py 프로젝트: mishley/crits
def add_new_signature_type(data_type, analyst):
    """
    Add a new Signature datatype to CRITs.

    :param data_type: The new datatype to add.
    :type data_type: str
    :param analyst: The user adding the new datatype.
    :type analyst: str
    :returns: bool
    """

    data_type = data_type.strip()
    try:
        signature_type = SignatureType.objects(name=data_type).first()
        if signature_type:
            return False
        signature_type = SignatureType()
        signature_type.name = data_type
        signature_type.save(username=analyst)
        return True
    except ValidationError:
        return False