Ejemplo n.º 1
0
 def __init__(self, *args, **kwargs):
     super(CampaignForm, self).__init__(*args, **kwargs)
     self.fields['confidence'].choices = [('low', 'low'),
                                          ('medium', 'medium'),
                                          ('high', 'high')]
     self.fields['name'].choices = [(c.name, c.name)
                                    for c in get_item_names(Campaign, True)]
Ejemplo n.º 2
0
    def __init__(self, username, *args, **kwargs):
        super(AddDomainForm, self).__init__(username, *args, **kwargs)
        self.fields['ip_source'].choices = [
            (c.name, c.name) for c in get_source_names(True, True, username)
        ]
        self.fields['ip_source'].initial = get_user_organization(username)
        self.fields['ip_tlp'].choices = [
            (t, t) for t in ('red', 'amber', 'green', 'white')
        ]
        self.fields['ip_tlp'].initial = 'red'

        if username.has_access_to(Common.CAMPAIGN_READ):
            self.fields['campaign'].choices = [('', '')] + [
                (c.name, c.name) for c in get_item_names(Campaign, True)
            ]
        self.fields['confidence'].choices = [('', ''), ('low', 'low'),
                                             ('medium', 'medium'),
                                             ('high', 'high')]

        self.fields['ip_type'].choices = ip_choices

        self.fields['ip_type'].initial = IPTypes.IPV4_ADDRESS

        self.fields['relationship_type'].choices = relationship_choices
        self.fields['relationship_type'].initial = RelationshipTypes.RELATED_TO

        add_bucketlist_to_form(self)
        add_ticket_to_form(self)
Ejemplo n.º 3
0
    def __init__(self, username, *args, **kwargs):
        super(UploadFileForm, self).__init__(*args, **kwargs)
        self.fields['source'].choices = [(c.name,
                                          c.name) for c in get_source_names(True,
                                                                            True,
                                                                            username)]
        self.fields['source'].initial = get_user_organization(username)
        self.fields['campaign'].choices = [('', '')] + [
                (c.name, c.name) for c in get_item_names(Campaign, True)]
        self.fields['confidence'].choices = [('', ''),
                                             ('low', 'low'),
                                             ('medium', 'medium'),
                                             ('high', 'high')]
        self.fields['backdoor'].choices = [('', '')]

        self.fields['relationship_type'].choices = relationship_choices
        self.fields['relationship_type'].initial = RelationshipTypes.RELATED_TO

        for (name, version) in get_backdoor_names(username):
            display = name
            value = name + '|||' + version
            if version:
                display += ' (Version: ' + version + ')'
            self.fields['backdoor'].choices.append((value, display))

        add_bucketlist_to_form(self)
        add_ticket_to_form(self)
Ejemplo n.º 4
0
 def __init__(self, *args, **kwargs):
     super(SourceAccessForm, self).__init__(*args, **kwargs)
     self.fields['roles'].choices = [(c.name, c.name)
                                     for c in get_item_names(Role, True)]
     self.fields['organization'].choices = [
         (c.name, c.name) for c in get_source_names(True, False, None)
     ]
Ejemplo n.º 5
0
    def __init__(self, username, *args, **kwargs):
        super(AddActorIdentifierForm, self).__init__(username, *args, **kwargs)

        self.fields['identifier_type'].choices = [
            (c.name, c.name)
            for c in get_item_names(ActorThreatIdentifier, True)
        ]
Ejemplo n.º 6
0
    def __init__(self, username, *args, **kwargs):
        super(UploadRawDataForm, self).__init__(*args, **kwargs)
        self.fields["source"].choices = [(c.name, c.name) for c in get_source_names(True, True, username)]
        self.fields["source"].initial = get_user_organization(username)
        self.fields["data_type"].choices = [(c.name, c.name) for c in get_item_names(RawDataType, True)]

        add_bucketlist_to_form(self)
        add_ticket_to_form(self)
Ejemplo n.º 7
0
Archivo: forms.py Proyecto: 0x3a/crits
 def __init__(self, *args, **kwargs):
     super(AddLocationForm, self).__init__(*args, **kwargs)
     self.fields['location_type'].choices = [
         ('Originated From', 'Originated From'),
         ('Destined For', 'Destined For'),
     ]
     self.fields['country'].choices = [
         (c.name, c.name) for c in get_item_names(Location, True)]
Ejemplo n.º 8
0
 def __init__(self, *args, **kwargs):
     super(CampaignForm, self).__init__(*args, **kwargs)
     self.fields['confidence'].choices = [('low', 'low'),
                                          ('medium', 'medium'),
                                          ('high', 'high')]
     self.fields['name'].choices = [(c.name,
                                     c.name) for c in get_item_names(Campaign,
                                                                        True)]
Ejemplo n.º 9
0
    def __init__(self, username, *args, **kwargs):
        super(AddActorIdentifierForm, self).__init__(*args, **kwargs)

        self.fields['identifier_type'].choices = [
            (c.name, c.name) for c in get_item_names(ActorThreatIdentifier, True)]
        self.fields['source'].choices = [
            (c.name, c.name) for c in get_source_names(True, True, username)]
        self.fields['source'].initial = get_user_organization(username)
Ejemplo n.º 10
0
 def __init__(self, *args, **kwargs):
     super(AddLocationForm, self).__init__(*args, **kwargs)
     self.fields['location_type'].choices = [
         ('Originated From', 'Originated From'),
         ('Destined For', 'Destined For'),
     ]
     self.fields['country'].choices = [
         (c.name, c.name) for c in get_item_names(Location, True)
     ]
Ejemplo n.º 11
0
 def __init__(self, *args, **kwargs):
     super(SourceAccessForm, self).__init__(*args, **kwargs)
     self.fields['roles'].choices = [(c.name,
                                      c.name) for c in get_item_names(Role,
                                                                      True)]
     self.fields['organization'].choices = [(c.name,
                                             c.name) for c in get_source_names(True,
                                                                                  False,
                                                                                  None)]
Ejemplo n.º 12
0
    def __init__(self, username, *args, **kwargs):
        super(UploadSignatureForm, self).__init__(username, *args, **kwargs)
        self.fields['data_type'].choices = [
            (c.name, c.name) for c in get_item_names(SignatureType, True)
        ]
        self.fields['relationship_type'].choices = relationship_choices
        self.fields['relationship_type'].initial = RelationshipTypes.RELATED_TO

        add_bucketlist_to_form(self)
        add_ticket_to_form(self)
Ejemplo n.º 13
0
    def __init__(self, username, *args, **kwargs):
        super(AddActorIdentifierForm, self).__init__(*args, **kwargs)

        self.fields['identifier_type'].choices = [
            (c.name, c.name)
            for c in get_item_names(ActorThreatIdentifier, True)
        ]
        self.fields['source'].choices = [
            (c.name, c.name) for c in get_source_names(True, True, username)
        ]
        self.fields['source'].initial = get_user_organization(username)
Ejemplo n.º 14
0
    def __init__(self, username, *args, **kwargs):
        super(UploadSignatureForm, self).__init__(username, *args, **kwargs)
        self.fields['data_type'].choices = [(c.name,
                                             c.name
                                             ) for c in get_item_names(SignatureType,
                                                                       True)]
        self.fields['relationship_type'].choices = relationship_choices
        self.fields['relationship_type'].initial = RelationshipTypes.RELATED_TO

        add_bucketlist_to_form(self)
        add_ticket_to_form(self)
Ejemplo n.º 15
0
    def __init__(self, username, *args, **kwargs):
        super(UploadRawDataForm, self).__init__(*args, **kwargs)
        self.fields['source'].choices = [
            (c.name, c.name) for c in get_source_names(True, True, username)
        ]
        self.fields['source'].initial = get_user_organization(username)
        self.fields['data_type'].choices = [
            (c.name, c.name) for c in get_item_names(RawDataType, True)
        ]

        add_bucketlist_to_form(self)
        add_ticket_to_form(self)
Ejemplo n.º 16
0
Archivo: forms.py Proyecto: 0x3a/crits
    def __init__(self, *args, **kwargs):
        super(TargetInfoForm, self).__init__(*args, **kwargs)
        campaigns = [('', '')] + [(c.name,
                                   c.name) for c in get_item_names(Campaign,
                                                                   True)]
        self.fields['campaign'].choices = campaigns
        self.fields['camp_conf'].choices = [('',''),
                                            ('low', 'low'),
                                            ('medium', 'medium'),
                                            ('high', 'high')]

        add_bucketlist_to_form(self)
        add_ticket_to_form(self)
Ejemplo n.º 17
0
    def __init__(self, *args, **kwargs):
        super(TargetInfoForm, self).__init__(*args, **kwargs)
        campaigns = [('', '')] + [(c.name,
                                   c.name) for c in get_item_names(Campaign,
                                                                   True)]
        self.fields['campaign'].choices = campaigns
        self.fields['camp_conf'].choices = [('',''),
                                            ('low', 'low'),
                                            ('medium', 'medium'),
                                            ('high', 'high')]

        add_bucketlist_to_form(self)
        add_ticket_to_form(self)
Ejemplo n.º 18
0
 def __init__(self, username, *args, **kwargs):
     super(EmailYAMLForm, self).__init__(*args, **kwargs)
     self.fields['source'].choices = [
         (c.name, c.name) for c in get_source_names(True, True, username)
     ]
     self.fields['source'].initial = get_user_organization(username)
     self.fields['campaign'].choices = [("", "")]
     self.fields['campaign'].choices += [
         (c.name, c.name) for c in get_item_names(Campaign, True)
     ]
     self.fields['campaign_confidence'].choices = [("", ""), ("low", "low"),
                                                   ("medium", "medium"),
                                                   ("high", "high")]
Ejemplo n.º 19
0
    def __init__(self, username, *args, **kwargs):
        super(AddDomainForm, self).__init__(*args, **kwargs)
        self.fields['domain_source'].choices = self.fields['ip_source'].choices = [(c.name, c.name) for c in get_source_names(True, True, username)]
        self.fields['domain_source'].initial = get_user_organization(username)
        self.fields['ip_source'].initial = get_user_organization(username)
        self.fields['campaign'].choices = [('', '')] + [(c.name, c.name) for c in get_item_names(Campaign, True)]
        self.fields['confidence'].choices = [('',''),
                                             ('low', 'low'),
                                             ('medium', 'medium'),
                                             ('high', 'high')]

        add_bucketlist_to_form(self)
        add_ticket_to_form(self)
Ejemplo n.º 20
0
 def __init__(self, username, *args, **kwargs):
     super(EmailOutlookForm, self).__init__(*args, **kwargs)
     self.fields['source'].choices = [(c.name, c.name) for c in get_source_names(True, True, username)]
     self.fields['source'].initial = get_user_organization(username)
     self.fields['campaign'].choices = [("","")]
     self.fields['campaign'].choices += [(c.name,
                                          c.name
                                          ) for c in get_item_names(Campaign,
                                                                    True)]
     self.fields['campaign_confidence'].choices = [("", ""),
                                          ("low", "low"),
                                          ("medium", "medium"),
                                          ("high", "high")]
Ejemplo n.º 21
0
Archivo: forms.py Proyecto: 0x3a/crits
    def __init__(self, username, *args, **kwargs):
        super(EventForm, self).__init__(*args, **kwargs)
        self.fields['source'].choices = [(c.name,
                                          c.name) for c in get_source_names(True,
                                                                               True,
                                                                               username)]
        self.fields['source'].initial = get_user_organization(username)
        self.fields['event_type'].choices = [(c.name,
                                              c.name) for c in get_item_names(EventType,
                                                                                 True)]

        add_bucketlist_to_form(self)
        add_ticket_to_form(self)
Ejemplo n.º 22
0
    def __init__(self, username, *args, **kwargs):
        super(AddActorForm, self).__init__(*args, **kwargs)

        self.fields['campaign'].choices = [('', '')] + [
                (c.name, c.name) for c in get_item_names(Campaign, True)]
        self.fields['confidence'].choices = [('', ''),
                                             ('low', 'low'),
                                             ('medium', 'medium'),
                                             ('high', 'high')]
        self.fields['source'].choices = [(c.name, c.name) for c in get_source_names(True, True, username)]
        self.fields['source'].initial = get_user_organization(username)

        add_bucketlist_to_form(self)
        add_ticket_to_form(self)
Ejemplo n.º 23
0
    def __init__(self, username, *args, **kwargs):
        super(EmailAttachForm, self).__init__(*args, **kwargs)
        self.fields['campaign'].choices = [('', '')] + [
                (c.name, c.name) for c in get_item_names(Campaign, True)]
        self.fields['confidence'].choices = [('', ''),
                                             ('low', 'low'),
                                             ('medium', 'medium'),
                                             ('high', 'high')]
        self.fields['source'].choices = [(c.name, c.name) for c in get_source_names(True, True, username)]
        self.fields['source'].initial = get_user_organization(username)
        self.fields['source_date'].value = datetime.now()

        add_bucketlist_to_form(self)
        add_ticket_to_form(self)
Ejemplo n.º 24
0
    def __init__(self, username, *args, **kwargs):
        super(TargetInfoForm, self).__init__(*args, **kwargs)
        if username.has_access_to(Common.CAMPAIGN_READ):
            self.fields['campaign'].choices = [('', '')] + [
                (c.name, c.name) for c in get_item_names(Campaign, True)
            ]
        self.fields['camp_conf'].choices = [('', ''), ('low', 'low'),
                                            ('medium', 'medium'),
                                            ('high', 'high')]
        self.fields['relationship_type'].choices = relationship_choices
        self.fields['relationship_type'].initial = RelationshipTypes.RELATED_TO

        add_bucketlist_to_form(self)
        add_ticket_to_form(self)
Ejemplo n.º 25
0
    def __init__(self, username, *args, **kwargs):
        super(TargetInfoForm, self).__init__( *args, **kwargs)
        if username.has_access_to(Common.CAMPAIGN_READ):
            self.fields['campaign'].choices = [('', '')] + [
                (c.name, c.name) for c in get_item_names(Campaign, True)]
        self.fields['camp_conf'].choices = [('',''),
                                            ('low', 'low'),
                                            ('medium', 'medium'),
                                            ('high', 'high')]
        self.fields['relationship_type'].choices = relationship_choices
        self.fields['relationship_type'].initial = RelationshipTypes.RELATED_TO

        add_bucketlist_to_form(self)
        add_ticket_to_form(self)
Ejemplo n.º 26
0
 def __init__(self, username, *args, **kwargs):
     super(EmailYAMLForm, self).__init__(username, *args, **kwargs)
     self.fields['campaign'].choices = [("","")]
     if username.has_access_to(Common.CAMPAIGN_READ):
         self.fields['campaign'].choices = [('', '')] + [
             (c.name, c.name) for c in get_item_names(Campaign, True)]
     self.fields['campaign_confidence'].choices = [("", ""),
                                          ("low", "low"),
                                          ("medium", "medium"),
                                          ("high", "high")]
     self.fields['relationship_type'].choices = relationship_choices
     self.fields['relationship_type'].initial = RelationshipTypes.RELATED_TO
     add_bucketlist_to_form(self)
     add_ticket_to_form(self)
Ejemplo n.º 27
0
 def __init__(self, user, *args, **kwargs):
     super(EmailYAMLForm, self).__init__(user, *args, **kwargs)
     self.fields['campaign'].choices = [("", "")]
     if user.has_access_to(Common.CAMPAIGN_READ):
         self.fields['campaign'].choices = [('', '')] + [
             (c.name, c.name) for c in get_item_names(Campaign, True)
         ]
     self.fields['campaign_confidence'].choices = [("", ""), ("low", "low"),
                                                   ("medium", "medium"),
                                                   ("high", "high")]
     self.fields['relationship_type'].choices = relationship_choices
     self.fields['relationship_type'].initial = RelationshipTypes.RELATED_TO
     add_bucketlist_to_form(self)
     add_ticket_to_form(self)
Ejemplo n.º 28
0
    def __init__(self, username, choices, *args, **kwargs):
        super(AddIPForm, self).__init__(*args, **kwargs)

        if choices is None:
            self.fields["ip_type"].choices = ip_choices
        else:
            self.fields["ip_type"].choices = choices

        self.fields["campaign"].choices = [("", "")] + [(c.name, c.name) for c in get_item_names(Campaign, True)]
        self.fields["confidence"].choices = [("", ""), ("low", "low"), ("medium", "medium"), ("high", "high")]
        self.fields["source"].choices = [(c.name, c.name) for c in get_source_names(True, True, username)]
        self.fields["source"].initial = get_user_organization(username)
        self.fields["analyst"].initial = username

        add_bucketlist_to_form(self)
        add_ticket_to_form(self)
Ejemplo n.º 29
0
Archivo: forms.py Proyecto: ckane/crits
 def __init__(self, username, *args, **kwargs):
     super(UploadRawDataForm, self).__init__(*args, **kwargs)
     self.fields['source'].choices = [(c.name,
                                       c.name
                                       ) for c in get_source_names(True,
                                                                   True,
                                                                   username)]
     self.fields['source'].initial = get_user_organization(username)
     self.fields['data_type'].choices = [(c.name,
                                          c.name
                                          ) for c in get_item_names(RawDataType,
                                                                    True)]
     self.fields['relationship_type'].choices = relationship_choices
     self.fields['relationship_type'].initial = RelationshipTypes.RELATED_TO
     
     add_bucketlist_to_form(self)
     add_ticket_to_form(self)
Ejemplo n.º 30
0
 def __init__(self, username, *args, **kwargs):
     super(EmailYAMLForm, self).__init__(*args, **kwargs)
     self.fields['source'].choices = [
         (c.name, c.name) for c in get_source_names(True, True, username)
     ]
     self.fields['source'].initial = get_user_organization(username)
     self.fields['campaign'].choices = [("", "")]
     self.fields['campaign'].choices += [
         (c.name, c.name) for c in get_item_names(Campaign, True)
     ]
     self.fields['campaign_confidence'].choices = [("", ""), ("low", "low"),
                                                   ("medium", "medium"),
                                                   ("high", "high")]
     self.fields['relationship_type'].choices = relationship_choices
     self.fields['relationship_type'].initial = RelationshipTypes.RELATED_TO
     add_bucketlist_to_form(self)
     add_ticket_to_form(self)
Ejemplo n.º 31
0
 def __init__(self, username, *args, **kwargs):
     super(EmailYAMLForm, self).__init__(*args, **kwargs)
     self.fields['source'].choices = [(c.name, c.name) for c in get_source_names(True, True, username)]
     self.fields['source'].initial = get_user_organization(username)
     self.fields['campaign'].choices = [("","")]
     self.fields['campaign'].choices += [(c.name,
                                          c.name
                                          ) for c in get_item_names(Campaign,
                                                                    True)]
     self.fields['campaign_confidence'].choices = [("", ""),
                                          ("low", "low"),
                                          ("medium", "medium"),
                                          ("high", "high")]
     self.fields['relationship_type'].choices = relationship_choices
     self.fields['relationship_type'].initial = RelationshipTypes.RELATED_TO
     add_bucketlist_to_form(self)
     add_ticket_to_form(self)
Ejemplo n.º 32
0
    def __init__(self, username, *args, **kwargs):
        super(UploadIndicatorForm, self).__init__(*args, **kwargs)
        self.fields['source'].choices = [
            (c.name, c.name) for c in get_source_names(True, True, username)]
        self.fields['source'].initial = get_user_organization(username)
        self.fields['status'].choices = [
            (c,c) for c in Status.values()
        ]
        self.fields['indicator_type'].choices = [
            (c,c) for c in IndicatorTypes.values(sort=True)
        ]
        self.fields['threat_type'].choices = [
            (c,c) for c in IndicatorThreatTypes.values(sort=True)
        ]
        self.fields['threat_type'].initial = IndicatorThreatTypes.UNKNOWN
        self.fields['attack_type'].choices = [
            (c,c) for c in IndicatorAttackTypes.values(sort=True)
        ]
        self.fields['attack_type'].initial = IndicatorAttackTypes.UNKNOWN
        self.fields['indicator_type'].widget.attrs = {'class': 'object-types'}
        self.fields['campaign'].choices = [("", "")]
        self.fields['campaign'].choices += [
            (c.name, c.name) for c in get_item_names(Campaign, True)]
        self.fields['campaign_confidence'].choices = [
            ("", ""),
            ("low", "low"),
            ("medium", "medium"),
            ("high", "high")]
        self.fields['confidence'].choices = [
            ("unknown", "unknown"),
            ("benign", "benign"),
            ("low", "low"),
            ("medium", "medium"),
            ("high", "high")]
        self.fields['impact'].choices = [
            ("unknown", "unknown"),
            ("benign", "benign"),
            ("low", "low"),
            ("medium", "medium"),
            ("high", "high")]

        self.fields['relationship_type'].choices = relationship_choices
        self.fields['relationship_type'].initial = RelationshipTypes.RELATED_TO

        add_bucketlist_to_form(self)
        add_ticket_to_form(self)
Ejemplo n.º 33
0
Archivo: forms.py Proyecto: ckane/crits
    def __init__(self, username, *args, **kwargs):
        super(AddBackdoorForm, self).__init__(*args, **kwargs)

        self.fields['campaign'].choices = [('', '')] + [
            (c.name, c.name) for c in get_item_names(Campaign, True)]
        self.fields['confidence'].choices = [
            ('', ''),
            ('low', 'low'),
            ('medium', 'medium'),
            ('high', 'high')]
        self.fields['source'].choices = [
            (c.name, c.name) for c in get_source_names(True, True, username)]
        self.fields['source'].initial = get_user_organization(username)
        self.fields['relationship_type'].choices = relationship_choices
        self.fields['relationship_type'].initial = RelationshipTypes.RELATED_TO

        add_bucketlist_to_form(self)
        add_ticket_to_form(self)
Ejemplo n.º 34
0
    def __init__(self, user, *args, **kwargs):
        super(UploadIndicatorForm, self).__init__(user, *args, **kwargs)
        self.fields['status'].choices = [
            (c,c) for c in Status.values()
        ]
        self.fields['indicator_type'].choices = [
            (c,c) for c in IndicatorTypes.values(sort=True)
        ]
        self.fields['threat_type'].choices = [
            (c,c) for c in IndicatorThreatTypes.values(sort=True)
        ]
        self.fields['threat_type'].initial = IndicatorThreatTypes.UNKNOWN
        self.fields['attack_type'].choices = [
            (c,c) for c in IndicatorAttackTypes.values(sort=True)
        ]
        self.fields['attack_type'].initial = IndicatorAttackTypes.UNKNOWN
        self.fields['indicator_type'].widget.attrs = {'class': 'object-types'}
        if user.has_access_to(Common.CAMPAIGN_READ):
            self.fields['campaign'].choices = [('', '')] + [
                (c.name, c.name) for c in get_item_names(Campaign, True)]

        self.fields['campaign_confidence'].choices = [
            ("", ""),
            ("low", "low"),
            ("medium", "medium"),
            ("high", "high")]
        self.fields['confidence'].choices = [
            ("unknown", "unknown"),
            ("benign", "benign"),
            ("low", "low"),
            ("medium", "medium"),
            ("high", "high")]
        self.fields['impact'].choices = [
            ("unknown", "unknown"),
            ("benign", "benign"),
            ("low", "low"),
            ("medium", "medium"),
            ("high", "high")]

        self.fields['relationship_type'].choices = relationship_choices
        self.fields['relationship_type'].initial = RelationshipTypes.RELATED_TO

        add_bucketlist_to_form(self)
        add_ticket_to_form(self)
Ejemplo n.º 35
0
def get_raw_data_type_dropdown(request):
    """
    Generate RawData datetypes dropdown information. Should be an AJAX POST.

    :param request: Django request object (Required)
    :type request: :class:`django.http.HttpRequest`
    :returns: :class:`django.http.HttpResponse`
    """

    if request.method == "POST" and request.is_ajax():
        dt_types = get_item_names(RawDataType)
        dt_final = []
        for dt in dt_types:
            dt_final.append(dt.name)
            result = {"data": dt_final}
        return HttpResponse(json.dumps(result), content_type="application/json")
    else:
        error = "Expected AJAX POST"
        return render_to_response("error.html", {"error": error}, RequestContext(request))
Ejemplo n.º 36
0
def get_signature_dependency_dropdown(request):
    """
    Generate Signature dependency dropdown information. Should be an AJAX POST.

    :param request: Django request object (Required)
    :type request: :class:`django.http.HttpRequest`
    :returns: :class:`django.http.HttpResponse`
    """

    if request.method == 'POST' and request.is_ajax():
        dt_deps = get_item_names(SignatureDependency)
        dt_final = []
        for dt in dt_deps:
            dt_final.append(dt.name)
            result = {'data': dt_final}
            return HttpResponse(json.dumps(result), content_type="application/json")
    else:
        error = "Expected AJAX POST"
        return render(request, "error.html", {'error': error})
Ejemplo n.º 37
0
    def __init__(self, username, choices=None, *args, **kwargs):
        super(UploadIndicatorForm, self).__init__(*args, **kwargs)
        self.fields['source'].choices = [
            (c.name, c.name) for c in get_source_names(True, True, username)
        ]
        self.fields['source'].initial = get_user_organization(username)
        if not choices:
            #only valid types for indicators are those which don't require file upload
            choices = [(c[0], c[0], {
                'datatype': c[1].keys()[0],
                'datatype_value': c[1].values()[0]
            }) for c in get_object_types(active=True,
                                         query={
                                             'datatype.file': {
                                                 '$exists': 0
                                             },
                                             'datatype.enum': {
                                                 '$exists': 0
                                             }
                                         })]

        self.fields['indicator_type'].choices = choices
        self.fields['indicator_type'].widget.attrs = {'class': 'object-types'}
        self.fields['campaign'].choices = [("", "")]
        self.fields['campaign'].choices += [
            (c.name, c.name) for c in get_item_names(Campaign, True)
        ]
        self.fields['campaign_confidence'].choices = [("", ""), ("low", "low"),
                                                      ("medium", "medium"),
                                                      ("high", "high")]
        self.fields['confidence'].choices = [("unknown", "unknown"),
                                             ("benign", "benign"),
                                             ("low", "low"),
                                             ("medium", "medium"),
                                             ("high", "high")]
        self.fields['impact'].choices = [("unknown", "unknown"),
                                         ("benign", "benign"), ("low", "low"),
                                         ("medium", "medium"),
                                         ("high", "high")]

        add_bucketlist_to_form(self)
        add_ticket_to_form(self)
Ejemplo n.º 38
0
def get_signature_dependency_dropdown(request):
    """
    Generate Signature dependency dropdown information. Should be an AJAX POST.

    :param request: Django request object (Required)
    :type request: :class:`django.http.HttpRequest`
    :returns: :class:`django.http.HttpResponse`
    """

    if request.method == 'POST' and request.is_ajax():
        dt_deps = get_item_names(SignatureDependency)
        dt_final = []
        for dt in dt_deps:
            dt_final.append(dt.name)
            result = {'data': dt_final}
            return HttpResponse(json.dumps(result),
                                content_type="application/json")
    else:
        error = "Expected AJAX POST"
        return render(request, "error.html", {'error': error})
Ejemplo n.º 39
0
    def __init__(self, username, choices, *args, **kwargs):
        super(AddIPForm, self).__init__(*args, **kwargs)

        if choices is None:
            self.fields['ip_type'].choices = ip_choices
        else:
            self.fields['ip_type'].choices = choices

        self.fields['campaign'].choices = [('', '')] + [
                (c.name, c.name) for c in get_item_names(Campaign, True)]
        self.fields['confidence'].choices = [('', ''),
                                             ('low', 'low'),
                                             ('medium', 'medium'),
                                             ('high', 'high')]
        self.fields['source'].choices = [(c.name, c.name) for c in get_source_names(True, True, username)]
        self.fields['source'].initial = get_user_organization(username)
        self.fields['analyst'].initial = username

        add_bucketlist_to_form(self)
        add_ticket_to_form(self)
Ejemplo n.º 40
0
    def __init__(self, username, choices, *args, **kwargs):
        super(AddIPForm, self).__init__(*args, **kwargs)

        if choices is None:
            self.fields['ip_type'].choices = ip_choices
        else:
            self.fields['ip_type'].choices = choices

        self.fields['campaign'].choices = [('', '')] + [
                (c.name, c.name) for c in get_item_names(Campaign, True)]
        self.fields['confidence'].choices = [('', ''),
                                             ('low', 'low'),
                                             ('medium', 'medium'),
                                             ('high', 'high')]
        self.fields['source'].choices = [(c.name, c.name) for c in get_source_names(True, True, username)]
        self.fields['source'].initial = get_user_organization(username)
        self.fields['analyst'].initial = username

        add_bucketlist_to_form(self)
        add_ticket_to_form(self)
Ejemplo n.º 41
0
def get_raw_data_type_dropdown(request):
    """
    Generate RawData datetypes dropdown information. Should be an AJAX POST.

    :param request: Django request object (Required)
    :type request: :class:`django.http.HttpRequest`
    :returns: :class:`django.http.HttpResponse`
    """

    if request.method == 'POST' and request.is_ajax():
        dt_types = get_item_names(RawDataType)
        dt_final = []
        for dt in dt_types:
            dt_final.append(dt.name)
            result = {'data': dt_final}
        return HttpResponse(json.dumps(result), mimetype="application/json")
    else:
        error = "Expected AJAX POST"
        return render_to_response("error.html", {'error': error},
                                  RequestContext(request))
Ejemplo n.º 42
0
    def __init__(self, username, choices=None, *args, **kwargs):
        super(UploadIndicatorForm, self).__init__(*args, **kwargs)
        self.fields['source'].choices = [(c.name,
                                          c.name) for c in get_source_names(True,
                                                                               True,
                                                                               username)]
        self.fields['source'].initial = get_user_organization(username)
        if not choices:
            #only valid types for indicators are those which don't require file upload
            choices = [(c[0],
                             c[0],
                             {'datatype':c[1].keys()[0],
                              'datatype_value':c[1].values()[0]}
                             ) for c in get_object_types(active=True,
                                                         query={'datatype.file':{'$exists':0}})]

        self.fields['indicator_type'].choices = choices
        self.fields['indicator_type'].widget.attrs = {'class':'object-types'}
        self.fields['campaign'].choices = [("","")]
        self.fields['campaign'].choices += [(c.name,
                                             c.name
                                             ) for c in get_item_names(Campaign,
                                                                       True)]
        self.fields['campaign_confidence'].choices = [("", ""),
                                             ("low", "low"),
                                             ("medium", "medium"),
                                             ("high", "high")]
        self.fields['confidence'].choices = [("unknown", "unknown"),
                                             ("benign", "benign"),
                                             ("low", "low"),
                                             ("medium", "medium"),
                                             ("high", "high")]
        self.fields['impact'].choices = [("unknown", "unknown"),
                                             ("benign", "benign"),
                                             ("low", "low"),
                                             ("medium", "medium"),
                                             ("high", "high")]

        add_bucketlist_to_form(self)
        add_ticket_to_form(self)
Ejemplo n.º 43
0
    def __init__(self, username, *args, **kwargs):
        super(UploadIndicatorForm, self).__init__(*args, **kwargs)
        self.fields['source'].choices = [
            (c.name, c.name) for c in get_source_names(True, True, username)]
        self.fields['source'].initial = get_user_organization(username)
        self.fields['indicator_type'].choices = [
            (c,c) for c in IndicatorTypes.values(sort=True)
        ]
        self.fields['threat_type'].choices = [
            (c,c) for c in IndicatorThreatTypes.values(sort=True)
        ]
        self.fields['threat_type'].initial = IndicatorThreatTypes.UNKNOWN
        self.fields['attack_type'].choices = [
            (c,c) for c in IndicatorAttackTypes.values(sort=True)
        ]
        self.fields['attack_type'].initial = IndicatorAttackTypes.UNKNOWN
        self.fields['indicator_type'].widget.attrs = {'class': 'object-types'}
        self.fields['campaign'].choices = [("", "")]
        self.fields['campaign'].choices += [
            (c.name, c.name) for c in get_item_names(Campaign, True)]
        self.fields['campaign_confidence'].choices = [
            ("", ""),
            ("low", "low"),
            ("medium", "medium"),
            ("high", "high")]
        self.fields['confidence'].choices = [
            ("unknown", "unknown"),
            ("benign", "benign"),
            ("low", "low"),
            ("medium", "medium"),
            ("high", "high")]
        self.fields['impact'].choices = [
            ("unknown", "unknown"),
            ("benign", "benign"),
            ("low", "low"),
            ("medium", "medium"),
            ("high", "high")]

        add_bucketlist_to_form(self)
        add_ticket_to_form(self)
Ejemplo n.º 44
0
    def __init__(self, username, *args, **kwargs):
        super(AddDomainForm, self).__init__(*args, **kwargs)
        self.fields['domain_source'].choices = self.fields[
            'ip_source'].choices = [
                (c.name, c.name)
                for c in get_source_names(True, True, username)
            ]
        self.fields['domain_source'].initial = get_user_organization(username)
        self.fields['ip_source'].initial = get_user_organization(username)
        self.fields['campaign'].choices = [('', '')] + [
            (c.name, c.name) for c in get_item_names(Campaign, True)
        ]
        self.fields['confidence'].choices = [('', ''), ('low', 'low'),
                                             ('medium', 'medium'),
                                             ('high', 'high')]

        self.fields['ip_type'].choices = ip_choices
        self.fields['ip_type'].initial = IPTypes.IPV4_ADDRESS

        self.fields['relationship_type'].choices = relationship_choices
        self.fields['relationship_type'].initial = RelationshipTypes.RELATED_TO

        add_bucketlist_to_form(self)
        add_ticket_to_form(self)
Ejemplo n.º 45
0
 def __init__(self, *args, **kwargs):
     super(RoleCombinePreview, self).__init__(*args, **kwargs)
     self.fields['roles'].choices = [(c.name, c.name)
                                     for c in get_item_names(Role, True)]
Ejemplo n.º 46
0
 def __init__(self, *args, **kwargs):
     super(ExploitForm, self).__init__(*args, **kwargs)
     self.fields['exploit'].choices = [(c.name,
                                        c.name
                                        ) for c in get_item_names(Exploit,
                                                                  True)]
Ejemplo n.º 47
0
def get_campaign_names_list(active):
    listing = get_item_names(Campaign, bool(active))
    return [c.name for c in listing]
Ejemplo n.º 48
0
 def __init__(self, *args, **kwargs):
     super(BackdoorForm, self).__init__(*args, **kwargs)
     self.fields['backdoor_types'].choices = [
         (c.name, c.name) for c in get_item_names(Backdoor, True)
     ]
Ejemplo n.º 49
0
 def __init__(self, *args, **kwargs):
     super(ExploitForm, self).__init__(*args, **kwargs)
     self.fields['exploit'].choices = [
         (c.name, c.name) for c in get_item_names(Exploit, True)
     ]
Ejemplo n.º 50
0
 def __init__(self, *args, **kwargs):
     super(BackdoorForm, self).__init__(*args, **kwargs)
     self.fields['backdoor_types'].choices = [(c.name,
                                               c.name
                                               ) for c in get_item_names(Backdoor,
                                                                         True)]
Ejemplo n.º 51
0
 def __init__(self, *args, **kwargs):
     super(RoleCombinePreview, self).__init__(*args, **kwargs)
     self.fields['roles'].choices = [(c.name,
                                      c.name) for c in get_item_names(Role,
                                                                      True)]
Ejemplo n.º 52
0
 def __init__(self, *args, **kwargs):
     super(IndicatorActionsForm, self).__init__(*args, **kwargs)
     self.fields['action_type'].choices = [
         (c.name, c.name) for c in get_item_names(IndicatorAction, True)
     ]
Ejemplo n.º 53
0
def get_location_names_list(active):
    listing = get_item_names(Location, bool(active))
    return [c.name for c in listing]
Ejemplo n.º 54
0
def get_location_names_list(active):
    listing = get_item_names(Location, bool(active))
    return [c.name for c in listing]
Ejemplo n.º 55
0
 def __init__(self, *args, **kwargs):
     super(IndicatorActionsForm, self).__init__(*args, **kwargs)
     self.fields['action_type'].choices = [(c.name,
                                            c.name
                                            ) for c in get_item_names(IndicatorAction,
                                                                      True)]
Ejemplo n.º 56
0
def get_campaign_names_list(active):
    listing = get_item_names(Campaign, bool(active))
    return [c.name for c in listing]