else:
// If the cpe_match did not have any of the version start/end modifiers,
// add the CPE string as it is.
cve["vulnerable_product"].append(cpeuri["cpe23Uri"])cve["vulnerable_configuration"].append(cpeuri["cpe23Uri"])
else:
cve["vulnerable_configuration"].append(cpeuri["cpe23Uri"])
if "children" in cpe:
for child in cpe["children"]:
if "cpe_match" in child:
for cpeuri in child["cpe_match"]:
if cpeuri["vulnerable"]:
query, version_info = get_cpe_info(cpeuri)
if query != {}:
query["id"] = hashlib.sha1(cpeuri["cpe23Uri"].encode("utf-8") + version_info.encode("utf-8")).hexdigest()
cpe_info = db.getCPEVersionInformation(query)
if cpe_info:
if cpe_info["cpe_name"]:
for vulnerable_version in cpe_info["cpe_name"]:
cve["vulnerable_product"].append(vulnerable_version["cpe23Uri"])
cve["vulnerable_configuration"].append(vulnerable_version["cpe23Uri"])
else:
cve["vulnerable_product"].append(cpeuri["cpe23Uri"])cve["vulnerable_configuration"].append(cpeuri["cpe23Uri"])
else:
// If the cpe_match did not have any of the version start/end modifiers,
// add the CPE string as it is.
cve["vulnerable_product"].append(cpeuri["cpe23Uri"])
After Change
else:
// If the cpe_match did not have any of the version start/end modifiers,
// add the CPE string as it is.
cve = add_if_missing(cve, "vulnerable_product", cpeuri["cpe23Uri"])cve = add_if_missing(cve, "vulnerable_configuration", cpeuri["cpe23Uri"])
else:
cve = add_if_missing(cve, "vulnerable_configuration", cpeuri["cpe23Uri"])
if "children" in cpe:
for child in cpe["children"]:
if "cpe_match" in child:
for cpeuri in child["cpe_match"]:
if cpeuri["vulnerable"]:
query, version_info = get_cpe_info(cpeuri)
if query != {}:
query["id"] = hashlib.sha1(cpeuri["cpe23Uri"].encode("utf-8") + version_info.encode("utf-8")).hexdigest()
cpe_info = db.getCPEVersionInformation(query)
if cpe_info:
if cpe_info["cpe_name"]:
for vulnerable_version in cpe_info["cpe_name"]:
cve = add_if_missing(cve, "vulnerable_product", vulnerable_version["cpe23Uri"])
cve = add_if_missing(cve, "vulnerable_configuration", vulnerable_version["cpe23Uri"])
else:
cve = add_if_missing(cve, "vulnerable_product", cpeuri["cpe23Uri"])
cve = add_if_missing(cve, "vulnerable_configuration", cpeuri["cpe23Uri"])
else:
// If the cpe_match did not have any of the version start/end modifiers,
// add the CPE string as it is.
cve = add_if_missing(cve, "vulnerable_product", cpeuri["cpe23Uri"])