예제 #1
0
파일: forms.py 프로젝트: plouzek/crits-1
 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)]
예제 #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)
예제 #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)
예제 #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)
     ]
예제 #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)
        ]
예제 #6
0
파일: forms.py 프로젝트: mishley/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)]

        add_bucketlist_to_form(self)
        add_ticket_to_form(self)
예제 #7
0
파일: forms.py 프로젝트: 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)]
예제 #8
0
파일: forms.py 프로젝트: AInquel/crits
 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)]
예제 #9
0
파일: forms.py 프로젝트: 971sec/crits
    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)
예제 #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)
     ]
예제 #11
0
파일: forms.py 프로젝트: armtash/crits
 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)]
예제 #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)
예제 #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)
예제 #14
0
파일: forms.py 프로젝트: armtash/crits
    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)
예제 #15
0
파일: forms.py 프로젝트: sidjames/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)
        ]

        add_bucketlist_to_form(self)
        add_ticket_to_form(self)
예제 #16
0
파일: forms.py 프로젝트: 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)
예제 #17
0
파일: forms.py 프로젝트: chewytek/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)
예제 #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")]
예제 #19
0
파일: forms.py 프로젝트: AInquel/crits
    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)
예제 #20
0
파일: forms.py 프로젝트: icedstitch/crits
 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")]
예제 #21
0
파일: forms.py 프로젝트: 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)
예제 #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)
예제 #23
0
파일: forms.py 프로젝트: icedstitch/crits
    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)
예제 #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)
예제 #25
0
파일: forms.py 프로젝트: armtash/crits
    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)
예제 #26
0
파일: forms.py 프로젝트: armtash/crits
 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)
예제 #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)
예제 #28
0
파일: forms.py 프로젝트: mishley/crits
    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)
예제 #29
0
파일: forms.py 프로젝트: 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)
예제 #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)
예제 #31
0
파일: forms.py 프로젝트: 971sec/crits
 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)
예제 #32
0
파일: forms.py 프로젝트: TheDr1ver/crits
    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)
예제 #33
0
파일: forms.py 프로젝트: 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)
예제 #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)
예제 #35
0
파일: views.py 프로젝트: robertsjw/crits
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))
예제 #36
0
파일: views.py 프로젝트: armtash/crits
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})
예제 #37
0
파일: forms.py 프로젝트: sidjames/crits
    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)
예제 #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})
예제 #39
0
파일: forms.py 프로젝트: jhuapl-marti/marti
    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)
예제 #40
0
파일: forms.py 프로젝트: chewytek/crits
    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)
예제 #41
0
파일: views.py 프로젝트: plouzek/crits-1
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))
예제 #42
0
파일: forms.py 프로젝트: AInquel/crits
    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)
예제 #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)
예제 #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)
예제 #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)]
예제 #46
0
파일: forms.py 프로젝트: AInquel/crits
 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)]
예제 #47
0
파일: handlers.py 프로젝트: davidhdz/crits
def get_campaign_names_list(active):
    listing = get_item_names(Campaign, bool(active))
    return [c.name for c in listing]
예제 #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)
     ]
예제 #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)
     ]
예제 #50
0
파일: forms.py 프로젝트: AInquel/crits
 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)]
예제 #51
0
파일: forms.py 프로젝트: armtash/crits
 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)]
예제 #52
0
파일: forms.py 프로젝트: cfossace/crits
 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)
     ]
예제 #53
0
def get_location_names_list(active):
    listing = get_item_names(Location, bool(active))
    return [c.name for c in listing]
예제 #54
0
파일: handlers.py 프로젝트: armtash/crits
def get_location_names_list(active):
    listing = get_item_names(Location, bool(active))
    return [c.name for c in listing]
예제 #55
0
파일: forms.py 프로젝트: AInquel/crits
 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)]
예제 #56
0
파일: handlers.py 프로젝트: gbartz/crits
def get_campaign_names_list(active):
    listing = get_item_names(Campaign, bool(active))
    return [c.name for c in listing]