Skip to content

Commit

Permalink
testing modification of CPE
Browse files Browse the repository at this point in the history
  • Loading branch information
sudesh0sudesh authored and sudesh0sudesh committed Apr 10, 2024
1 parent 8fc10aa commit 39866cd
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
6 changes: 4 additions & 2 deletions opencve/commands/imports/cve.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}"

Expand Down Expand Up @@ -129,7 +131,7 @@ def run():

]}]
cpe_info=cve_data.get("configurations", {})
info(cpe_info)

except Exception as e:
cpe=None

Expand Down
15 changes: 10 additions & 5 deletions opencve/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 39866cd

Please sign in to comment.