prospector/datamodel/advisory.py
def _get_from_nvd(self, vuln_id: str, nvd_rest_endpoint: str = NVD_REST_ENDPOINT):
        """
        populate object field using NVD data
        returns: description, published_timestamp, last_modified timestamp, list of links
        """

        try:
            response = requests.get(nvd_rest_endpoint + vuln_id)
            if response.status_code != 200:
                return
            # data = response.json()["result"]["CVE_Items"][0]
            data = response.json()
            self.published_timestamp = int(
                datetime.strptime(
                    data["publishedDate"], r"%Y-%m-%dT%H:%M%z"
                ).timestamp()
            )
            self.last_modified_timestamp = int(
                datetime.strptime(
                    data["lastModifiedDate"], r"%Y-%m-%dT%H:%M%z"
                ).timestamp()
            )

            self.description = data["cve"]["description"]["description_data"][0][
                "value"
            ]
            self.references = [
                r["url"] for r in data["cve"]["references"]["reference_data"]
            ]

        except Exception:
            _logger.error(
                "Could not retrieve vulnerability data from NVD for " + vuln_id,
                exc_info=log.config.level < logging.INFO,
            )

        populate object field using NVD data
        returns: description, published_timestamp, last_modified timestamp, list of links
        
populate object field using NVD data
returns: description, published_timestamp, last_modified timestamp, list of links
populate object field using NVD data returns : description published_timestamp last_modified timestamp list of links
def _get_from_nvd(self, vuln_id: str, nvd_rest_endpoint: str = NVD_REST_ENDPOINT):
        try:
            response = requests.get(nvd_rest_endpoint + vuln_id)
            if response.status_code != 200:
                return
            data = response.json()
            self.published_timestamp = int(
                datetime.strptime(
                    data["publishedDate"], r"%Y-%m-%dT%H:%M%z"
                ).timestamp()
            )
            self.last_modified_timestamp = int(
                datetime.strptime(
                    data["lastModifiedDate"], r"%Y-%m-%dT%H:%M%z"
                ).timestamp()
            )
            self.description = data["cve"]["description"]["description_data"][0][
                "value"
            ]
            self.references = [
                r["url"] for r in data["cve"]["references"]["reference_data"]
            ]
        except Exception:
            _logger.error(
                "Could not retrieve vulnerability data from NVD for " + vuln_id,
                exc_info=log.config.level < logging.INFO,
            )
def _get_from_nvd ( self , vuln_id : str , nvd_rest_endpoint : str = NVD_REST_ENDPOINT ) : try : response = requests . get ( nvd_rest_endpoint + vuln_id ) if response . status_code != 200 : return data = response . json ( ) self . published_timestamp = int ( datetime . strptime ( data [ "publishedDate" ] , r"%Y-%m-%dT%H:%M%z" ) . timestamp ( ) ) self . last_modified_timestamp = int ( datetime . strptime ( data [ "lastModifiedDate" ] , r"%Y-%m-%dT%H:%M%z" ) . timestamp ( ) ) self . description = data [ "cve" ] [ "description" ] [ "description_data" ] [ 0 ] [ "value" ] self . references = [ r [ "url" ] for r in data [ "cve" ] [ "references" ] [ "reference_data" ] ] except Exception : _logger . error ( "Could not retrieve vulnerability data from NVD for " + vuln_id , exc_info = log . config . level < logging . INFO , )
populate object field using NVD data
returns: description, published_timestamp, last_modified timestamp, list of links
populate object field using NVD data returns : description published_timestamp last_modified timestamp list of links
"""
        populate object field using NVD data
        returns: description, published_timestamp, last_modified timestamp, list of links
        """ # data = response.json()["result"]["CVE_Items"][0]
self
vuln_id
str
nvd_rest_endpoint
str