append "CVE-" to CVE ids without it

This commit is contained in:
jesopo 2019-09-18 17:51:08 +01:00
parent 9ec81f8c8a
commit 9d846d10e2

View file

@ -14,7 +14,11 @@ class Module(ModuleManager.BaseModule):
:help: Get information for a CVE number
:usage: <CVE>
"""
page = utils.http.request(URL_CVE % event["args"].upper(), json=True)
cve_id = event["args_split"][0].upper()
if not cve_id.startswith("CVE-"):
cve_id = "CVE-%s" % cve_id
page = utils.http.request(URL_CVE % cve_id, json=True)
if page and page.data:
cve_id = page.data["id"]