Created
August 24, 2020 14:38
-
-
Save sbs2001/54087b1ac6be1329dd3fbcac927708e9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
scores = {"cvss1":1.2} | |
data = [ | |
{ | |
"url": "http://lists.opensuse.org/opensuse-security-announce/2019-08/msg00042.html", | |
"name": "openSUSE-SU-2019:1906", | |
"refsource": "SUSE", | |
"tags": [ | |
] | |
}, | |
{ | |
"url": "http://lists.opensuse.org/opensuse-security-announce/2020-01/msg00040.html", | |
"name": "openSUSE-SU-2020:0086", | |
"refsource": "SUSE", | |
"tags": [ | |
] | |
}, | |
{ | |
"url": "https://access.redhat.com/errata/RHSA-2019:1587", | |
"name": "RHSA-2019:1587", | |
"refsource": "REDHAT", | |
"tags": [ | |
] | |
}, | |
{ | |
"url": "https://nvd.nist.gov/vuln/detail/CVE-2019-10160", | |
"name": "CVE-2019-10160", | |
"refsource": "NVD", | |
"tags": [ | |
] | |
}, | |
] | |
references = [] | |
for ref in data : | |
references.append(Reference(url=ref["url"],ref_id=ref["name"], source=ref["refsource"])) | |
# At importer_runner.py | |
current_source = "NVD" | |
obtained_scores_from_nvd_for_CVE_2019_10160 = {"cvss1":1.2} | |
for ref in references : | |
ref_obj = ref.save() | |
if ref.source == current_source : | |
for scores in obtained_scores_from_nvd_for_CVE_2019_10160.items() : | |
Score.objects.create(score_type=scores[0], score_value=scores[1], reference=ref_obj) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Yes that's something like this.
Though I would likely avoid
and prefer: