forked from certmichelin/PTART
-
Notifications
You must be signed in to change notification settings - Fork 0
/
loader_bugcrowd_vrt.py
39 lines (35 loc) · 1.34 KB
/
loader_bugcrowd_vrt.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import json
import os
import django
#
# Bugcrowd VRT templates loader.
#
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "ptart.settings")
django.setup()
from ptart.models import Template
bugcrowd_file = open('data/vulnerability-rating-taxonomy.json', 'r')
vrt = json.load(bugcrowd_file)
for content in vrt['content'] :
name = content['name']
for child in content['children'] :
child_name = child["name"]
if 'children' in child :
for little_child in child['children'] :
little_child_name = little_child ["name"]
if severity is None :
severity = 3
name = "{} ({}) ({})".format(name, child_name, little_child_name)
current_template = Template.objects.filter(name=name)
if not current_template :
template = Template(name=name, severity = severity)
template.save()
else :
severity = child["priority"]
if severity is None :
severity = 3
name = "{} ({})".format(name, child_name)
current_template = Template.objects.filter(name=name)
if not current_template :
template = Template(name=name, severity = severity)
template.save()
print("Bugcrowd VRT templates has been imported !")