diff --git a/opencve/commands/imports/cve.py b/opencve/commands/imports/cve.py index ad24ccf..ad34075 100644 --- a/opencve/commands/imports/cve.py +++ b/opencve/commands/imports/cve.py @@ -97,8 +97,10 @@ def run(): ] summary = descriptions[0]["value"] cpe_info=cve_data.get("configurations", {}) - info(cpe_info) + #info(cpe_info) if len(cpe_info) == 0: + info(cpe_info) + info(summary) try: prompt= f"CVE SUMMARY:{summary}" @@ -129,7 +131,7 @@ def run(): ]}] cpe_info=cve_data.get("configurations", {}) - info(cpe_info) + except Exception as e: cpe=None diff --git a/opencve/utils.py b/opencve/utils.py index a5be749..6c94fdb 100644 --- a/opencve/utils.py +++ b/opencve/utils.py @@ -17,17 +17,22 @@ def convert_cpes(conf): if not uris: uris = nested_lookup("cpe23Uri", conf) - info(uris) + # Create a list of tuple (vendor, product) cpes_t = list(set([tuple(uri.split(":")[3:5]) for uri in uris])) # Transform it into nested dictionnary cpes = {} - for vendor, product in cpes_t: - if vendor not in cpes: - cpes[vendor] = [] - cpes[vendor].append(product) + try: + for vendor, product in cpes_t: + if vendor not in cpes: + cpes[vendor] = [] + cpes[vendor].append(product) + except Exception as e: + + cpes = {} + return cpes