@@ -186,6 +186,15 @@ def format_data(self, all_cve_entries):
186
186
return cve_data , affects_data
187
187
188
188
def parse_node (self , node : dict [str , list [dict [str , str ]]]) -> list [dict [str , str ]]:
189
+ """
190
+ Parses a node from the NVD data to extract affected vendor, product, and version information.
191
+
192
+ Args:
193
+ node (dict): A dictionary representing a node in the NVD data.
194
+
195
+ Returns:
196
+ list[dict]: A list of dictionaries containing vendor, product, and version information.
197
+ """
189
198
affects_list = []
190
199
if "cpe_match" in node :
191
200
vulnerable_matches = (m for m in node ["cpe_match" ] if m ["vulnerable" ])
@@ -350,6 +359,15 @@ def format_data_api2(self, all_cve_entries):
350
359
def parse_node_api2 (
351
360
self , node : dict [str , list [dict [str , str ]]]
352
361
) -> list [dict [str , str ]]:
362
+ """
363
+ Parses a node from the NVD API 2.0 data to extract affected vendor, product, and version information.
364
+
365
+ Args:
366
+ node (dict): A dictionary representing a node in the NVD API 2.0 data.
367
+
368
+ Returns:
369
+ list[dict]: A list of dictionaries containing vendor, product, and version information.
370
+ """
353
371
affects_list = []
354
372
if "cpeMatch" in node :
355
373
vulnerable_matches = (m for m in node ["cpeMatch" ] if m ["vulnerable" ])
@@ -462,6 +480,16 @@ async def nist_fetch_using_api(self) -> list:
462
480
async def getmeta (
463
481
self , session : RateLimiter , meta_url : str
464
482
) -> tuple [str , dict [str , str ]]:
483
+ """
484
+ Retrieves metadata for a given URL.
485
+
486
+ Args:
487
+ session (RateLimiter): The session used to make HTTP requests.
488
+ meta_url (str): The URL to fetch metadata from.
489
+
490
+ Returns:
491
+ tuple: A tuple containing the URL for the JSON data and a dictionary of metadata.
492
+ """
465
493
async with await session .get (meta_url ) as response :
466
494
response .raise_for_status ()
467
495
return (
@@ -476,6 +504,15 @@ async def getmeta(
476
504
)
477
505
478
506
async def nist_scrape (self , session : RateLimiter ):
507
+ """
508
+ Scrapes the NVD feed page to get metadata links for CVE data.
509
+
510
+ Args:
511
+ session (RateLimiter): The session used to make HTTP requests.
512
+
513
+ Returns:
514
+ dict: A dictionary containing metadata links and their corresponding SHA values.
515
+ """
479
516
async with await session .get (self .feed ) as response :
480
517
response .raise_for_status ()
481
518
page = await response .text ()
0 commit comments